MCPcopy Create free account
hub / github.com/christophhart/HISE / runScriptCallbacks

Method runScriptCallbacks

hi_scripting/scripting/ScriptProcessorModules.cpp:294–407  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

292}
293
294void JavascriptMidiProcessor::runScriptCallbacks()
295{
296 if (currentEvent->isAllNotesOff())
297 {
298 synthObject->handleNoteCounter(*currentEvent);
299 // All notes off are controller message, so they should not be processed, or it can lead to loop.
300 currentMidiMessage->onAllNotesOff();
301 return;
302 }
303
304#if ENABLE_SCRIPTING_BREAKPOINTS
305 breakpointWasHit(-1);
306#endif
307
308 scriptEngine->maximumExecutionTime = HiseJavascriptEngine::getDefaultTimeOut();
309
310 synthObject->handleNoteCounter(*currentEvent);
311
312 switch (currentEvent->getType())
313 {
314 case HiseEvent::Type::NoteOn:
315 {
316 if (onNoteOnCallback->isSnippetEmpty()) return;
317
318 scriptEngine->executeCallback(onNoteOn, &lastResult);
319
320 BACKEND_ONLY(if (!lastResult.wasOk()) debugError(this, lastResult.getErrorMessage()));
321
322 break;
323 }
324 case HiseEvent::Type::NoteOff:
325 {
326 if (onNoteOffCallback->isSnippetEmpty()) return;
327
328 scriptEngine->executeCallback(onNoteOff, &lastResult);
329
330 BACKEND_ONLY(if (!lastResult.wasOk()) debugError(this, lastResult.getErrorMessage()));
331
332 break;
333 }
334 case HiseEvent::Type::Controller:
335 case HiseEvent::Type::PitchBend:
336 case HiseEvent::Type::Aftertouch:
337 case HiseEvent::Type::ProgramChange:
338 {
339 if (currentEvent->isControllerOfType(64))
340 {
341 synthObject->setSustainPedal(currentEvent->getControllerValue() > 64);
342 }
343
344 if (onControllerCallback->isSnippetEmpty()) return;
345
346
347
348
349 Result r = Result::ok();
350 scriptEngine->executeCallback(onController, &lastResult);
351

Callers 1

handleAsyncUpdateMethod · 0.80

Calls 15

getDefaultTimeOutFunction · 0.85
isAllNotesOffMethod · 0.80
handleNoteCounterMethod · 0.80
isSnippetEmptyMethod · 0.80
isControllerOfTypeMethod · 0.80
setSustainPedalMethod · 0.80
getTimeStampMethod · 0.80
isSongPositionPointerMethod · 0.80
isMidiStartMethod · 0.80
isMidiStopMethod · 0.80
ifFunction · 0.50

Tested by

no test coverage detected