Amazing Audio Engine 클래스 AERecorder를 사용하여 내장 마이크에서 오디오를 녹음하고 있습니다. 다운로드와 함께 제공되는 샘플 프로젝트를 검사했습니다. 또한 TAAE documentation for using the AERecorder에 제시된 코드를 구현했습니다.Amazing Audio Engine 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;
}