CMSampleBufferRef ref=[output copyNextSampleBuffer];
NSLog(@"%@",ref);
if(ref==NULL)
break;
//复制数据到文件
//读取下一个
AudioBufferList audioBufferList;
NSMutableData *data=[[NSMutableData alloc] init];
CMBlockBufferRef blockBuffer;
CMSampleBufferGetAudioBufferListWithRetainedBlockBuffer(ref, NULL, &audioBufferList, sizeof(audioBufferList), NULL, NULL, 0, &blockBuffer);
NSLog(@"%@",blockBuffer); for( int y=0; y<audioBufferList.mNumberBuffers; y++ )
{
AudioBuffer audioBuffer = audioBufferList.mBuffers[y];
Float32 *frame = (Float32*)audioBuffer.mData; [data appendBytes:frame length:audioBuffer.mDataByteSize]; } CFRelease(blockBuffer);
CFRelease(ref);
ref=NULL;
blockBuffer=NULL;
[data release];