185 |
} else { |
} else { |
186 |
for (int i = low; i <= high; i++) info.KeyBindings[i] = 1; |
for (int i = low; i <= high; i++) info.KeyBindings[i] = 1; |
187 |
} |
} |
188 |
|
|
189 |
pRegion = pInstrument->GetNextRegion(); |
pRegion = pInstrument->GetNextRegion(); |
190 |
} |
} |
191 |
|
|
192 |
if (loaded) { // retrieve keyswitching only if the instrument is fully loaded. |
if (loaded) { // retrieve keyswitching only if the instrument is fully loaded. |
193 |
int low = pInstrument->DimensionKeyRange.low; |
|
194 |
int high = pInstrument->DimensionKeyRange.high; |
// only return keyswitch range if keyswitching is used |
195 |
if (low < 0 || low > 127 || high < 0 || high > 127 || low > high) { |
bool hasKeyswitches = false; |
196 |
std::cerr << "Invalid keyswitch range: " << low << " - " << high << std::endl; |
for (::gig::Region* pRegion = pInstrument->GetFirstRegion() ; |
197 |
} else { |
pRegion && !hasKeyswitches ; |
198 |
for (int i = low; i <= high; i++) info.KeySwitchBindings[i] = 1; |
pRegion = pInstrument->GetNextRegion()) { |
199 |
|
for (int i = 0 ; i < pRegion->Dimensions ; i++) { |
200 |
|
if (pRegion->pDimensionDefinitions[i].dimension == ::gig::dimension_keyboard) { |
201 |
|
hasKeyswitches = true; |
202 |
|
break; |
203 |
|
} |
204 |
|
} |
205 |
|
} |
206 |
|
|
207 |
|
if (hasKeyswitches) { |
208 |
|
int low = pInstrument->DimensionKeyRange.low; |
209 |
|
int high = pInstrument->DimensionKeyRange.high; |
210 |
|
if (low < 0 || low > 127 || high < 0 || high > 127 || low > high) { |
211 |
|
std::cerr << "Invalid keyswitch range: " << low << " - " << high << std::endl; |
212 |
|
} else { |
213 |
|
for (int i = low; i <= high; i++) info.KeySwitchBindings[i] = 1; |
214 |
|
} |
215 |
} |
} |
216 |
} |
} |
217 |
|
|