Separating GUI and Audio into different threads?

Hi,

when using AudioAppComponent, the methods paint and getNextAudioBlock are called by the same thread. When my application is painting a lot of stuff, audio has a huge latency. I guess it is possible to separate painting and audio processing into two different threads, Unfortunately I could not find any resources on how this is done with JUCE. Could someone please give me a hint how I can do this?

Thanks a lot.

Unless it’s some platform specific issue, the GUI and audio are already run in different threads…

Maybe some CriticalSection/mutex/MessageManagerLock is attempted to be locked during both your paint and getNextAudioBlock methods? That could make it appear like the execution is happening in one thread.

Hi Xenakios, you are right. I used MidiMessageCollector, which is fully thread safe and does indeed use locking. Thank you for your answer!