Hi, I just built a standard synth with a GUI and noticed that while moving asynchronous sliders, changes are made while the audio thread is straight in the “process” method.
To summarize :
- There is (at least) 2 threads, one responsible for the GUI (catching clicks, sliders rolls, menu changes etc…) and the second for the audio processing (rendering all notes, layers etc…)
- Both should be running as independently as possible in the sense that Thread A should never modify a value being currently used by Thread B.
- To solve this problem, as described here http://www.rawmaterialsoftware.com/viewtopic.php?f=8&t=6959&p=39008&hilit=asynchronous#p39008 I could either surround variables with mutex or put the changes messages of Thread A in a queue which one will synchronously be dequeued at the right time in Thread B
I thought that the GUI events were already queued and probably executed right before the audio process to start (and hopefully within this thread) but it seems not.
I know that I’m not the first in this case juce being made quite well to handle such problems: my question is what is the proper way (if there is one) to activate or to force executing the queue message at the proper time ?