--- gigedit/trunk/src/gigedit/CombineInstrumentsDialog.cpp 2020/05/29 21:40:51 3780 +++ gigedit/trunk/src/gigedit/CombineInstrumentsDialog.cpp 2020/05/29 21:49:48 3781 @@ -217,7 +217,7 @@ * * Takes a planned new region (@a regionGroup) as argument and identifies which * precise dimensions would have to be created for that new region, along with - * the amount of dimension zones and their precise individual zone sizes. + * the amount of dimension zones. * * @param regionGroup - planned new region for a new instrument * @returns set of dimensions that shall be created for the given planned region @@ -242,19 +242,19 @@ for (uint z = 0; z < def.zones; ++z) { int dr = z << previousBits; gig::DimensionRegion* dimRgn = rgn->pDimensionRegions[dr]; - // Store the individual dimension zone sizes (or actually their - // upper limits here) for each dimension. - // HACK: Note that the velocity dimension is specially handled - // here. Instead of taking over custom velocity split sizes - // here, only a bogus number (zone index number) is stored for - // each velocity zone, that way only the maxiumum amount of - // velocity splits of all regions is stored here, and when their - // individual DimensionRegions are finally copied (later), the - // individual velocity split size are copied by that. + // NOTE: Originally this function collected dimensions' upper + // limits. However that caused combined instruments (e.g. with + // unequal dimension zone counts, not being a power of two) to + // end up having too many dimension zones and those extra zones + // containing no sample. For that reason we simply collect the + // required amount of output dimension zones here now instead. const int upperLimit = +/* (def.dimension == gig::dimension_velocity) ? z : (def.split_type == gig::split_type_bit) ? ((z+1) * 128/def.zones - 1) : dimRgn->DimensionUpperLimits[dr]; + */ + z; #if DEBUG_COMBINE_INSTRUMENTS printf(" %d,", upperLimit); #endif