Esempio n. 1
0
        private void WaitForAllBuffers()
        {
            WaveOutBuffer Buf = m_Buffers;

            while (Buf.NextBuffer != m_Buffers)
            {
                Buf.WaitFor();
                Buf = Buf.NextBuffer;
            }
        }
Esempio n. 2
0
 internal static void WaveOutProc(IntPtr hdrvr, int uMsg, int dwUser, ref WaveNative.WaveHdr wavhdr, int dwParam2)
 {
     if (uMsg == WaveNative.MM_WOM_DONE)
     {
         try
         {
             GCHandle      h   = (GCHandle)wavhdr.dwUser;
             WaveOutBuffer buf = (WaveOutBuffer)h.Target;
             buf.OnCompleted();
         }
         catch
         {
         }
     }
 }
Esempio n. 3
0
        private void FreeBuffers()
        {
            m_CurrentBuffer = null;
            if (m_Buffers != null)
            {
                WaveOutBuffer First = m_Buffers;
                m_Buffers = null;

                WaveOutBuffer Current = First;
                do
                {
                    WaveOutBuffer Next = Current.NextBuffer;
                    Current.Dispose();
                    Current = Next;
                } while(Current != First);
            }
        }
Esempio n. 4
0
 private void AllocateBuffers(int bufferSize, int bufferCount)
 {
     FreeBuffers();
     if (bufferCount > 0)
     {
         m_Buffers = new WaveOutBuffer(m_WaveOut, bufferSize);
         WaveOutBuffer Prev = m_Buffers;
         try
         {
             for (int i = 1; i < bufferCount; i++)
             {
                 WaveOutBuffer Buf = new WaveOutBuffer(m_WaveOut, bufferSize);
                 Prev.NextBuffer = Buf;
                 Prev            = Buf;
             }
         }
         finally
         {
             Prev.NextBuffer = m_Buffers;
         }
     }
 }
Esempio n. 5
0
 private void Advance()
 {
     m_CurrentBuffer = m_CurrentBuffer == null ? m_Buffers : m_CurrentBuffer.NextBuffer;
     m_CurrentBuffer.WaitFor();
 }