/// <summary> /// Closes the WaveOut device and disposes of buffers /// </summary> /// <param name="disposing">True if called from <see>Dispose</see></param> protected void Dispose(bool disposing) { Stop(); if (disposing) { if (buffers != null) { for (int n = 0; n < buffers.Length; n++) { if (buffers[n] != null) { buffers[n].Dispose(); } } buffers = null; } } lock (waveOutLock) { WaveInterop.waveOutClose(hWaveOut); } if (disposing) { callbackInfo.Disconnect(); } }
/// <summary> /// Dispose pattern /// </summary> protected virtual void Dispose(bool disposing) { if (disposing) { if (recording) { StopRecording(); } CloseWaveInDevice(); if (callbackInfo != null) { callbackInfo.Disconnect(); callbackInfo = null; } } }