audio: Set source/sink mute state
Setting the volume to a non-zero value will unmute the source or sink, and setting it to zero will mute it. This matches the behavior on Gnome.
This commit is contained in:
parent
1e5af14bc4
commit
fbd1489c7b
1 changed files with 13 additions and 3 deletions
|
|
@ -631,6 +631,11 @@ impl PulseServer {
|
|||
}
|
||||
|
||||
fn set_sink_volume_by_name(&mut self, name: &str, volume: &ChannelVolumes) {
|
||||
let op = self
|
||||
.introspector
|
||||
.set_sink_mute_by_name(name, volume.is_muted(), None);
|
||||
self.wait_for_result(op).ok();
|
||||
|
||||
let op = self
|
||||
.introspector
|
||||
.set_sink_volume_by_name(name, volume, None);
|
||||
|
|
@ -638,10 +643,15 @@ impl PulseServer {
|
|||
}
|
||||
|
||||
fn set_source_volume_by_name(&mut self, name: &str, volume: &ChannelVolumes) {
|
||||
let op = self
|
||||
.introspector
|
||||
.set_source_mute_by_name(name, volume.is_muted(), None);
|
||||
let _ = self.wait_for_result(op);
|
||||
|
||||
let op = self
|
||||
.introspector
|
||||
.set_source_volume_by_name(name, volume, None);
|
||||
self.wait_for_result(op).ok();
|
||||
let _ = self.wait_for_result(op);
|
||||
}
|
||||
|
||||
fn get_source_outputs(&mut self, source: u32) -> Vec<u32> {
|
||||
|
|
@ -654,7 +664,7 @@ impl PulseServer {
|
|||
}
|
||||
}
|
||||
});
|
||||
self.wait_for_result(op).ok();
|
||||
let _ = self.wait_for_result(op);
|
||||
result_ref.replace(Vec::new())
|
||||
}
|
||||
|
||||
|
|
@ -668,7 +678,7 @@ impl PulseServer {
|
|||
}
|
||||
}
|
||||
});
|
||||
self.wait_for_result(op).ok();
|
||||
let _ = self.wait_for_result(op);
|
||||
result_ref.replace(Vec::new())
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue