private void CbEnabled_CheckedChanged(object sender, EventArgs e) { if (cbEnabled.Checked) { audioMonitor?.Start(); } else { audioMonitor?.Stop(); } }
private void StartNewMonitor(string processName) { initialized = false; tbProcessName.Text = processName; audioMonitor.Stop(); audioMonitor = new AudioLevelMonitor(processName); audioMonitor.RestoreDelay = Convert.ToInt32(updownRestoreDelay.Value); audioMonitor.Intervalms = Convert.ToInt32(updownSamplingDelay.Value); tbMasterVolume.Value = Convert.ToInt32(audioMonitor.MasterVolume * 100); initialized = true; //Set up the actual volume and have it propogate tbMonitorVolume_ValueChanged(null, null); tbDuckingVolume_ValueChanged(null, null); audioLevelsControl.AudioMonitor = audioMonitor; }
public MainForm() { InitializeComponent(); audioMonitor = new AudioLevelMonitor(""); updownSamplingDelay.ValueChanged += UpdownSamplingDelay_ValueChanged; updownRestoreDelay.ValueChanged += UpdownRestoreDelay_ValueChanged; tbMonitorVolume.ValueChanged += tbMonitorVolume_ValueChanged; tbDuckingVolume.ValueChanged += tbDuckingVolume_ValueChanged; this.DragDrop += MainForm_DragDrop; this.DragEnter += MainForm_DragEnter; tbMasterVolume.ValueChanged += tbMasterVolume_ValueChanged; this.FormClosing += (o, e) => audioMonitor?.Stop(); this.Text = $"Windows Volume Limiter v{version}"; initialized = true; //Set up the actual volume and have it propogate tbMonitorVolume_ValueChanged(null, null); }