Output device not shown in Audio Settings window?


#1

I compiled my standalone plugin with the latest tip, and now the output device dropdown isn’t shown in the Audio Settings window any more. Only the selector for audio device type, which lets me choose ALSA and JACK, and the midi input checkboxes are there. I don’t hear any audio output.

I checked out some earlier Juce versions, the commit that introduced the change seems to be this one:

1bc7a27676bcca22c62c585f887abe10f0501435
"Cleaned up AudioFilterStreamer to remove duplicate code and use AudioProcessorPlayer for its playout. Jucer update to compile .c files on linux."


#2

That change made it allow the plugin to use as many channels as are available in the audio device. How many channels does your plugin support?


#3

Two channels (1 stereo output pair, no inputs). In JucePluginCharacteristics.h I have set
#define JucePlugin_MaxNumInputChannels 0
#define JucePlugin_MaxNumOutputChannels 2

Could it be a problem with detecting the number of device channels available under Linux?


#4

I think what you’re seeing is that the soundcard provides the same number of channels as the plugin needs, so the device selector doesn’t bother showing an option to change them. Does that sound feasible?


#5

Sounds feasible, but there is no audio output…
Previously, there was a dropdown list to choose output devices, a “Test” button, a sample rate and buffer size selector. These are now gone, and there’s no output. :frowning:


#6

Well, the combo boxes only appear if there are actually any choices available. If there’s just one device that can do what you ask for, that’s the one it’ll select. If it seems wrong, have a look at the numbers that are going to the AudioDeviceSelectorComponent constructor and see if they make sense. Or have a look inside the selector component itself and follow the logic it uses for creating its controls - that might help see what’s happening.


#7

I have 2 logical devices which were shown in the listbox before that commit. They can both use different sampling rates and buffer sizes, which were shown previously, too… If a default device were chosen, I would hear something, but I don’t. The audio callback doesn’t seem to be called at all. So obviously something is wrong.

I can’t seem to get the audio plugin demo to build as a standalone app, so it might be something I’m doing in my plugin code, but it worked fine before that commit, I double-checked.

I’ll have a look at the logic later.


#8

Okay, I know a bit more now…
In StandaloneFilterWindow::showAudioSettingsDialog(), filter->getNumOutputChannels() is called to get the number of channels. getNumOutputChannels() returns numOutputChannels, which is private, and never set, so it’s always zero. The only place where it’s set is AudioProcessor::setPlayConfigDetails(). So I’m now doing this in my constructor, using some values for sampling rate and buffer size which seem reasonable:

AudioProcessor::setPlayConfigDetails(JucePlugin_MaxNumInputChannels, JucePlugin_MaxNumOutputChannels, 48000, 512);
That seems to work, the devices, sampling rate, and buffer size show up in the config window again and can be selected, and sound output works again. But setPlayConfigDetails is marked as “Not for public use - this is called to initialise the processor before playing”, so I guess this is not the way this should be done?


#9

That’s odd - I can’t see how StandaloneFilterWindow::showAudioSettingsDialog() could get called before the filter has been loaded and made ready…

But I guess the standalone code should be a bit more robust. Maybe this:

[code]void StandaloneFilterWindow::showAudioSettingsDialog()
{
const int numIns = filter->getNumInputChannels() <= 0 ? JucePlugin_MaxNumInputChannels : filter->getNumInputChannels();
const int numOuts = filter->getNumOutputChannels() <= 0 ? JucePlugin_MaxNumOutputChannels : filter->getNumOutputChannels();

AudioDeviceSelectorComponent selectorComp (*deviceManager,
                                           numIns, numIns, numOuts, numOuts,
                                           true, false, true, false);

[/code]


#10

As far as I can tell, the filter is correctly loaded and made ready, it’s just that num[In|Out]putChannels is never set. It’s always zero. Is that something I have to set explicitely? Where/how?

If I insert your code, I see the audio devices, but if I select one, it immediately switches back to << none >>. Probably because it still thinks the filter has zero output channels.


#11

Ok, I see. Well, there’s nothing wrong with setting up some default values for the filter when it’s first created. Try this, StandAloneFilterWindow, line 55:

[code] filter = createPluginFilter();

    if (filter != 0)
    {
        filter->setPlayConfigDetails (JucePlugin_MaxNumInputChannels, 
                                      JucePlugin_MaxNumOutputChannels,
                                      44100, 512);

[/code]


#12

This one works fine for me. Would be nice if you include this in git.
Edit: Oh, it’s already there. Thx.