【问题标题】:The Amazing Audio Engine AERecorder not recording惊人的音频引擎 AERecorder 没有录音
【发布时间】:2013-08-28 19:43:26
【问题描述】:

我正在使用 The Amazing Audio Engine 类 AERecorder 来录制来自内置麦克风的音频。我已经检查了下载附带的示例项目。我还实现了 TAAE documentation for using the AERecorder 中提供的代码。

据我所知,我拥有录制音频所需的一切。唉,文件已创建,标题在那里,但没有音频数据。我所能想到的只是 AEAudioController 或我的 Xcode 项目中的某些设置有问题。

作为参考,我的项目正在使用 ARC,我相信我已按照文档中的说明将 -fno-objc-arc 编译器标志添加到任何导入的源。

有没有其他人遇到过这个问题,如果有,是如何解决的?

我本来想在 TAAE 论坛上问这个问题,但我无法注册。

这里是任何不愿意点击链接的人的代码。

编辑:下面的代码已更新以显示以前缺少的细节。

- (void)viewDidLoad
{
   [super viewDidLoad]
   self.audioController = [[AEAudioController alloc] 
                       initWithAudioDescription:[AEAudioController nonInterleavedFloatStereoAudioDescription] 
                                   inputEnabled:YES];
   //************************
   // This is the crucial bit of code that was missing
   NSError *error;
   [audioController start:&error];
   //************************
}

- (void)beginRecording {
   // Init recorder
   self.recorder = [[AERecorder alloc] initWithAudioController:_audioController];
   NSString *documentsFolder = [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) 
                               objectAtIndex:0];
   NSString *filePath = [documentsFolder stringByAppendingPathComponent:@"Recording.aiff"];
   // Start the recording process
   NSError *error = NULL;
   if ( ![_recorder beginRecordingToFileAtPath:filePath 
                                     fileType:kAudioFileAIFFType 
                                        error:&error] ) {
      // Report error
      return;
   }
   // Receive both audio input and audio output. Note that if you're using
   // AEPlaythroughChannel, mentioned above, you may not need to receive the input again.
   [_audioController addInputReceiver:_recorder];
   [_audioController addOutputReceiver:_recorder];
}
-(void)stopRecording
{
    [_recorder finishRecording];
    [_audioController removeInputReceiver:_recorder];
    [_audioController removeOutputReceiver:_recorder];
    self.recorder = nil;
}

【问题讨论】:

    标签: iphone ios objective-c audio ios6.0


    【解决方案1】:

    我已经发现了问题,这应该是显而易见的。我没有在我的代码中的任何地方调用[audioController start:&error]。现在它就像一个魅力。希望这可以帮助某人。不得不说,这是一款非常不错的软件。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-08-08
      • 1970-01-01
      相关资源
      最近更新 更多