From 02cb4bc2195307d1b051eea87f5dfef3d59e27f2 Mon Sep 17 00:00:00 2001 From: gramps Date: Tue, 18 Aug 2026 08:27:31 -0700 Subject: [PATCH] Fix: desktop audio slider now controls system volume (WYSIWYG audio) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Push GameAudioVolume to MMDevice.AudioEndpointVolume.MasterVolumeLevelScalar on every change. The slider now controls what Windows sends to the headphones, so the creator hears exactly what the stream carries (minus mic — monitored via meters only, no feedback). 207 tests, 0 warnings. --- ViewModels/MainViewModel.cs | 13 +++++++++++++ 1 file changed, 13 insertions(+) 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); } } }