Threads design for integration of AudioDeviceIO

Hi to all,

I’m trying to integrate the audio_devices module in an application to interact with one or more audio interfaces.
My application doesn’t use the message bus or the gui part of juce so initially I was thinking of running the juce part in the main audio thread of my application, but I’ve discovered that I need to have the MessageManager loop running in the thread where I instance the DeviceManager and the AudioDeviceIO.
So I’ve started moving that part on his own thread dedicated to juce, and tried using the callAsync on the MessageManager to call the functions on the devices manager, but I’ve some cases where I cannot call those functions asynchronously and I’m not convinced this is the right way to interact.
For the audio part I’m using a circular buffer to communicate between the AudioDeviceIO and the rest of my software, so I manly need to interact with the device manager to setup and open/close the device.

Can I ask what’s the best way to design that part of application in term of threads and interaction between them?

Thanks
Cheers
Daniele