1011 |
{ |
{ |
1012 |
// polyphonic variable data is used/passed from "note" to |
// polyphonic variable data is used/passed from "note" to |
1013 |
// "release" script callback, so we have to recycle the |
// "release" script callback, so we have to recycle the |
1014 |
// original "note on" script event(s) |
// original "note on" script event |
1015 |
RTList<ScriptEvent>::Iterator it = pChannel->pScript->pKeyEvents[key]->first(); |
RTList<ScriptEvent>::Iterator it = pChannel->pScript->pKeyEvents[key]->first(); |
1016 |
RTList<ScriptEvent>::Iterator end = pChannel->pScript->pKeyEvents[key]->end(); |
RTList<ScriptEvent>::Iterator end = pChannel->pScript->pKeyEvents[key]->end(); |
1017 |
for (; it != end; ++it) { |
for (; it != end; ++it) { |
1018 |
|
// Despite the loop, in fact we're just picking and |
1019 |
|
// running EXACTLY ONE script event here and then leave |
1020 |
|
// the loop immediately. The following check, and with |
1021 |
|
// it the loop itself is probably overkill/redundant, |
1022 |
|
// because once we executed the script here, the chosen |
1023 |
|
// script event will be moved away from the pKeyEvents |
1024 |
|
// list. Which means we could probably drop the loop and |
1025 |
|
// simply always pick the very first script event from |
1026 |
|
// pKeyEvents here and that's it. |
1027 |
|
if (it->handlerType != VM_EVENT_HANDLER_NOTE) |
1028 |
|
continue; |
1029 |
ProcessScriptEvent( |
ProcessScriptEvent( |
1030 |
pChannel, itEvent, pEventHandler, it |
pChannel, itEvent, pEventHandler, it |
1031 |
); |
); |
1032 |
|
// We don't want to run the "release" handler of more |
1033 |
|
// than one (previously being "note" handler) script |
1034 |
|
// event here, because the precise relationship between |
1035 |
|
// exactly one "note" handler instance and one "release" |
1036 |
|
// handler instance must always be preserved to prevent |
1037 |
|
// misbehaviours with scripts (e.g. a script author |
1038 |
|
// might increment a script variable in the "note" |
1039 |
|
// handler and decrement the variable in the "release" |
1040 |
|
// handler to count the currently pressed down keys). |
1041 |
|
break; |
1042 |
} |
} |
1043 |
} else { |
} else { |
1044 |
// no polyphonic data is used/passed from "note" to |
// no polyphonic data is used/passed from "note" to |