/// <summary> /// Stop recording /// </summary> public void StopRecording() { if (captureState != CaptureState.Stopped) { captureState = CaptureState.Stopping; MmException.Try(WaveInterop.waveInStop(waveInHandle), "waveInStop"); //Reset, triggering the buffers to be returned MmException.Try(WaveInterop.waveInReset(waveInHandle), "waveInReset"); callbackEvent.Set(); // signal the thread to exit } }
private void CloseWaveInDevice() { WaveInterop.waveInReset(this.waveInHandle); if (this.buffers != null) { for (int i = 0; i < this.buffers.Length; i++) { this.buffers[i].Dispose(); } this.buffers = null; } WaveInterop.waveInClose(this.waveInHandle); this.waveInHandle = IntPtr.Zero; }
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; }