音频队列服务-将音频写入文件(iOS)

音频队列服务-将音频写入文件(iOS),ios,core-audio,audio-recording,Ios,Core Audio,Audio Recording,请给出一些代码示例,说明如何通过此回调方法将录制的音频数据写入文件(例如,在tmp文件夹中,文件名为“audio.m4a”): static void MyAudioQueueInputCallback(void *inUserData, AudioQueueRef inQueue, AudioQueueBufferRef inBuffer,

请给出一些代码示例,说明如何通过此回调方法将录制的音频数据写入文件(例如,在tmp文件夹中,文件名为“audio.m4a”):

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 ??
}