Page tree
Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 7 Next »

runSync(func, id)


Calls a Lua function and executes it in the processor thread. With runSync you can invoke a function of the processor thread by an operation in the controller thread. For example, by calling runSync in a parameter change callback (controller thread) you can invoke an event function (processor thread) like playNotereleaseVoicecontrolChange, etc. The callback that called runSync is not stopped and continues its execution. runSync will be exectued in the next audio block. If id is specified, another call to runSync with the same ID overwrites the previous function call, if it has not been executed yet.

Available in: Processor.


funcThe name of the function to be called.function
idAn identifier to collect multiple calls of runSync. Only the last call will be executed in next audio blockvariant, optional


-- fade all voices with a parameter
noteIDs = {}

function onNote(event)
  local id = postEvent(event)
  table.insert(noteIDs, id)

function syncFadeAllVoices()
  for i, id in ipairs(noteIDs) do
      fade(id, nil, 0, 1000, true)
  noteIDs = {}

function fadeAllVoices()
  if fadeVoices then
    runSync(syncFadeAllVoices, 1)

defineParameter("fadeVoices", "Fade All Voices", false, fadeAllVoices)
  • No labels