在Xamarin.ios中的AudioQueue中计算音频缓冲区大小

时间:2016-01-27 06:04:18

标签: ios xamarin xamarin.ios

我需要将麦克风从1(min)秒到15秒(最大)录制音频。录制时间可在1到15秒之间变化。那么我如何计算缓冲区的大小或调整缓冲区大小。我的AudioStreamBasicDescription设置为 -

this.audioStreamDescription.Format = AudioFormatType.LinearPCM;
this.audioStreamDescription.FormatFlags = AudioFormatFlags.LinearPCMIsSignedInteger | AudioFormatFlags.LinearPCMIsPacked;                                                   
this.audioStreamDescription.SampleRate = 8000;
this.audioStreamDescription.BitsPerChannel = 16;
this.audioStreamDescription.ChannelsPerFrame = 1;
this.audioStreamDescription.BytesPerFrame = (16 / 8) * 1;
this.audioStreamDescription.FramesPerPacket = 1;
this.audioStreamDescription.BytesPerPacket = audioStreamDescription.BytesPerFrame * audioStreamDescription.FramesPerPacket;
this.audioStreamDescription.Reserved = 0;

协调缓冲区 -

inputQueue.AllocateBuffer(-----, out bufferPointer);
inputQueue.EnqueueBuffer(bufferPointer, -----, null);

0 个答案:

没有答案