这是与iPhone相关的问题: 我使用openAL播放一些声音(我必须管理增益,音高等)。 我想记录我正在播放的内容并使用AVAudioRecorder但是当我“prepareToRecord”时,openAL停止播放音频。 有什么问题? 这是我使用的IBAction记录:
- (IBAction) record: (id) sender
{
NSError *error;
NSMutableDictionary *settings = [NSMutableDictionary dictionary];
[settings setValue: [NSNumber numberWithInt:kAudioFormatLinearPCM] forKey:AVFormatIDKey];
[settings setValue: [NSNumber numberWithFloat:8000.0] forKey:AVSampleRateKey];
[settings setValue: [NSNumber numberWithInt: 1] forKey:AVNumberOfChannelsKey];
[settings setValue: [NSNumber numberWithInt:16] forKey:AVLinearPCMBitDepthKey];
[settings setValue: [NSNumber numberWithBool:NO] forKey:AVLinearPCMIsBigEndianKey];
[settings setValue: [NSNumber numberWithBool:NO] forKey:AVLinearPCMIsFloatKey];
NSURL *url = [NSURL fileURLWithPath:FILEPATH];
self.recorder = [[AVAudioRecorder alloc] initWithURL:url settings:settings error:&error];
self.recorder.delegate = self;
self.recorder.meteringEnabled = YES;
[self.recorder prepareToRecord];
[self.recorder record];
}
由于
编辑:
我也试过了AudioQueue录音。 此代码后,此时间停止响起:
status = AudioQueueEnqueueBuffer(recordState.queue, recordState.buffers[i], 0, NULL);
因此可以记录iPhone何时播放openAL ???
再次感谢
答案 0 :(得分:0)
FILEPATH与播放另一个文件的路径相同......?
如果从同一个地方调用record
和prepareToRecord
...实际上您无需致电prepareToRecord
...... record
将完成工作......
见