diff --git a/alvr/server/src/connection.rs b/alvr/server/src/connection.rs index ed101b497a..2656aeb451 100644 --- a/alvr/server/src/connection.rs +++ b/alvr/server/src/connection.rs @@ -556,35 +556,30 @@ fn connection_pipeline( let game_audio_sample_rate = if let Switch::Enabled(game_audio_config) = &settings.audio.game_audio { - #[cfg(not(target_os = "linux"))] - { - let game_audio_device = - AudioDevice::new_output(game_audio_config.device.as_ref()).to_con()?; - if let Switch::Enabled(microphone_config) = &settings.audio.microphone { - let (sink, source) = - AudioDevice::new_virtual_microphone_pair(microphone_config.devices.clone()) - .to_con()?; - if matches!( - microphone_config.devices, - alvr_session::MicrophoneDevicesConfig::VBCable - ) { - // VoiceMeeter and Custom devices may have arbitrary internal routing. - // Therefore, we cannot detect the loopback issue without knowing the routing. - if alvr_audio::is_same_device(&game_audio_device, &sink) - || alvr_audio::is_same_device(&game_audio_device, &source) - { - con_bail!("Game audio and microphone cannot point to the same device!"); - } + let game_audio_device = + AudioDevice::new_output(game_audio_config.device.as_ref()).to_con()?; + if let Switch::Enabled(microphone_config) = &settings.audio.microphone { + let (sink, source) = + AudioDevice::new_virtual_microphone_pair(microphone_config.devices.clone()) + .to_con()?; + if matches!( + microphone_config.devices, + alvr_session::MicrophoneDevicesConfig::VBCable + ) { + // VoiceMeeter and Custom devices may have arbitrary internal routing. + // Therefore, we cannot detect the loopback issue without knowing the routing. + if alvr_audio::is_same_device(&game_audio_device, &sink) + || alvr_audio::is_same_device(&game_audio_device, &source) + { + con_bail!("Game audio and microphone cannot point to the same device!"); } - // else: - // Stream played via VA-CABLE-X will be directly routed to VA-CABLE-X's virtual microphone. - // Game audio will loop back to the game microphone if they are set to the same VA-CABLE-X device. } - - game_audio_device.input_sample_rate().to_con()? + // else: + // Stream played via VA-CABLE-X will be directly routed to VA-CABLE-X's virtual microphone. + // Game audio will loop back to the game microphone if they are set to the same VA-CABLE-X device. } - #[cfg(target_os = "linux")] - 44100 + + game_audio_device.input_sample_rate().to_con()? } else { 0 };