public void StopRecording() { if (SoundCardRecorder == null) { throw new Exception(""); //TODO needs mutexes prolly } SoundCardRecorder.Stop(); SoundCardRecorder.Dispose(); SoundCardRecorder = null; }
public void StartRecording(MMDevice device) { if (device == null) { throw new Exception(""); } if (SoundCardRecorder != null) { throw new Exception(""); //TODO needs mutexes prolly } SoundCardRecorder = new SoundCardRecorder(device); SoundCardRecorder.Start(); }
public ToolsAudioGrab() { DeviceEnumerator = new NAudio.CoreAudioApi.MMDeviceEnumerator(); var devices = DeviceEnumerator.EnumerateAudioEndPoints(DataFlow.Capture, DeviceState.Active).ToList(); // instantiate the sound recorder once in an attempt to reduce lag the first time used try { SoundCardRecorder = new SoundCardRecorder((MMDevice)devices[0]); SoundCardRecorder.Dispose(); SoundCardRecorder = null; } catch (Exception) { } }