我需要将麦克风从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);