Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 12 additions & 7 deletions src/Services/PulseAudioManager.vala
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -463,8 +465,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;
Expand Down