2120 |
dimension == dimension_releasetrigger || |
dimension == dimension_releasetrigger || |
2121 |
dimension == dimension_keyboard || |
dimension == dimension_keyboard || |
2122 |
dimension == dimension_roundrobin || |
dimension == dimension_roundrobin || |
2123 |
dimension == dimension_random) ? split_type_bit |
dimension == dimension_random || |
2124 |
: split_type_normal; |
dimension == dimension_smartmidi || |
2125 |
|
dimension == dimension_roundrobinkeyboard) ? split_type_bit |
2126 |
|
: split_type_normal; |
2127 |
pDimensionDefinitions[i].zone_size = |
pDimensionDefinitions[i].zone_size = |
2128 |
(pDimensionDefinitions[i].split_type == split_type_normal) ? 128.0 / pDimensionDefinitions[i].zones |
(pDimensionDefinitions[i].split_type == split_type_normal) ? 128.0 / pDimensionDefinitions[i].zones |
2129 |
: 0; |
: 0; |
2893 |
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"); |
2894 |
SampleList::iterator iter = find(pSamples->begin(), pSamples->end(), (DLS::Sample*) pSample); |
SampleList::iterator iter = find(pSamples->begin(), pSamples->end(), (DLS::Sample*) pSample); |
2895 |
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"); |
2896 |
|
if (SamplesIterator != pSamples->end() && *SamplesIterator == pSample) ++SamplesIterator; // avoid iterator invalidation |
2897 |
pSamples->erase(iter); |
pSamples->erase(iter); |
2898 |
delete pSample; |
delete pSample; |
2899 |
} |
} |
3030 |
* have to call Save() to make this persistent to the file. |
* have to call Save() to make this persistent to the file. |
3031 |
* |
* |
3032 |
* @param pInstrument - instrument to delete |
* @param pInstrument - instrument to delete |
3033 |
* @throws gig::Excption if given instrument could not be found |
* @throws gig::Exception if given instrument could not be found |
3034 |
*/ |
*/ |
3035 |
void File::DeleteInstrument(Instrument* pInstrument) { |
void File::DeleteInstrument(Instrument* pInstrument) { |
3036 |
if (!pInstruments) throw gig::Exception("Could not delete instrument as there are no instruments"); |
if (!pInstruments) throw gig::Exception("Could not delete instrument as there are no instruments"); |
3108 |
return pGroup; |
return pGroup; |
3109 |
} |
} |
3110 |
|
|
3111 |
|
/** @brief Delete a group and its samples. |
3112 |
|
* |
3113 |
|
* This will delete the given Group object and all the samples that |
3114 |
|
* belong to this group from the gig file. You have to call Save() to |
3115 |
|
* make this persistent to the file. |
3116 |
|
* |
3117 |
|
* @param pGroup - group to delete |
3118 |
|
* @throws gig::Exception if given group could not be found |
3119 |
|
*/ |
3120 |
void File::DeleteGroup(Group* pGroup) { |
void File::DeleteGroup(Group* pGroup) { |
3121 |
if (!pGroups) LoadGroups(); |
if (!pGroups) LoadGroups(); |
3122 |
std::list<Group*>::iterator iter = find(pGroups->begin(), pGroups->end(), pGroup); |
std::list<Group*>::iterator iter = find(pGroups->begin(), pGroups->end(), pGroup); |
3123 |
if (iter == pGroups->end()) throw gig::Exception("Could not delete group, could not find given group"); |
if (iter == pGroups->end()) throw gig::Exception("Could not delete group, could not find given group"); |
3124 |
|
if (pGroups->size() == 1) throw gig::Exception("Cannot delete group, there must be at least one default group!"); |
3125 |
|
// delete all members of this group |
3126 |
|
for (Sample* pSample = pGroup->GetFirstSample(); pSample; pSample = pGroup->GetNextSample()) { |
3127 |
|
DeleteSample(pSample); |
3128 |
|
} |
3129 |
|
// now delete this group object |
3130 |
|
pGroups->erase(iter); |
3131 |
|
delete pGroup; |
3132 |
|
} |
3133 |
|
|
3134 |
|
/** @brief Delete a group. |
3135 |
|
* |
3136 |
|
* This will delete the given Group object from the gig file. All the |
3137 |
|
* samples that belong to this group will not be deleted, but instead |
3138 |
|
* be moved to another group. You have to call Save() to make this |
3139 |
|
* persistent to the file. |
3140 |
|
* |
3141 |
|
* @param pGroup - group to delete |
3142 |
|
* @throws gig::Exception if given group could not be found |
3143 |
|
*/ |
3144 |
|
void File::DeleteGroupOnly(Group* pGroup) { |
3145 |
|
if (!pGroups) LoadGroups(); |
3146 |
|
std::list<Group*>::iterator iter = find(pGroups->begin(), pGroups->end(), pGroup); |
3147 |
|
if (iter == pGroups->end()) throw gig::Exception("Could not delete group, could not find given group"); |
3148 |
if (pGroups->size() == 1) throw gig::Exception("Cannot delete group, there must be at least one default group!"); |
if (pGroups->size() == 1) throw gig::Exception("Cannot delete group, there must be at least one default group!"); |
3149 |
// move all members of this group to another group |
// move all members of this group to another group |
3150 |
pGroup->MoveAll(); |
pGroup->MoveAll(); |