From 6bf397e0f3f00cfe1bf4ff74f3e8bf04317aa93e Mon Sep 17 00:00:00 2001 From: Afonso Jorge Ramos Date: Tue, 31 Mar 2026 02:20:13 +0200 Subject: [PATCH] feat(macos): auto-select SystemDefault backend on non-Linux When backend_type is None (auto-detect), default to SystemDefault on non-Linux platforms so macOS gets CoreAudio device probing and sample rate switching instead of falling through to the legacy CPAL path. --- crates/qbz-player/src/player/mod.rs | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/crates/qbz-player/src/player/mod.rs b/crates/qbz-player/src/player/mod.rs index e2964364f..1750b4bbc 100644 --- a/crates/qbz-player/src/player/mod.rs +++ b/crates/qbz-player/src/player/mod.rs @@ -465,8 +465,16 @@ fn try_init_stream_with_backend( sample_rate: u32, channels: u16, ) -> Option> { - // Check if backend system is configured - let backend_type = audio_settings.backend_type?; + // Check if backend system is configured. + // On non-Linux, default to SystemDefault when not explicitly set, + // so macOS gets CoreAudio device probing and sample rate switching. + let backend_type = audio_settings.backend_type.or_else(|| { + if cfg!(not(target_os = "linux")) { + Some(qbz_audio::AudioBackendType::SystemDefault) + } else { + None + } + })?; log::info!( "Using backend system: {:?} (device: {:?}, plugin: {:?})",