reusing a buffer to avoid buffer overrun
Hello,
VS 2008
I am filling the buffer with the read method in the code below, using SlimDX to capture the audio input from the microphone.
The problem I have is that the buffer will overrun. It there anyway to create a circuler buffer that once it gets to the the end it will start over again?
Many thanks for any suggestions,
Code:
private void bgwAudioInput_DoWork(object sender, DoWorkEventArgs e)
{
Int16[] samples = new Int16[8192 / sizeof(Int16)];
Int16 audioValue = 0;
int i = 0;
captureBuff.Start(true);
while (captureAudio)
{
if (!this.bgwAudioInput.CancellationPending)
{
captureBuff.Read(samples, 0, true);
audioValue = Math.Abs(samples[i++]);
this.bgwAudioInput.ReportProgress(audioValue);
}
}
}