title: AVAudioEngine Input Node only seeing first device inputs from connected Aggregate Audio Device Swift macOS
body: <p>I am trying to process the individual channels of a multichannel Soundcard, using AVAudioEngine.</p>
  <p>In order to do that, I first discover the DeviceID of the Soundcard I want to connect to my AVAudioEngine. Then I assign the device to the auAudioUnit of the AVAudioEngine Input Node. Finally, I install a tap on the input node, where I can read the buffer.</p>
  <p>I have some code that mostly works, but I have a bug where if I connect an Aggregate Audio Device, my Input Node only sees the input channels of the first audio device within the Aggregate Audio Device.</p>
  <p>For example if my Aggregate Audio Device comprises of two sound cards, one with 6 inputs and the second with two inputs, my Input Node AVAudioFormat would see 6 inputs, not 8.</p>
  <p>I add the device like so:</p>
  <pre><code>try inputNode.auAudioUnit.setDeviceID(deviceID)
  </code></pre>
  <p>Then I get the buffer format like so:</p>
  <pre><code>let input = self.inputNode
      let bus = 0
      bufferFormat = input.inputFormat(forBus: bus)
  </code></pre>
  <p>Finally, I install the tap:</p>
  <pre><code>input.installTap(onBus: bus, bufferSize: 1024, format: bufferFormat) { [weak self] (buffer, time) in     
        self?.process(buffer: buffer, time: time)
     }
  </code></pre>
  <p>With this method, my Input Node auAudioUnit ends up with two input busses and two output busses, the second input bus format seems to have the correct channel count, but I'm not sure why these channels are not passed to the associated input node.</p>
  <p>Any help would be greatly appreciated!</p>
  <p>Thanks,</p>
  <p>Dan</p>