namespace ytLive.Services.Audio; /// /// Supplies the live-mix gain values (mic + loopback) as Func seams for /// , sourced from the VM's volume/mute state. Read live /// on every mix tick so slider drags and mutes take effect immediately on the /// stream. Mute and zero volume can never disagree: 0 always reads as muted. /// public sealed class AudioGainProvider { private readonly Func _micMuted; private readonly Func _micVolume; private readonly Func _gameMuted; private readonly Func _gameVolume; public AudioGainProvider( Func micMuted, Func micVolume, Func gameMuted, Func gameVolume) { _micMuted = micMuted; _micVolume = micVolume; _gameMuted = gameMuted; _gameVolume = gameVolume; } /// Mic gain for the live mix (0 = muted). public double MicGain() => _micMuted() ? 0 : _micVolume(); /// Loopback (desktop/game) gain for the live mix (0 = muted). public double LoopbackGain() => _gameMuted() ? 0 : _gameVolume(); }