The tutorials aren’t clear on this topic so I’ll ask this here:
I want to have a list of available audio input/output channels for the connected audio devices. Those will be shown in my application’s configuration screen. For example Ableton Live seems to handle this so that it first lists all the audio devices. Then you choose one of them. After that you have access to that devices input/output channel list from which you enable/disable the ones you want.
The above would work fine for me, but I can’t figure out what’s the proper way of querying the amount of channels for the selected device. Do I need to call AudioAppComponent::setAudioChannels (100, 100) with huge numbers as channel counts so they always exceed what the hardware will be capable of delivering and then see how many it gave me back using the following code:
auto* device = deviceManager.getCurrentAudioDevice(); auto activeInputChannels = device->getActiveInputChannels(); auto activeOutputChannels = device->getActiveOutputChannels(); auto maxInputChannels = activeInputChannels .getHighestBit() + 1; auto maxOutputChannels = activeOutputChannels.getHighestBit() + 1;
That sounds like a waste of CPU as I would optimally want to activate only those exact audio inputs/outputs the user selects from the applications configuration menu.
Is there a better way to do this?