I am working on the plugin host example that comes with JUCE and there is a problematic case to which I am trying to find a work around (ideally correct implementation but hack will also do).
Requirements to reproduce the problem:
- Latest master commit of the plugin host (tested on Mac)
- External audio interface to be unplugged to your computer and used as the input device
- Some way to listen to the output of your default audio interface (Built-in Output), i.e. headphones, speakers.
Boot up the plugin host application and route some audio stream through your external input device. Then, patch a channel from the audio input to the output to make sure you can listen to your audio stream. When you unplug your audio interface (used as input device in this example) and plug it back in straight after the audio stream is never restored. However, in the audio settings of the plugin host the audio interface’s name is restored in the ‘Input:’ ComboBox. In order to get some audio out of your output interface, you have to set your input to another audio device and then back to your external audio interface with the audio stream.
How could we automate the process or restoring the audio?
I understand that this is not your common situation that you might want to compensate for but I am wondering whether there is any work around I might be missing. I am currently appointing this problem to the AudioDeviceManager and the fact that the setAudioDeviceSetup is never called once the audio interface is re-plugged.