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.
This commit is contained in:
Afonso Jorge Ramos committed 2026-03-31 02:20:13 +02:00
1 parent 4c15a43200
commit 6bf397e0f3
1 file changed
+10 -2
+10 -2
View File
@@ -465,8 +465,16 @@ fn try_init_stream_with_backend(
sample_rate: u32,
channels: u16,
) -> Option<Result<StreamType, String>> {
// 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: {:?})",