public void Dispose() { if (m_Thread != null) { try { m_Finished = true; if (m_WaveIn != IntPtr.Zero) { WaveNative.waveInReset(m_WaveIn); } WaitForAllBuffers(); m_Thread.Join(); m_DoneProc = null; FreeBuffers(); if (m_WaveIn != IntPtr.Zero) { WaveNative.waveInClose(m_WaveIn); } } finally { m_Thread = null; m_WaveIn = IntPtr.Zero; } } GC.SuppressFinalize(this); }
public void Close() { m_Finished = true; WaveInRecorder.ThrowOnError(WaveNative.waveInReset(m_WaveIn)); m_Thread.Join(); m_Thread = null; m_DoneProc = null; buffer1.WaitFor(); buffer2.WaitFor(); buffer1.Close(); buffer2.Close(); WaveInRecorder.ThrowOnError(WaveNative.waveInClose(m_WaveIn)); m_WaveIn = IntPtr.Zero; }