private void DirectSoundOutput_PlaybackStopped(object sender, StoppedEventArgs e) { if (PassingThrough) { DirectSoundOutput.Play(); } }
public void Dispose() { try { if (WaveSource != null) { WaveSource.StopRecording(); WaveSource.Dispose(); } if (WaveOutput != null) { WaveOutput.Stop(); WaveOutput.Dispose(); } if (DirectSoundOutput != null) { DirectSoundOutput.Stop(); DirectSoundOutput.Dispose(); } } catch (Exception) { } }
public void StartPassingThrough() { if (DateTime.Now <= LastPauseOrStart.AddMilliseconds(500)) { return; } LastPauseOrStart = DateTime.Now; try { WaveSource.StartRecording(); if (WaveOutput != null) { WaveOutput.Play(); } if (DirectSoundOutput != null) { DirectSoundOutput.Play(); } PassingThrough = true; } catch (Exception) { } }