Standalone Plugin Manual Audio Device Setup

Hi everyone,

I am developing a standalone-application which needs to automatically select and initialize its audio device without using the GUI. I’ve spent some hours now trying to set up my audio device in my Plugin-Standalone application “manually” (meaning, defining how it’s set up instead of letting JUCE do the work).

However, I did not find any clean way to do so in my AudioPluginAudioProcessor-constructor or any of its methods, nor anywhere else. It seems like I can not directly access the audio device setup from my AudioPluginAudioProcessor.

So, my question is:
is there any proper & clean way to set up my audio device manually each time my standalone plugin gets started?

I’ve found a solution, which is more of a dirty hack unfortunately. I’ll post it here anyways, in case someone else has the same issue - however, I do not recommend it due to obvious reasons.

  • Open juce_StandaloneFilterWindow.h and go to the constructur of the StandalonePluginHolder-class
  • Comment these two lines
if (preferredSetupOptions != nullptr)
    options.reset (new AudioDeviceManager::AudioDeviceSetup (*preferredSetupOptions))
  • Add a custom audio device setup, e.g.
        AudioDeviceManager::AudioDeviceSetup newSetup = {"Steinberg UR22, USB Audio; Direct sample mixing device",
                                                         "Steinberg UR22, USB Audio; Direct hardware device without any conversions",
                                                         48000,
                                                         64,
                                                         2,
                                                         true,
                                                         2,
                                                         true};
        options.reset(new AudioDeviceManager::AudioDeviceSetup(newSetup));
  • Next you must avoid that the app loads a saved state after its first launch.
    • After the first launch, the app does not initialize a new setup anymore, but loads the last saved state instead and initializes the audio device with it
    • To omit that, the function reloadAudioDeviceState() must be changed
  • In reloadAudioDeviceState() set savedState to a nullptr
  • Then again initialize a new setup like shown above, excluding the options.reset() command
  • Then change the deviceManager.initialise()-call to:
        deviceManager.initialise(enableAudioInput ? totalInChannels : 0,
                                 totalOutChannels,
                                 savedState.get(),
                                 true,
                                 preferredDefaultDeviceName,
                                 new AudioDeviceManager::AudioDeviceSetup(newSetup));

As you can see, the option above changes a JUCE-header file, which is definitely something I do not intend to do.

Any help appreciated, thanks!

Cheers,
Lukas

I am also having the same issue. This is seems to be a pretty common problem for anyone who is trying to support a standalone version of their synth / plug-in. It would be really appreciated if the JUCE team can point us to a more official way of doing this.