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

时间:2013-11-26 12:21:24

标签: ios core-audio audio-recording

请提供一些代码示例,如何将录制的音频数据写入文件(例如,在带有“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 ??
}

0 个答案:

没有答案