347 |
} |
} |
348 |
|
|
349 |
virtual void ProcessKeySwitchChange(int key) = 0; |
virtual void ProcessKeySwitchChange(int key) = 0; |
350 |
|
|
351 |
|
/** |
352 |
|
* Handle key group (a.k.a. exclusive group) conflicts |
353 |
|
*/ |
354 |
|
void HandleKeyGroupConflicts(uint KeyGroup, Pool<Event>::Iterator& itNoteOnEvent) { |
355 |
|
if (KeyGroup) { // if this voice / key belongs to a key group |
356 |
|
uint** ppKeyGroup = &MidiKeyboardManager<V>::ActiveKeyGroups[KeyGroup]; |
357 |
|
if (*ppKeyGroup) { // if there's already an active key in that key group |
358 |
|
MidiKey* pOtherKey = &MidiKeyboardManager<V>::pMIDIKeyInfo[**ppKeyGroup]; |
359 |
|
// kill all voices on the (other) key |
360 |
|
typename RTList<V>::Iterator itVoiceToBeKilled = pOtherKey->pActiveVoices->first(); |
361 |
|
typename RTList<V>::Iterator end = pOtherKey->pActiveVoices->end(); |
362 |
|
for (; itVoiceToBeKilled != end; ++itVoiceToBeKilled) { |
363 |
|
if (itVoiceToBeKilled->Type != Voice::type_release_trigger) { |
364 |
|
itVoiceToBeKilled->Kill(itNoteOnEvent); |
365 |
|
--pEngine->VoiceSpawnsLeft; //FIXME: just a hack, we should better check in StealVoice() if the voice was killed due to key conflict |
366 |
|
} |
367 |
|
} |
368 |
|
} |
369 |
|
} |
370 |
|
} |
371 |
}; |
}; |
372 |
|
|
373 |
} // namespace LinuxSampler |
} // namespace LinuxSampler |