Timer controlling both UI and Audio threads
-
Hello, I'm building a sequencer plugin where having real time audio in sync will be very important. Followed some threads online and it seems best practice is to instantiate the timer and handle the audio in an external script and then putting deferCallbacks on my UI script to ensure prioritization of the audio thread.
However, I do want my timer to also control the UI in my sequencer for example by lighting up each step number in the sequencer....what is best practice and how do I go about relaying this information and communicating with the UI for the timer events while still allowing the audio to be prioritized?
-
@Blake-Manternach said in Timer controlling both UI and Audio threads:
However, I do want my timer to also control the UI in my sequencer for example by lighting up each step number in the sequencer....what is best practice and how do I go about relaying this information and communicating with the UI for the timer events while still allowing the audio to be prioritized?
You'll use a real-time script with the Synth timer callback - timer objects are not real time.
In the UI script you have a separate timer (either synth or timer object) doing all the stuff you need to represent the sequencer's playback to the user. You don't need to do anything to have it in sync with the other script, because it never will be in sync, but we're talking a tiny amount of difference so there will be no practical issue.
You will probably have knobs and buttons on the UI that controls the various settings of the sequencer, you can connect these to your sequencer module using the standard processor/parameter ID properties in the interface designer or using setAttribute - just like you would for the built in modules.
-
@d-healey
Fantastic, thanks for the help - your video on building an entry level sequencer was my introductory point for this, you're the man.