Is there only one audio thread?




I’m just getting started with Juce. I was wondering if I can assume that there is only one audio thread in a stand alone application. I want to overload voice methods to remember the actual voice index that is used for a newly started sound so that I can apply voice specific volume changes in renderNextBlock(). As noteOn does not return e.g. the index of the voice that has been started I want to overload voice->startNote to save the index which I can then use where I did the noteOn (done in the audio thread, of course). With multiple audio threads (which I cannot imagine right now) this would have to be a ThreadLocal variable, right?

I’m still learning so forgive me if I miss some basic concepts. I come from Java and there is much more one has to think about in C++ (although this problem would be the same in Java demanding a ThreadLocal or not).



Yes there is only one audio thread in a JUCE standalone app.