AudioDeviceManager questions


#1

In AudioDeviceManager::initialise(), it takes “numInputChannelsNeeded” and “numOutputChannelsNeeded” and other parameters. If an app requires up to 4 input channels,will it be OK to use 4 here?

In the same app, the actual number of active input channels might be less than 4, assuming it is 3. In AudioIODeviceCallback::audioDeviceIOCallback (const float **inputChannelData, int numInputChannels, float **outputChannelData, int numOutputChannels, int numSamples)
What will the value of “numInputChannels” be? 3 or 4? Or it is determined by the value of “inputChannels” in struct AudioDeviceManager::AudioDeviceSetup?

Assuming there are 3 input channels, is it possible to distinguish each input channel by something like channel name? If so, how to do it? If the answer is no, is there a way to identify different input channels?

Thanks,
Alex


#2

Found that in class AudioProcessor, there is a method of “getInputChannelName()” based on the channel index, and a similar method for output channels. I guess this is what I am looking for, so it requires to hook up an AudioProcessor to the chain to do the processing?

Is there a good example of how to use class AudioProcessor?

Thanks,
Alex


#3

The AudioProcessor and AudioDeviceManager are not directly related like that. For initialization of the device manager you can just put in a large number like 256 for each. I haven’t followed the code in super detail but the actual number of channels used will be based on your device configuration. Maybe someone with more precise information can reply to that. I think it just sets an upper limit. If you want to find out how to access information from your device you can have a look at AudioDeviceSelectorComponent and see how it retrieves the information. I can’t recall directly how it works but it involves AudioIODevice which can be retrieved from the AudioDeviceManager using getCurrentAudioDevice, or something like that. The unrelated channel name functions on AudioProcessor relate to plugins like VST, AudioUnit or your own custom plugins. You can check out the AudioProcessorGraph in Plugin Host Demo to find more information on those.