title: Failed to setup audio file in apple sample code "AVCaptureToAudioUnit"
body: <p>I am unfamiliar with Objective-C and audioUnit. </p>
  
  <p>I want to make the iOS app which can save the audio signal from the microphone through some audioUnit effects that sound in the device.
  so now I am trying to study apple's sample code "AVCaptureToAudioUnit"</p>
  
  <p><a href="https://developer.apple.com/library/ios/samplecode/AVCaptureToAudioUnit/Introduction/Intro.html" rel="nofollow">https://developer.apple.com/library/ios/samplecode/AVCaptureToAudioUnit/Introduction/Intro.html</a>
  (build with Xcode 6.1 and simulator iphone5.)</p>
  
  <p>but It exposed the error below</p>
  
  <pre><code>AudioStreamBasicDescription: 0 ch,0 Hz,'lpcm' (0x0000000E) 16-bit signed integer
  
  2015-03-17 13:44:56.589 AVCaptureToAudioUnit[1462:151210] Failed to setup audio file! (29759)
  </code></pre>
  
  <p>these logs written in method of CaptureSessionController.mm below</p>
  
  <pre><code>- (void)startRecording
  {
   if (!self.isRecording) {
      OSErr err = kAudioFileUnspecifiedError;
      @synchronized(self) {
          if (!extAudioFile) {
              /*
               Start recording by creating an ExtAudioFile and configuring it with the same sample rate and
               channel layout as those of the current sample buffer.
              */
  
              // recording format is the format of the audio file itself
              CAStreamBasicDescription recordingFormat(currentInputASBD.mSampleRate,
                                                       currentInputASBD.mChannelsPerFrame,
                                                       CAStreamBasicDescription::kPCMFormatInt16,
                                                       true);
              recordingFormat.mFormatFlags |= kAudioFormatFlagIsBigEndian;
  
              NSLog(@"Recording Audio Format:");
              recordingFormat.Print();
  
              err = ExtAudioFileCreateWithURL(_outputFile,
                                              kAudioFileAIFFType,
                                              &amp;recordingFormat,
                                              currentRecordingChannelLayout,
                                              kAudioFileFlags_EraseFile,
                                              &amp;extAudioFile);
              if (noErr == err)
                  // client format is the output format from the delay unit
                  err = ExtAudioFileSetProperty(extAudioFile,
                                                kExtAudioFileProperty_ClientDataFormat,
                                                sizeof(graphOutputASBD),
                                                &amp;graphOutputASBD);
  
              if (noErr != err) {
                  if (extAudioFile) ExtAudioFileDispose(extAudioFile);
                  extAudioFile = NULL;
              }
          }
      } // @synchronized
  
      if (noErr == err) {
          self.recording = YES;
          NSLog(@"Recording Started");
      } else {
          NSLog(@"Failed to setup audio file! (%ld)", (long)err);
      }
  }
  }
  </code></pre>
  
  <p>it seems that the extraction of "currentInputASBD" don't work, but I couldn't find the solution for myself.
  If anyone knows how to fix this issue and share it , I highly appreciate.</p>
  
  <p>best regards.</p>
  
  <p>dubryu</p>