Threading and synchronization

There are three kinds of threads relevant to audio processing.

  • Audio engine main thread: This can be either a FIFO writer thread(class AudioEngine::fifoWriter)or an audio file renderer thread(class ProjectRenderer). They calls AudioEngine::renderNextBuffer() which renders audio.

  • Audio engine worker threads: They runs rendering subtasks which are queued by the audio engine main thread.

  • UI, MIDI, and other threads: They may change parameters or drive instruments.

Non-automated changes may result in race conditions if they aren't synchronized with the audio engine properly. To prevent it, AudioEngine provides those functions:

  • requestChangeInModel()/doneChangeInModel():

AudioEngine handles the calls using runChangesInModel()

Last updated