2740 |
} |
} |
2741 |
|
|
2742 |
Group::~Group() { |
Group::~Group() { |
2743 |
|
// remove the chunk associated with this group (if any) |
2744 |
|
if (pNameChunk) pNameChunk->GetParent()->DeleteSubChunk(pNameChunk); |
2745 |
} |
} |
2746 |
|
|
2747 |
/** @brief Update chunks with current group settings. |
/** @brief Update chunks with current group settings. |
2748 |
* |
* |
2749 |
* Apply current Group field values to the respective. You have to call |
* Apply current Group field values to the respective chunks. You have |
2750 |
* File::Save() to make changes persistent. |
* to call File::Save() to make changes persistent. |
2751 |
|
* |
2752 |
|
* Usually there is absolutely no need to call this method explicitly. |
2753 |
|
* It will be called automatically when File::Save() was called. |
2754 |
*/ |
*/ |
2755 |
void Group::UpdateChunks() { |
void Group::UpdateChunks() { |
2756 |
// make sure <3gri> and <3gnl> list chunks exist |
// make sure <3gri> and <3gnl> list chunks exist |
2898 |
if (!pSamples || !pSamples->size()) throw gig::Exception("Could not delete sample as there are no samples"); |
if (!pSamples || !pSamples->size()) throw gig::Exception("Could not delete sample as there are no samples"); |
2899 |
SampleList::iterator iter = find(pSamples->begin(), pSamples->end(), (DLS::Sample*) pSample); |
SampleList::iterator iter = find(pSamples->begin(), pSamples->end(), (DLS::Sample*) pSample); |
2900 |
if (iter == pSamples->end()) throw gig::Exception("Could not delete sample, could not find given sample"); |
if (iter == pSamples->end()) throw gig::Exception("Could not delete sample, could not find given sample"); |
2901 |
|
if (SamplesIterator != pSamples->end() && *SamplesIterator == pSample) ++SamplesIterator; // avoid iterator invalidation |
2902 |
pSamples->erase(iter); |
pSamples->erase(iter); |
2903 |
delete pSample; |
delete pSample; |
2904 |
} |
} |
3181 |
} |
} |
3182 |
} |
} |
3183 |
|
|
3184 |
|
/** |
3185 |
|
* Apply all the gig file's current instruments, samples, groups and settings |
3186 |
|
* to the respective RIFF chunks. You have to call Save() to make changes |
3187 |
|
* persistent. |
3188 |
|
* |
3189 |
|
* Usually there is absolutely no need to call this method explicitly. |
3190 |
|
* It will be called automatically when File::Save() was called. |
3191 |
|
* |
3192 |
|
* @throws Exception - on errors |
3193 |
|
*/ |
3194 |
|
void File::UpdateChunks() { |
3195 |
|
// first update base class's chunks |
3196 |
|
DLS::File::UpdateChunks(); |
3197 |
|
|
3198 |
|
// update group's chunks |
3199 |
|
if (pGroups) { |
3200 |
|
std::list<Group*>::iterator iter = pGroups->begin(); |
3201 |
|
std::list<Group*>::iterator end = pGroups->end(); |
3202 |
|
for (; iter != end; ++iter) { |
3203 |
|
(*iter)->UpdateChunks(); |
3204 |
|
} |
3205 |
|
} |
3206 |
|
} |
3207 |
|
|
3208 |
|
|
3209 |
|
|
3210 |
// *************** Exception *************** |
// *************** Exception *************** |