171 |
|
|
172 |
script.handlerInit = script.parserContext->eventHandlerByName("init"); |
script.handlerInit = script.parserContext->eventHandlerByName("init"); |
173 |
script.handlerNote = script.parserContext->eventHandlerByName("note"); |
script.handlerNote = script.parserContext->eventHandlerByName("note"); |
174 |
|
script.handlerRelease = script.parserContext->eventHandlerByName("release"); |
175 |
script.handlerController = script.parserContext->eventHandlerByName("controller"); |
script.handlerController = script.parserContext->eventHandlerByName("controller"); |
176 |
script.bHasValidScript = |
script.bHasValidScript = |
177 |
script.handlerInit || script.handlerNote || script.handlerController; |
script.handlerInit || script.handlerNote || script.handlerRelease || |
178 |
|
script.handlerController; |
179 |
|
|
180 |
// amount of script handlers each script event has to execute |
// amount of script handlers each script event has to execute |
181 |
int handlerExecCount = 0; |
int handlerExecCount = 0; |
182 |
if (script.handlerInit) handlerExecCount++; |
if (script.handlerInit) handlerExecCount++; // "init" handler is always executed before the actual event handler |
183 |
if (script.handlerNote || script.handlerController) handlerExecCount++; |
if (script.handlerNote || script.handlerRelease || script.handlerController) // only one of these are executed after "init" handler |
184 |
|
handlerExecCount++; |
185 |
|
|
186 |
// create script event pool (if it doesn't exist already) |
// create script event pool (if it doesn't exist already) |
187 |
if (!pScriptEvents) |
if (!pScriptEvents) |
231 |
script.parserContext = NULL; |
script.parserContext = NULL; |
232 |
script.handlerInit = NULL; |
script.handlerInit = NULL; |
233 |
script.handlerNote = NULL; |
script.handlerNote = NULL; |
234 |
|
script.handlerRelease = NULL; |
235 |
script.handlerController = NULL; |
script.handlerController = NULL; |
236 |
} |
} |
237 |
script.bHasValidScript = false; |
script.bHasValidScript = false; |
887 |
} |
} |
888 |
eventQueueReader.free(); // free all copied events from input queue |
eventQueueReader.free(); // free all copied events from input queue |
889 |
} |
} |
890 |
|
|
891 |
|
/** |
892 |
|
* Called by real-time instrument script functions to schedule a new event |
893 |
|
* somewhere in future. |
894 |
|
*/ |
895 |
|
void AbstractEngineChannel::ScheduleEvent(const Event* pEvent, int delay) { //TODO: delay not implemented yet |
896 |
|
// since delay is not implemented yet, we simply add the new event |
897 |
|
// to the event list of the current audio fragmet cycle for now |
898 |
|
RTList<Event>::Iterator itEvent = pEvents->allocAppend(); |
899 |
|
if (itEvent) *itEvent = *pEvent; // copy event |
900 |
|
} |
901 |
|
|
902 |
FxSend* AbstractEngineChannel::AddFxSend(uint8_t MidiCtrl, String Name) throw (Exception) { |
FxSend* AbstractEngineChannel::AddFxSend(uint8_t MidiCtrl, String Name) throw (Exception) { |
903 |
if (pEngine) pEngine->DisableAndLock(); |
if (pEngine) pEngine->DisableAndLock(); |