fix(sound): volume debounce not applied

This commit is contained in:
Konstantinos 2024-10-22 18:48:11 +03:00 committed by GitHub
parent b8f0be58a7
commit 1222cbb515
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -304,7 +304,7 @@ impl Page {
let mut command = None; let mut command = None;
if let Some(&node_id) = self.source_ids.get(self.active_source.unwrap_or(0)) { if let Some(&node_id) = self.source_ids.get(self.active_source.unwrap_or(0)) {
command = Some(cosmic::command::future(async move { command = Some(cosmic::command::future(async move {
tokio::time::sleep(Duration::from_millis(500)).await; tokio::time::sleep(Duration::from_millis(64)).await;
crate::pages::Message::Sound(Message::SourceVolumeApply(node_id)) crate::pages::Message::Sound(Message::SourceVolumeApply(node_id))
})); }));
} }
@ -316,7 +316,7 @@ impl Page {
} }
Message::Pulse(pulse::Event::SourceVolume(volume)) => { Message::Pulse(pulse::Event::SourceVolume(volume)) => {
if self.sink_volume_debounce { if self.source_volume_debounce {
return Command::none(); return Command::none();
} }
@ -334,13 +334,13 @@ impl Page {
let mut command = None; let mut command = None;
if let Some(&node_id) = self.sink_ids.get(self.active_sink.unwrap_or(0)) { if let Some(&node_id) = self.sink_ids.get(self.active_sink.unwrap_or(0)) {
command = Some(cosmic::command::future(async move { command = Some(cosmic::command::future(async move {
tokio::time::sleep(Duration::from_millis(500)).await; tokio::time::sleep(Duration::from_millis(64)).await;
crate::pages::Message::Sound(Message::SinkVolumeApply(node_id)) crate::pages::Message::Sound(Message::SinkVolumeApply(node_id))
})); }));
} }
if let Some(command) = command { if let Some(command) = command {
self.source_volume_debounce = true; self.sink_volume_debounce = true;
return command; return command;
} }
} }