private void DuckOtherAppsVolumes() { if (soundRunning) { return; } soundRunning = true; if (duckingApps.Count == 0) { return; } foreach (var process in Process.GetProcesses()) { if (duckingApps.ContainsKey(process.ProcessName) /*&& !String.IsNullOrEmpty(process.MainWindowTitle)*/) { Nullable <Single> currentVolume = VolumeMixer.GetApplicationVolume(process.Id); if (currentVolume != null) { duckingApps[process.ProcessName] = currentVolume; } VolumeMixer.SetApplicationVolume(process.Id, Convert.ToSingle(duckVolume)); } } }
private void RestoreOtherAppsVolumes() { soundRunning = false; if (duckingApps.Count == 0) { return; } foreach (var process in Process.GetProcesses()) { if (duckingApps.ContainsKey(process.ProcessName) /*&& !String.IsNullOrEmpty(process.MainWindowTitle)*/) { VolumeMixer.SetApplicationVolume(process.Id, Convert.ToSingle(duckingApps[process.ProcessName])); } } }