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 |
540 |
RTList<Event>::Iterator itNewEvent = pKey->pEvents->allocAppend(); |
RTList<Event>::Iterator itNewEvent = pKey->pEvents->allocAppend(); |
541 |
if (itNewEvent) { |
if (itNewEvent) { |
542 |
*itNewEvent = *itReleaseEvent; // copy original event (to the key's event list) |
*itNewEvent = *itReleaseEvent; // copy original event (to the key's event list) |
543 |
itNewEvent->Type = Event::type_release; // transform event type |
itNewEvent->Type = Event::type_release_key; // transform event type |
544 |
} |
} |
545 |
else dmsg(1,("Event pool emtpy!\n")); |
else dmsg(1,("Event pool emtpy!\n")); |
546 |
} |
} |
682 |
RTList<Event>::Iterator itNewEvent = pKey->pEvents->allocAppend(); |
RTList<Event>::Iterator itNewEvent = pKey->pEvents->allocAppend(); |
683 |
if (itNewEvent) { |
if (itNewEvent) { |
684 |
*itNewEvent = *itEvent; // copy event to the key's own event list |
*itNewEvent = *itEvent; // copy event to the key's own event list |
685 |
itNewEvent->Type = Event::type_cancel_release; // transform event type |
itNewEvent->Type = Event::type_cancel_release_key; // transform event type |
686 |
} |
} |
687 |
else dmsg(1,("Event pool emtpy!\n")); |
else dmsg(1,("Event pool emtpy!\n")); |
688 |
} |
} |
698 |
RTList<Event>::Iterator itNewEvent = pKey->pEvents->allocAppend(); |
RTList<Event>::Iterator itNewEvent = pKey->pEvents->allocAppend(); |
699 |
if (itNewEvent) { |
if (itNewEvent) { |
700 |
*itNewEvent = *itEvent; // copy event to the key's own event list |
*itNewEvent = *itEvent; // copy event to the key's own event list |
701 |
itNewEvent->Type = Event::type_release; // transform event type |
itNewEvent->Type = Event::type_release_key; // transform event type |
702 |
itNewEvent->Param.Note.Key = *iuiKey; |
itNewEvent->Param.Note.Key = *iuiKey; |
703 |
itNewEvent->Param.Note.Velocity = 127; |
itNewEvent->Param.Note.Velocity = 127; |
704 |
if (!SostenutoActiveOnKey(*iuiKey)) { |
if (!SostenutoActiveOnKey(*iuiKey)) { |
763 |
RTList<Event>::Iterator itNewEvent = pKey->pEvents->allocAppend(); |
RTList<Event>::Iterator itNewEvent = pKey->pEvents->allocAppend(); |
764 |
if (itNewEvent) { |
if (itNewEvent) { |
765 |
*itNewEvent = *itEvent; // copy event to the key's own event list |
*itNewEvent = *itEvent; // copy event to the key's own event list |
766 |
itNewEvent->Type = Event::type_release; // transform event type |
itNewEvent->Type = Event::type_release_key; // transform event type |
767 |
} |
} |
768 |
else dmsg(1,("Event pool emtpy!\n")); |
else dmsg(1,("Event pool emtpy!\n")); |
769 |
} |
} |