I have an app that opens an audio device and plays music beautifully (thanks for the help so far!). My problem has to do with a crash on shutdown.
I call the following code in my application shutdown:
gDeviceManager->removeAudioCallback( this ); gDeviceManager->closeAudioDevice(); delete gDeviceManager;
Unfortunately the app crashes, because despite these calls, the audio thread is still working within audioDeviceIOCallbackInt() in Juce. In other words, none of the above functions (removeAudioCallback() or closeAudioDevice()) wait for the callbacks to end or the device to close before returning.
Is there a proper method to shut down the AudioDeviceManager the will guarantee that processing is completed? I’m sure I could put a Sleep() in to prevent crashes, but that’s really more of a band-aid.