private void CloseWaveInDevice() { // Some drivers need the reset to properly release buffers WaveInterop.waveInReset(waveInHandle); if (buffers != null) { for (int n = 0; n < buffers.Length; n++) { buffers[n].Dispose(); } buffers = null; } WaveInterop.waveInClose(waveInHandle); waveInHandle = IntPtr.Zero; }