2 |
* * |
* * |
3 |
* libgig - C++ cross-platform Gigasampler format file access library * |
* libgig - C++ cross-platform Gigasampler format file access library * |
4 |
* * |
* * |
5 |
* Copyright (C) 2003-2020 by Christian Schoenebeck * |
* Copyright (C) 2003-2021 by Christian Schoenebeck * |
6 |
* <cuse@users.sourceforge.net> * |
* <cuse@users.sourceforge.net> * |
7 |
* * |
* * |
8 |
* This library is free software; you can redistribute it and/or modify * |
* This library is free software; you can redistribute it and/or modify * |
3951 |
* @throws gig::Exception if requested zone could not be splitted |
* @throws gig::Exception if requested zone could not be splitted |
3952 |
*/ |
*/ |
3953 |
void Region::SplitDimensionZone(dimension_t type, int zone) { |
void Region::SplitDimensionZone(dimension_t type, int zone) { |
3954 |
|
if (!Dimensions) |
3955 |
|
throw gig::Exception("Could not split dimension zone, because there is no dimension at all."); |
3956 |
dimension_def_t* oldDef = GetDimensionDefinition(type); |
dimension_def_t* oldDef = GetDimensionDefinition(type); |
3957 |
if (!oldDef) |
if (!oldDef) |
3958 |
throw gig::Exception("Could not split dimension zone, no such dimension of given type"); |
throw gig::Exception("Could not split dimension zone, no such dimension of given type"); |
3979 |
// requested by the arguments of this method call) to the temporary |
// requested by the arguments of this method call) to the temporary |
3980 |
// region, and don't use Region::CopyAssign() here for this task, since |
// region, and don't use Region::CopyAssign() here for this task, since |
3981 |
// it would also alter fast lookup helper variables here and there |
// it would also alter fast lookup helper variables here and there |
3982 |
dimension_def_t newDef; |
dimension_def_t newDef = {}; |
3983 |
for (int i = 0; i < Dimensions; ++i) { |
for (int i = 0; i < Dimensions; ++i) { |
3984 |
dimension_def_t def = pDimensionDefinitions[i]; // copy, don't reference |
dimension_def_t def = pDimensionDefinitions[i]; // copy, don't reference |
3985 |
// is this the dimension requested by the method arguments? ... |
// is this the dimension requested by the method arguments? ... |
3990 |
} |
} |
3991 |
tempRgn->AddDimension(&def); |
tempRgn->AddDimension(&def); |
3992 |
} |
} |
3993 |
|
// silence clang sanitizer warning |
3994 |
|
if (newDef.dimension == dimension_none) |
3995 |
|
throw gig::Exception("Unexpected internal failure resolving dimension in SplitDimensionZone() [this is a bug]."); |
3996 |
|
|
3997 |
// find the dimension index in the tempRegion which is the dimension |
// find the dimension index in the tempRegion which is the dimension |
3998 |
// type passed to this method (paranoidly expecting different order) |
// type passed to this method (paranoidly expecting different order) |