From fbb77aa7cd341ed36f216b4b5da709390ce6555a Mon Sep 17 00:00:00 2001 From: Cameron Gutman Date: Tue, 23 May 2023 20:15:48 -0500 Subject: [PATCH] Prefer virtual sink over audio sink if host playback is disabled Fixes "Play audio on host PC" option not working when audio sink is manually set --- src/audio.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/audio.cpp b/src/audio.cpp index 5fb960a6..f28436c8 100644 --- a/src/audio.cpp +++ b/src/audio.cpp @@ -153,14 +153,16 @@ namespace audio { } // Order of priority: - // 1. Config - // 2. Virtual if available + // 1. Virtual sink + // 2. Audio sink // 3. Host std::string *sink = &ref->sink.host; if (!config::audio.sink.empty()) { sink = &config::audio.sink; } - else if (ref->sink.null) { + + // Prefer the virtual sink if host playback is disabled or there's no other sink + if (ref->sink.null && (!config.flags[config_t::HOST_AUDIO] || sink->empty())) { auto &null = *ref->sink.null; switch (stream->channelCount) { case 2: