StandaloneFilterWindow loosing output device settings & leak


#1

As far as I know the StandaloneFilterWindow is intended as an example to build up to. Nevertheless I suggest these two small changes/fixes.


1. If the audio device settings get stored via the settings PropertySet, the output device settings can disappear.

- Run it, open the audio settings (AudioDeviceSelectorComponent instance), disable all active output channels, quit.
- Run it and open the audio settings again. The output selection dropdown as well as the 'Active output channels' are gone and can't be recovered.
That's because the initialisation of the AudioDeviceManager uses the information from the settings PropertySet and sets the AudioProcessors numOutputChannels to zero. Which is provided to the constructor of the AudioDeviceSelectorComponent.

To fix this, change

    void showAudioSettingsDialog()
    {
        DialogWindow::LaunchOptions o;
        o.content.setOwned (new AudioDeviceSelectorComponent (deviceManager,
                                                              processor->getTotalNumInputChannels(),
                                                              processor->getTotalNumInputChannels(),
                                                              processor->getTotalNumOutputChannels(),
                                                              processor->getTotalNumOutputChannels(),
                                                              true, false, true, false));
        ...
    }

to something like (I use < JUCE 4.1 at the moment)

    void showAudioSettingsDialog()
    {
        DialogWindow::LaunchOptions o;
        o.content.setOwned (new AudioDeviceSelectorComponent (deviceManager,
                                                              0,
                                                              JucePlugin_MaxNumInputChannels,
                                                              0,
                                                              JucePlugin_MaxNumOutputChannels,
                                                              true, false, true, false));
        ...
    }

 

2. StandaloneFilterWindow AudioSettingsDialog memory leak

as described here
http://www.juce.com/forum/topic/standalonefilterwindow-audiosettingsdialog-memory-leak

A fix has been provided by turntable as well:
http://www.juce.com/comment/303019#comment-303019