Exemplo n.º 1
0
 private void Advance()
 {
     m_CurrentBuffer = m_CurrentBuffer == null ? m_Buffers : m_CurrentBuffer.NextBuffer;
     if (m_CurrentBuffer != null)
     {
         m_CurrentBuffer.WaitFor();
     }
 }
Exemplo n.º 2
0
        private void WaitForAllBuffers()
        {
            WaveOutBuffer Buf = m_Buffers;

            while (m_Buffers != null && Buf.NextBuffer != m_Buffers)
            {
                Buf.WaitFor();
                Buf = Buf.NextBuffer;
            }
        }
Exemplo n.º 3
0
 internal static void WaveOutProc(IntPtr hdrvr, int uMsg, int dwUser, ref WaveOutBase.WaveHdr wavhdr, int dwParam2)
 {
     if (uMsg == WaveOutBase.MM_WOM_DONE)
     {
         try
         {
             GCHandle      h   = (GCHandle)wavhdr.dwUser;
             WaveOutBuffer buf = (WaveOutBuffer)h.Target;
             buf.OnCompleted();
         }
         catch
         {
         }
     }
 }
Exemplo n.º 4
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);
            }
        }
Exemplo n.º 5
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;
         }
     }
 }