/[svn]/gigedit/trunk/src/gigedit/CombineInstrumentsDialog.cpp
ViewVC logotype

Diff of /gigedit/trunk/src/gigedit/CombineInstrumentsDialog.cpp

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 3782 by schoenebeck, Fri May 29 23:25:06 2020 UTC revision 3783 by schoenebeck, Sat May 30 00:14:27 2020 UTC
# Line 412  struct CopyAssignSchedEntry { Line 412  struct CopyAssignSchedEntry {
412  };  };
413  typedef std::vector<CopyAssignSchedEntry> CopyAssignSchedule;  typedef std::vector<CopyAssignSchedEntry> CopyAssignSchedule;
414    
415    /** @brief Constrain @a dimCase according to @a rgn's dimension zones.
416     *
417     * To avoid @a dimCase being an invalid dimension region selection on @a rgn,
418     * this function automatically wraps (if required) the individual dimension case
419     * entries according to region's actual amount of dimension zones.
420     *
421     * @param dimCase - dimension case to be potentially corrected
422     * @param rgn - the region upon @a dimCase shall be corrected for
423     */
424    static void wrapDimCase(DimensionCase& dimCase, gig::Region* rgn) {
425        for (auto& it : dimCase) {
426            gig::dimension_def_t* def = rgn->GetDimensionDefinition(it.first);
427            const int zones = (def) ? def->zones : 1;
428            it.second %= zones;
429        }
430    }
431    
432  /** @brief Schedule copying DimensionRegions from source Region to target Region.  /** @brief Schedule copying DimensionRegions from source Region to target Region.
433   *   *
434   * Schedules copying the entire articulation informations (including sample   * Schedules copying the entire articulation informations (including sample
# Line 456  static void scheduleCopyDimensionRegions Line 473  static void scheduleCopyDimensionRegions
473          uint dstDimValues[8] = {};          uint dstDimValues[8] = {};
474          DimensionCase srcDimCase = dimCase;          DimensionCase srcDimCase = dimCase;
475          DimensionCase dstDimCase = dimCase;          DimensionCase dstDimCase = dimCase;
476    
477            // source might have less zones than destination, so to prevent output
478            // instrument ending up with NULL samples in some of the dimension
479            // zones, wrap here the source zone according to the amount of zones the
480            // source really has
481            wrapDimCase(srcDimCase, inRgn);
482    
483          srcDimCase[mainDim] = iSrcMainBit;          srcDimCase[mainDim] = iSrcMainBit;
484          dstDimCase[mainDim] = iDstMainBit;          dstDimCase[mainDim] = iDstMainBit;
485    

Legend:
Removed from v.3782  
changed lines
  Added in v.3783

  ViewVC Help
Powered by ViewVC