title: No available audioEngine input channels when running on hardware
body: <p>I'm trying to setup a tap on my audioEngine's <code>inputNode</code> for Speech Recognition. The following code works fine in the simulator, but not when I run it on my <code>iPhone X</code> running iOS 13.1.2.</p>
  
  <p>Here is the relevant code:</p>
  
  <pre class="lang-swift prettyprint-override"><code>if (audioEngine == nil || (!audioEngine!.isRunning)) {
      print("Setting up audioEngine")
      if audioEngine == nil {
          audioEngine = AVAudioEngine.init()
      }
  
      if(audioEngine!.inputNode.inputFormat(forBus: 0).channelCount == 0){
          print("Not enough available inputs!")
      }
  
      let recognitionFormat = audioEngine!.inputNode.inputFormat(forBus: 0)
      audioEngine!.inputNode.installTap(onBus: 0, bufferSize: 1024, format: recognitionFormat) {
          (buffer: AVAudioPCMBuffer, when: AVAudioTime) in
          self.recognitionRequest?.append(buffer)
      }
      audioEngine?.prepare()
      try audioEngine?.start()
  }
  </code></pre>
  
  <p>I got no errors running in the simulator and Speech Recognition works fine. However, I got the following when running on my code:</p>
  
  <pre><code>
  Setting up audioEngine
  [aurioc] AURemoteIO.cpp:1086:Initialize: failed: -10851 (enable 1, outf&lt; 2 ch,      0 Hz, Float32, non-inter&gt; inf&lt; 2 ch,      0 Hz, Float32, non-inter&gt;)
  [aurioc] AURemoteIO.cpp:1086:Initialize: failed: -10851 (enable 1, outf&lt; 2 ch,      0 Hz, Float32, non-inter&gt; inf&lt; 2 ch,      0 Hz, Float32, non-inter&gt;)
  Not enough available inputs!
  </code></pre>
  
  <p>If I don't return after <code>channelCount == 0</code>, the app will crash with:</p>
  
  <pre><code>[avae]            AVAEInternal.h:76    required condition is false: [AVAEGraphNode.mm:823:CreateRecordingTap: (IsFormatSampleRateAndChannelCountValid(format))]
  *** Terminating app due to uncaught exception 'com.apple.coreaudio.avfaudio', reason: 'required condition is false: IsFormatSampleRateAndChannelCountValid(format)'
  </code></pre>
  
  <p>My Audio Session is setup like this:</p>
  
  <pre><code>try audioSession.setCategory(.playAndRecord, options: [.defaultToSpeaker])
  try audioSession.setActive(true)
  </code></pre>
  
  <p>And a check of the available inputs yields:</p>
  
  <pre><code>LIST OF INPUTS: [&lt;AVAudioSessionPortDescription: 0x280eac6b0, type = MicrophoneBuiltIn; name = iPhone Microphone; UID = Built-In Microphone; selectedDataSource = Bottom&gt;]
  </code></pre>
  
  <p>I'm stumped. Any help?</p>