diff --git a/daemon/src/device.rs b/daemon/src/device.rs index 02d921af..5f3af613 100644 --- a/daemon/src/device.rs +++ b/daemon/src/device.rs @@ -21,7 +21,7 @@ use goxlr_types::{ Button, ChannelName, DeviceType, DisplayModeComponents, EffectBankPresets, EffectKey, EncoderName, FaderName, HardTuneSource, InputDevice as BasicInputDevice, MicrophoneParamKey, Mix, MuteState, OutputDevice as BasicOutputDevice, RobotRange, SampleBank, SampleButtons, - SamplePlaybackMode, VersionNumber, WaterfallDirection, + SamplePlaybackMode, VersionNumber, VodMode, WaterfallDirection, }; use goxlr_usb::animation::{AnimationMode, WaterFallDir}; use goxlr_usb::buttonstate::{ButtonStates, Buttons}; @@ -2934,7 +2934,7 @@ impl<'a> Device<'a> { Ok(()) } - fn apply_transient_routing( + async fn apply_transient_routing( &self, input: BasicInputDevice, router: &mut EnumMap, @@ -2953,7 +2953,8 @@ impl<'a> Device<'a> { for fader in FaderName::iter() { if self.profile.get_fader_assignment(fader) == channel_name { - self.apply_transient_fader_routing(channel_name, fader, router)?; + self.apply_transient_fader_routing(channel_name, fader, router) + .await?; } } @@ -2961,13 +2962,13 @@ impl<'a> Device<'a> { // to ensure that if we're handling the mic, we handle it here. if channel_name == ChannelName::Mic { self.apply_transient_chat_mic_mute(router)?; - self.apply_transient_cough_routing(router)?; + self.apply_transient_cough_routing(router).await?; } Ok(()) } - fn apply_transient_fader_routing( + async fn apply_transient_fader_routing( &self, channel_name: ChannelName, fader: FaderName, @@ -2981,9 +2982,10 @@ impl<'a> Device<'a> { mute_function, router, ) + .await } - fn apply_transient_cough_routing( + async fn apply_transient_cough_routing( &self, router: &mut EnumMap, ) -> Result<()> { @@ -2998,6 +3000,7 @@ impl<'a> Device<'a> { mute_function, router, ) + .await } fn apply_transient_chat_mic_mute( @@ -3022,7 +3025,7 @@ impl<'a> Device<'a> { Ok(()) } - fn apply_transient_channel_routing( + async fn apply_transient_channel_routing( &self, channel_name: ChannelName, muted_to_x: bool, @@ -3044,7 +3047,15 @@ impl<'a> Device<'a> { match mute_function { MuteFunction::All => {} - MuteFunction::ToStream => router[BasicOutputDevice::BroadcastMix] = false, + MuteFunction::ToStream => { + // Disable routing to the Stream Mix + router[BasicOutputDevice::BroadcastMix] = false; + + // If we're a mini, with VOD Mode 'Stream No Music', disable this route to VOD. + if self.is_steam_no_music().await { + router[BasicOutputDevice::Sampler] = false; + } + } MuteFunction::ToVoiceChat => router[BasicOutputDevice::ChatMic] = false, MuteFunction::ToPhones => router[BasicOutputDevice::Headphones] = false, MuteFunction::ToLineOut => router[BasicOutputDevice::LineOut] = false, @@ -3071,7 +3082,18 @@ impl<'a> Device<'a> { } } - self.apply_transient_routing(input, &mut router)?; + if self.is_steam_no_music().await { + // Ok, so we need to sync the Mix channel to the Sample (VOD) Channel, unless Music + if input == BasicInputDevice::Music { + // Force Music -> Sample to Off + router[BasicOutputDevice::Sampler] = false; + } else { + // Sync the Mix and Sampler (VOD) channels + router[BasicOutputDevice::Sampler] = router[BasicOutputDevice::BroadcastMix]; + } + } + + self.apply_transient_routing(input, &mut router).await?; debug!("Applying Routing to {:?}:", input); debug!("{:?}", router); @@ -3808,6 +3830,11 @@ impl<'a> Device<'a> { DeviceType::Mini => version_newer_or_equal_to(current, support_mini), } } + + async fn is_steam_no_music(&self) -> bool { + self.hardware.device_type == DeviceType::Mini + && self.settings.get_device_vod_mode(self.serial()).await == VodMode::StreamNoMusic + } } fn tts_bool_to_state(bool: bool) -> String {