Try to make the audio sink mess clear

This commit is contained in:
Yukino Song
2024-07-31 20:16:00 +08:00
committed by Yukino Song
parent d5605cc899
commit 774ce93162
7 changed files with 56 additions and 22 deletions

View File

@@ -758,13 +758,15 @@ namespace platf::audio {
return nullptr;
}
// If this is a virtual sink, set a callback that will change the sink back if it's changed
auto virtual_sink_info = extract_virtual_sink_info(assigned_sink);
if (virtual_sink_info) {
mic->default_endpt_changed_cb = [this] {
BOOST_LOG(info) << "Resetting sink to ["sv << assigned_sink << "] after default changed";
set_sink(assigned_sink);
};
if (config::audio.keep_default) {
// If this is a virtual sink, set a callback that will change the sink back if it's changed
auto virtual_sink_info = extract_virtual_sink_info(assigned_sink);
if (virtual_sink_info) {
mic->default_endpt_changed_cb = [this] {
BOOST_LOG(info) << "Resetting sink to ["sv << assigned_sink << "] after default changed";
set_sink(assigned_sink);
};
}
}
return mic;