771 |
// |
// |
772 |
// FIXME: it would probably be better to just schedule newly spawned script executions here and then execute them altogether with already suspended ones all at once in order of all their scheduled timing |
// FIXME: it would probably be better to just schedule newly spawned script executions here and then execute them altogether with already suspended ones all at once in order of all their scheduled timing |
773 |
for (RTList<Event>::Iterator itEvent = pChannel->pEvents->first(), |
for (RTList<Event>::Iterator itEvent = pChannel->pEvents->first(), |
774 |
end = pChannel->pEvents->end(); itEvent != end; ++itEvent) |
end = pChannel->pEvents->end(); itEvent != end; ) |
775 |
{ |
{ |
776 |
|
//HACK: avoids iterator invalidation which might happen below since an instrument script might drop an event by direct raw pointer access (it would be considerable to extend the Iterator class to detect and circumvent this case by checking the "reincarnation" member variable). |
777 |
|
RTList<Event>::Iterator itNext = itEvent; |
778 |
|
++itNext; |
779 |
|
|
780 |
switch (itEvent->Type) { |
switch (itEvent->Type) { |
781 |
case Event::type_note_on: |
case Event::type_note_on: |
782 |
if (pChannel->pScript->handlerNote) |
if (pChannel->pScript->handlerNote) |
796 |
//TODO: ... |
//TODO: ... |
797 |
break; |
break; |
798 |
} |
} |
799 |
|
|
800 |
|
// see HACK comment above |
801 |
|
itEvent = itNext; |
802 |
} |
} |
803 |
|
|
804 |
// this has to be run again, since the newly spawned scripts |
// this has to be run again, since the newly spawned scripts |