254 |
} |
} |
255 |
|
|
256 |
|
|
257 |
|
|
258 |
|
// *************** Other Internal functions *************** |
259 |
|
// * |
260 |
|
|
261 |
|
static split_type_t __resolveSplitType(dimension_t dimension) { |
262 |
|
return ( |
263 |
|
dimension == dimension_layer || |
264 |
|
dimension == dimension_samplechannel || |
265 |
|
dimension == dimension_releasetrigger || |
266 |
|
dimension == dimension_keyboard || |
267 |
|
dimension == dimension_roundrobin || |
268 |
|
dimension == dimension_random || |
269 |
|
dimension == dimension_smartmidi || |
270 |
|
dimension == dimension_roundrobinkeyboard |
271 |
|
) ? split_type_bit : split_type_normal; |
272 |
|
} |
273 |
|
|
274 |
|
static int __resolveZoneSize(dimension_def_t& dimension_definition) { |
275 |
|
return (dimension_definition.split_type == split_type_normal) |
276 |
|
? int(128.0 / dimension_definition.zones) : 0; |
277 |
|
} |
278 |
|
|
279 |
|
|
280 |
|
|
281 |
// *************** Sample *************** |
// *************** Sample *************** |
282 |
// * |
// * |
283 |
|
|
2139 |
pDimensionDefinitions[i].dimension = dimension; |
pDimensionDefinitions[i].dimension = dimension; |
2140 |
pDimensionDefinitions[i].bits = bits; |
pDimensionDefinitions[i].bits = bits; |
2141 |
pDimensionDefinitions[i].zones = zones ? zones : 0x01 << bits; // = pow(2,bits) |
pDimensionDefinitions[i].zones = zones ? zones : 0x01 << bits; // = pow(2,bits) |
2142 |
pDimensionDefinitions[i].split_type = (dimension == dimension_layer || |
pDimensionDefinitions[i].split_type = __resolveSplitType(dimension); |
2143 |
dimension == dimension_samplechannel || |
pDimensionDefinitions[i].zone_size = __resolveZoneSize(pDimensionDefinitions[i]); |
|
dimension == dimension_releasetrigger || |
|
|
dimension == dimension_keyboard || |
|
|
dimension == dimension_roundrobin || |
|
|
dimension == dimension_random || |
|
|
dimension == dimension_smartmidi || |
|
|
dimension == dimension_roundrobinkeyboard) ? split_type_bit |
|
|
: split_type_normal; |
|
|
pDimensionDefinitions[i].zone_size = |
|
|
(pDimensionDefinitions[i].split_type == split_type_normal) ? 128.0 / pDimensionDefinitions[i].zones |
|
|
: 0; |
|
2144 |
Dimensions++; |
Dimensions++; |
2145 |
|
|
2146 |
// if this is a layer dimension, remember the amount of layers |
// if this is a layer dimension, remember the amount of layers |
2166 |
if (file->pWavePoolTable) pDimensionRegions[i]->pSample = GetSampleFromWavePool(wavepoolindex); |
if (file->pWavePoolTable) pDimensionRegions[i]->pSample = GetSampleFromWavePool(wavepoolindex); |
2167 |
} |
} |
2168 |
GetSample(); // load global region sample reference |
GetSample(); // load global region sample reference |
2169 |
|
} else { |
2170 |
|
DimensionRegions = 0; |
2171 |
} |
} |
2172 |
|
|
2173 |
// make sure there is at least one dimension region |
// make sure there is at least one dimension region |
2190 |
* @throws gig::Exception if samples cannot be dereferenced |
* @throws gig::Exception if samples cannot be dereferenced |
2191 |
*/ |
*/ |
2192 |
void Region::UpdateChunks() { |
void Region::UpdateChunks() { |
2193 |
|
// in the gig format we don't care about the Region's sample reference |
2194 |
|
// but we still have to provide some existing one to not corrupt the |
2195 |
|
// file, so to avoid the latter we simply always assign the sample of |
2196 |
|
// the first dimension region of this region |
2197 |
|
pSample = pDimensionRegions[0]->pSample; |
2198 |
|
|
2199 |
// first update base class's chunks |
// first update base class's chunks |
2200 |
DLS::Region::UpdateChunks(); |
DLS::Region::UpdateChunks(); |
2201 |
|
|
2370 |
// assign definition of new dimension |
// assign definition of new dimension |
2371 |
pDimensionDefinitions[Dimensions] = *pDimDef; |
pDimensionDefinitions[Dimensions] = *pDimDef; |
2372 |
|
|
2373 |
|
// auto correct certain dimension definition fields (where possible) |
2374 |
|
pDimensionDefinitions[Dimensions].split_type = |
2375 |
|
__resolveSplitType(pDimensionDefinitions[Dimensions].dimension); |
2376 |
|
pDimensionDefinitions[Dimensions].zone_size = |
2377 |
|
__resolveZoneSize(pDimensionDefinitions[Dimensions]); |
2378 |
|
|
2379 |
// create new dimension region(s) for this new dimension |
// create new dimension region(s) for this new dimension |
2380 |
for (int i = 1 << iCurrentBits; i < 1 << iNewBits; i++) { |
for (int i = 1 << iCurrentBits; i < 1 << iNewBits; i++) { |
2381 |
//TODO: maybe we should copy existing dimension regions if possible instead of simply creating new ones with default values |
//TODO: maybe we should copy existing dimension regions if possible instead of simply creating new ones with default values |
2768 |
} |
} |
2769 |
|
|
2770 |
Group::~Group() { |
Group::~Group() { |
2771 |
|
// remove the chunk associated with this group (if any) |
2772 |
|
if (pNameChunk) pNameChunk->GetParent()->DeleteSubChunk(pNameChunk); |
2773 |
} |
} |
2774 |
|
|
2775 |
/** @brief Update chunks with current group settings. |
/** @brief Update chunks with current group settings. |