请提供一些代码示例,如何将录制的音频数据写入文件(例如,在带有“audio.m4a”文件名的tmp文件夹中)来自此回调方法:
static void MyAudioQueueInputCallback(void *inUserData,
AudioQueueRef inQueue,
AudioQueueBufferRef inBuffer,
const AudioTimeStamp *inStartTime,
UInt32 inNumPackets,
const AudioStreamPacketDescription *inPacketDesc)
{
MyRecorder *recorder = (MyRecorder *)inUserData;
// what to do here ??
}
记录器结构:
typedef struct MyRecorder {
AudioFileID recordFile;
UInt64 recordPacket;
Boolean running;
AudioQueueRef queue;
BOOL mute;
}MyRecorder;
- (void)stopRecording
{
//Save logic
// what to do here ??
}