"no channels" error on Linux when the selected soundcard is busy


#1

Hi,

If the current soundcard is used by another application (jack for example) and I try to open it in JuceDemo, I get a cryptic error message that says “no channels” . In previous JUCE versions it used to display a much more meanningful error "The device \"" << deviceID << "\" is busy (another application is using it)." .

This is because the line

outputChannelBuffer.setSize (jmax ((int) minChansOut, outputChannels.getHighestBit()) + 1, bufferSize);

has been replaced by:

maxOutputsRequested = jmax ((int) minChansOut, jmin ((int) maxChansOut, maxOutputsRequested));
outputChannelBuffer.setSize (maxOutputsRequested, bufferSize); 

Since the soundcard is busy, its maxChansOut is set to 0, and then instead of attempting to open it , juce reports “no channels”

I’m not sure of the best fix for that (except by reverting the change) , but it would be nice to get the original error message.

The original git commit is here: