2013-08-28 27 views
3

我使用驚人的音頻引擎類AERecorder從內置麥克風錄製音頻。我檢查了下載的示例項目。我還實施了TAAE documentation for using the AERecorder中提供的代碼。驚人的音頻引擎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; 
} 

回答

2

我已經找到了問題,這應該是顯而易見的。我沒有在我的代碼中的任何地方撥打[audioController start:&error]。現在它像一個魅力。希望這可以幫助某人。我不得不說,這是一些非常好的軟件。