AudioQueue语音流 speex压缩 实时通讯 对讲机

时间:2022-12-24 16:08:59

参开 http://blog.csdn.net/liulina603/article/details/19029727    博客有多篇文章

http://blog.csdn.net/liulina603/article/details/19029163

http://msching.github.io/blog/2014/07/07/audio-in-ios/   (语音的介绍 共5章   详细)

http://www.cnblogs.com/xuanyuanchen/archive/2012/03/30/xuanyaunchen.html

http://blog.sina.com.cn/s/blog_59aee7ed010142ih.html

http://billchan.me/

AudioQueue几个重要参数

    AudioQueueRef                   inputQueue;//队列
AudioQueueBufferRef inputBuffers[3];//缓冲区 可以定义宏容易修改,一般为3个,设置多个可以让语音播放不卡
AudioStreamBasicDescription audioDescription;//音频采集参数设置
    ///设置音频参数
audioDescription.mSampleRate = ; //采样率
audioDescription.mFormatID = kAudioFormatLinearPCM;
audioDescription.mFormatFlags = kLinearPCMFormatFlagIsSignedInteger | kAudioFormatFlagIsPacked;
audioDescription.mChannelsPerFrame = ; ///单声道
audioDescription.mFramesPerPacket = ; //每一个packet一侦数据
audioDescription.mBitsPerChannel = ; //每个采样点16bit量化
audioDescription.mBytesPerFrame = (audioDescription.mBitsPerChannel / ) * audioDescription.mChannelsPerFrame;
audioDescription.mBytesPerPacket = audioDescription.mBytesPerFrame; AudioQueueNewOutput(&audioDescription, AudioPlayerAQInputCallback, (__bridge void*)self, nil, nil, , &audioQueue); //使用player的内部线程播放
AudioQueueAllocateBuffer(audioQueue, MIN_SIZE_FRAME, &audioQueueBuffers[i]);//初始化音频缓冲区
AudioQueueStop(audioQueue, true);//停止队列
AudioQueueReset(audioQueue);//重置队列
AudioQueueDispose(_inputQueue, true);//销毁队列