/// <summary> /// Prepares a Wave input device for recording /// </summary> public WaveIn(WaveCallbackInfo callbackInfo) { DeviceNumber = 0; WaveFormat = new WaveFormat(8000, 16, 1); BufferMilliseconds = 100; NumberOfBuffers = 3; callback = Callback; this.callbackInfo = callbackInfo; callbackInfo.Connect(callback); }
/// <summary> /// Opens a WaveOut device /// </summary> public WaveOut(WaveCallbackInfo callbackInfo) { // set default values up DeviceNumber = 0; DesiredLatency = 300; NumberOfBuffers = 3; callback = Callback; waveOutLock = new object(); this.callbackInfo = callbackInfo; callbackInfo.Connect(callback); }
/// <summary> /// Dispose pattern /// </summary> protected virtual void Dispose(bool disposing) { if (disposing) { if (recording) StopRecording(); CloseWaveInDevice(); if (callbackInfo != null) { callbackInfo.Disconnect(); callbackInfo = null; } } }