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 27 Next »

HALion provides two threads:

  • Parameter changes and the storage of them are handled by the Controller thread.
  • MIDI event processing and sound reproduction happens in the Processor thread.

You can think of these threads like two sections of code that are exectued in concurrency by HALion. Basically, the two threads are needed to split longer lasting function calls from timing critical function calls. Therefore, the functions that are called in the controller thread are executed only as fast as required, while the functions that are called in the processor thread are executed within an ASIO block.

On this page:

The information if a function can be called in the controller, the processor or in both threads, can be found on the Reference pages below the description of each function.

It looks like this:

Available in: Controller, Processor.

Script Error - Wrong Thread

If you call a function in the wrong thread, the script module will output an error message.

Example

--[[
  Example for a script error when calling a function in the wrong thread.
  Functions that add or remove elements can only be called in the controller thread.
  The onNote callback runs in the processor thread. Therefore, removeMidiModule cannot be called in onNote.
  The script produces a script error, when playing a note.
--]]

function onNote(event)      
  this.parent:removeMidiModule(this)
end

The output message for the script error of the above example looks like this:

Script Error - Wrong Thread

 

Controller Functions

Processor Functions

  • No labels