Example #1
0
        private void WaitForAllBuffers()
        {
            WaveInBuffer Buf = buffers;

            while (Buf.NextBuffer != buffers)
            {
                Buf.WaitFor();
                Buf = Buf.NextBuffer;
            }
        }
Example #2
0
 internal static void WaveInProc(IntPtr hdrvr, int uMsg, int dwUser, ref Windows.WaveHdr wavhdr, int dwParam2)
 {
     if (uMsg == Windows.MM_WIM_DATA)
     {
         try
         {
             GCHandle     h   = (GCHandle)wavhdr.dwUser;
             WaveInBuffer buf = (WaveInBuffer)h.Target;
             buf.OnCompleted();
         }
         catch
         {
         }
     }
 }
Example #3
0
        private void FreeBuffers()
        {
            currentBuffer = null;
            if (buffers != null)
            {
                WaveInBuffer First = buffers;
                buffers = null;

                WaveInBuffer Current = First;
                do
                {
                    WaveInBuffer Next = Current.NextBuffer;
                    Current.Dispose();
                    Current = Next;
                } while (Current != First);
            }
        }
Example #4
0
 private void AllocateBuffers(int bufferSize, int bufferCount)
 {
     FreeBuffers();
     if (bufferCount > 0)
     {
         buffers = new WaveInBuffer(waveInPtr, bufferSize);
         WaveInBuffer Prev = buffers;
         try
         {
             for (int i = 1; i < bufferCount; i++)
             {
                 WaveInBuffer Buf = new WaveInBuffer(waveInPtr, bufferSize);
                 Prev.NextBuffer = Buf;
                 Prev            = Buf;
             }
         }
         finally
         {
             Prev.NextBuffer = buffers;
         }
     }
 }