/// <summary> /// Stop recording /// </summary> public void StopRecording() { if (recording) { recording = false; MmException.Try(WaveInterop.waveInStop(waveInHandle), "waveInStop"); // report the last buffers, sometimes more than one, so taking care to report them in the right order for (int n = 0; n < buffers.Length; n++) { int index = (n + lastReturnedBufferIndex + 1) % buffers.Length; var buffer = buffers[index]; if (buffer.Done) { RaiseDataAvailable(buffer); } } RaiseRecordingStopped(null); } //MmException.Try(WaveInterop.waveInReset(waveInHandle), "waveInReset"); // Don't actually close yet so we get the last buffer }
/// <summary> /// Stop recording /// </summary> public void StopRecording() { recording = false; this.callbackEvent.Set(); // signal the thread to exit MmException.Try(WaveInterop.waveInStop(waveInHandle), "waveInStop"); }