diff --git a/ViewModels/MainViewModel.cs b/ViewModels/MainViewModel.cs index 51f50d2..c793651 100644 --- a/ViewModels/MainViewModel.cs +++ b/ViewModels/MainViewModel.cs @@ -11,6 +11,7 @@ using System.Windows.Media; using System.Windows.Media.Imaging; using System.Windows.Threading; using Microsoft.Win32; +using NAudio.CoreAudioApi; using ytLive.Helpers; using ytLive.Models; using ytLive.Services; @@ -612,6 +613,17 @@ public class MainViewModel : ViewModelBase _musicPlayer.LocalGain = GameMuted ? 0f : (float)(GameAudioVolume * 0.2); } + private static void PushSystemVolume(double volume) + { + try + { + using var enumerator = new MMDeviceEnumerator(); + using var device = enumerator.GetDefaultAudioEndpoint(DataFlow.Render, Role.Multimedia); + device.AudioEndpointVolume.MasterVolumeLevelScalar = (float)volume; + } + catch { } + } + /// Live desktop/game input level (0..1), fed by the mixer's loopback /// capture. Read by the game meter, scaled by GameAudioVolume. public double GameAudioLevel @@ -702,6 +714,7 @@ public class MainViewModel : ViewModelBase OnPropertyChanged(nameof(GameMeterFillWidth)); OnPropertyChanged(nameof(GameMeterBrush)); UpdateTraxLocalGain(); + PushSystemVolume(clamped); } } }