private void Advance() { currentBuffer = currentBuffer == null ? buffers : currentBuffer.NextBuffer; currentBuffer.WaitFor(); }
private void AllocateBuffers(int bufferSize, int bufferCount) { FreeBuffers(); if (bufferCount > 0) { buffers = new WaveOutBuffer(waveOut, bufferSize); var Prev = buffers; try { for (var i = 1; i < bufferCount; i++) { var buffer = new WaveOutBuffer(waveOut, bufferSize); Prev.NextBuffer = buffer; Prev = buffer; } } finally { Prev.NextBuffer = buffers; } } }
private void FreeBuffers() { currentBuffer = null; if (buffers != null) { var First = buffers; buffers = null; var Current = First; do { var Next = Current.NextBuffer; Current.Dispose(); Current = Next; } while (Current != First); } }