예제 #1
0
 private void FreeBufferList()
 {
     _currentBuffer = null;
     if (_bufferList != null)
     {
         var firstBuffer = _bufferList;
         _bufferList = null;
         var buffer = firstBuffer;
         do
         {
             WaveOutBuffer nextBuffer = buffer.NextBuffer;
             buffer.Dispose();
             buffer = nextBuffer;
         } while (buffer != firstBuffer);
     }
 }
예제 #2
0
 private void AllocateBufferList(int bufferSize, int bufferCount)
 {
     FreeBufferList();
     if (bufferCount > 0)
     {
         _bufferList = new WaveOutBuffer(_wave, bufferSize);
         WaveOutBuffer prevBuffer = _bufferList;
         try
         {
             for (int bufferIndex = 1; bufferIndex < bufferCount; bufferIndex++)
             {
                 var buffer = new WaveOutBuffer(_wave, bufferSize);
                 prevBuffer.NextBuffer = buffer;
                 prevBuffer            = buffer;
             }
         }
         finally
         {
             prevBuffer.NextBuffer = _bufferList;
         }
     }
 }
예제 #3
0
 private void Advance()
 {
     _currentBuffer = (_currentBuffer == null ? _bufferList : _currentBuffer.NextBuffer);
     _currentBuffer.WaitFor();
 }