Hello,
is there any way to select which input channels shall be mapped to the output with a AVAudioMixerNode?
I have a inputNode with 4 channels and want to use 2 specific channel from it within my processing chain.
To get an idea it looks like this:
...
var mixer = AVAudioMixerNode()
var inputFormat = audioEngine.inputNode.inputFormat(forBus: 0) // This one has 4 channels
var outputFormat = AVAudioFormat(commonFormat: inputFormat.commonFormat, sampleRate: inputFormat.sampleRate,
channels: 2, interleaved: inputFormat.isInterleaved)!
audioEngine.attach(mixer)
audioEngine.attach(someOtherNode)
audioEngine.connect(inputNode, mixer, inputFormat)
audioEngine.connect(mixer, someOtherNode, outputFormat)
...
Basically this works as expected but I have no choice about the channel mapping from input to output.
The mixer automatically maps channel 0 and 1 from the four input channels to the two output channels.
How I can I tell the mixer that it should map channel 2 and 3 to the output channels?
I tried to set mixer.auAudioUnit.channelMap to [2, 3] but it did not affect anything.
mixer.auAudioUnit.channelMap is always nil.
Any help would be very appreciated. Thank you!
Daniel