From 1fad8f724a632de7257f3f27cdee7fa4df547774 Mon Sep 17 00:00:00 2001 From: flodavid Date: Sun, 17 May 2026 04:53:26 +0200 Subject: [PATCH 1/2] fix: Device card_sink_port_name was not set when it could have Not setting card_sink_port_name could induce failure of PulseAudioManager.set_default_device (). Action #2 "Set sink / source port" was not triggered. Then action #3 "Wait for sink / source" failed and the default device was not set in the end. --- src/Services/PulseAudioManager.vala | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/Services/PulseAudioManager.vala b/src/Services/PulseAudioManager.vala index b3489ce6..195a4298 100644 --- a/src/Services/PulseAudioManager.vala +++ b/src/Services/PulseAudioManager.vala @@ -463,8 +463,11 @@ public class Sound.PulseAudioManager : GLib.Object { device.card_sink_name = sink.name; debug ("\t\t\tdevice.card_sink_name: %s", device.card_sink_name); - if (sink.active_port != null && device.port_name == sink.active_port.name) { + if (sink.active_port != null) { device.card_sink_port_name = sink.active_port.name; + } + + if (sink.active_port != null && device.port_name == sink.active_port.name) { device.sink_name = sink.name; debug ("\t\t\tdevice.sink_name: %s", device.card_sink_name); device.sink_index = (int)sink.index; From f26c0b183c16866f84912ad132fba1348bdf93c1 Mon Sep 17 00:00:00 2001 From: flodavid Date: Sun, 17 May 2026 05:02:17 +0200 Subject: [PATCH 2/2] fix: Input and Output were reversed when checking card profiles This could prevent selection of devices with multiple outputs. It was introduced by #293. --- src/Services/PulseAudioManager.vala | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/Services/PulseAudioManager.vala b/src/Services/PulseAudioManager.vala index 195a4298..6775d3fb 100644 --- a/src/Services/PulseAudioManager.vala +++ b/src/Services/PulseAudioManager.vala @@ -80,11 +80,13 @@ public class Sound.PulseAudioManager : GLib.Object { // for example to switch between onboard speakers to hdmi // the profile has to be switched from analog stereo to digital stereo. // Attempt to find profiles that support both selected input and output - var other_device = default_input; - var card_name = "card-sink-name"; + var other_device = default_output; + var direction_name = "source-name"; + var card_direction_name = "card-source-name"; if (device.direction == OUTPUT) { - other_device = default_output; - card_name = "card-source-name"; + other_device = default_input; + direction_name = "sink-name"; + card_direction_name = "card-sink-name"; } var profile_name = device.get_matching_profile (other_device); @@ -99,7 +101,7 @@ public class Sound.PulseAudioManager : GLib.Object { yield set_card_profile_by_index (device.card_index, profile_name); // wait for new card sink to appear debug ("wait for card sink / source"); - yield wait_for_update (device, card_name); + yield wait_for_update (device, card_direction_name); } // #2 Set sink / source port @@ -119,7 +121,7 @@ public class Sound.PulseAudioManager : GLib.Object { if (device.direction == OUTPUT && device.sink_name == null || device.direction == INPUT && device.source_name == null) { debug ("wait for sink / source"); - yield wait_for_update (device, card_name); + yield wait_for_update (device, direction_name); } // #4 Set sink / source