internal static void WaveOutProc(IntPtr hdrvr, int uMsg, int dwUser, ref Win32.WAVEHDR wavhdr, int dwParam2) { if (uMsg == (int)Win32.Enum_MM_MessageOutput.MM_WOM_DONE) { try { WaveOutBuffer loBuffer = (WaveOutBuffer)(((GCHandle)wavhdr.ClientInfo).Target); loBuffer.OnDataSent(); } catch { } } }
private void ClearBuffer() { if (m_Buffer != null) { WaveOutBuffer loCurrentBuffer = m_Buffer.NextBuffer; do { WaveOutBuffer loNextBuffer = loCurrentBuffer.NextBuffer; loCurrentBuffer.Dispose(); loCurrentBuffer = loNextBuffer; } while (loCurrentBuffer != m_Buffer); m_Buffer.Dispose(); m_Buffer = null; } }
private void CreateBuffer(int liBufferSize) { ClearBuffer(); m_Buffer = new WaveOutBuffer(m_DeviceHandle, liBufferSize); WaveOutBuffer loPreviousBuffer = m_Buffer; try { for (int i = 1; i < 3; i++) { WaveOutBuffer loLocalBuffer = new WaveOutBuffer(m_DeviceHandle, liBufferSize); loPreviousBuffer.NextBuffer = loLocalBuffer; loPreviousBuffer = loLocalBuffer; } } finally { loPreviousBuffer.NextBuffer = m_Buffer; } m_CurrentBuffer = m_Buffer; }
private void SwitchBuffer() { m_CurrentBuffer = m_CurrentBuffer.NextBuffer; }