Interaction between AudioDeviceSetup and numInputChannels


#1

AudioDeviceManager::AudioDeviceSetup seems to have all the information you need to initialise an AudioDeviceManager - except that the code doesn't necessarily use it all.

I haven't actually tried it, but from reading the code it seems to me that in AudioDeviceManager::initialise, passing an AudioDeviceSetup and setting everything else to 0 is not enough to correctly initialise the AudioDeviceManager - because it also needs numInputChannelsNeeded and numOutputChannelsNeeded.

The code is here:  https://github.com/julianstorer/JUCE/blob/017dbc988dded4f6984f678c7b7826ac40097b69/modules/juce_audio_devices/audio_io/juce_AudioDeviceManager.cpp#L418.  If you don't set those two values, it ignores the device names in your AudioDeviceSetup, and uses the default device.

This seems to be particularly problematic if you're trying to get the default channels for a device that isn't your default - that ends up happening quite a lot for my project because a lot of the time the input is a cheap, plugged in USB mic with only one channel.

It's not a huge deal - I assume that if no inputs are selected, they want a single input, which is often the case, or they can explicitly ask for two - but it'd be nice to get this working, or alternately, see how to make this work with the API that's there...