317 |
}*/ |
}*/ |
318 |
|
|
319 |
/** |
/** |
320 |
|
* Make sure the passed MIDI key is part of the list of active keys, |
321 |
|
* if it is not already, then add it to that list. Accordingly it is |
322 |
|
* safe to call this method even if the requested key is already |
323 |
|
* marked as active. |
324 |
|
*/ |
325 |
|
void markKeyAsActive(MidiKey* pKey) { |
326 |
|
if (!pKey->Active) { // mark as active key |
327 |
|
pKey->Active = true; |
328 |
|
pKey->itSelf = pActiveKeys->allocAppend(); |
329 |
|
const int iKey = pKey - &pMIDIKeyInfo[0]; |
330 |
|
*pKey->itSelf = iKey; |
331 |
|
} |
332 |
|
} |
333 |
|
|
334 |
|
/** |
335 |
* Removes the given voice from the MIDI key's list of active voices. |
* Removes the given voice from the MIDI key's list of active voices. |
336 |
* This method will be called when a voice went inactive, e.g. because |
* This method will be called when a voice went inactive, e.g. because |
337 |
* it finished to playback its sample, finished its release stage or |
* it finished to playback its sample, finished its release stage or |
382 |
/** |
/** |
383 |
* Free all keys which have no active voices left |
* Free all keys which have no active voices left |
384 |
*/ |
*/ |
385 |
void FreeAllInactiveKyes() { |
void FreeAllInactiveKeys() { |
386 |
RTList<uint>::Iterator iuiKey = pActiveKeys->first(); |
RTList<uint>::Iterator iuiKey = pActiveKeys->first(); |
387 |
RTList<uint>::Iterator end = pActiveKeys->end(); |
RTList<uint>::Iterator end = pActiveKeys->end(); |
388 |
while (iuiKey != end) { // iterate through all active keys |
while (iuiKey != end) { // iterate through all active keys |