Skip to content

Commit d851132

Browse files
committed
More fixes for volume control
1 parent e5553c4 commit d851132

1 file changed

Lines changed: 12 additions & 13 deletions

File tree

src-tauri/src/sendspin/volume_control.rs

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -561,7 +561,7 @@ mod linux_impl {
561561
context::{Context, FlagSet as ContextFlagSet},
562562
mainloop::threaded::Mainloop,
563563
proplist::Proplist,
564-
volume::{ChannelVolumes, Volume},
564+
volume::Volume,
565565
};
566566
use std::sync::mpsc::{channel, Sender};
567567
use std::sync::{Arc, Mutex};
@@ -625,7 +625,7 @@ mod linux_impl {
625625
)
626626
.unwrap();
627627

628-
let context =
628+
let mut context =
629629
match Context::new_with_proplist(&mainloop, "MusicAssistantContext", &proplist)
630630
{
631631
Some(ctx) => ctx,
@@ -734,7 +734,7 @@ mod linux_impl {
734734
introspect.get_sink_input_info(idx, move |result| {
735735
if let libpulse_binding::callbacks::ListResult::Item(info) = result {
736736
let mut new_volume = info.volume;
737-
let volume_norm = Volume::from(Volume::NORMAL.0 * u32::from(volume) / 100);
737+
let volume_norm = Volume(Volume::NORMAL.0 * u32::from(volume) / 100);
738738
new_volume.set(new_volume.len(), volume_norm);
739739

740740
if let Some(tx) = result_tx_clone.lock().unwrap().take() {
@@ -751,7 +751,7 @@ mod linux_impl {
751751
let (set_result_tx, set_result_rx) = channel();
752752
let set_result_tx = Arc::new(Mutex::new(Some(set_result_tx)));
753753

754-
let introspect = context.introspect();
754+
let mut introspect = context.introspect();
755755
introspect.set_sink_input_volume(
756756
idx,
757757
&new_volume,
@@ -793,7 +793,7 @@ mod linux_impl {
793793
let (result_tx, result_rx) = channel();
794794
let result_tx = Arc::new(Mutex::new(Some(result_tx)));
795795

796-
let introspect = context.introspect();
796+
let mut introspect = context.introspect();
797797
introspect.set_sink_input_mute(
798798
idx,
799799
muted,
@@ -922,14 +922,13 @@ mod linux_impl {
922922
match result {
923923
libpulse_binding::callbacks::ListResult::Item(info) => {
924924
// Check if this sink input belongs to our process
925-
if let Some(proplist) = &info.proplist {
926-
if let Some(app_pid) = proplist.get_str(
927-
libpulse_binding::proplist::properties::APPLICATION_PROCESS_ID,
928-
) {
929-
if let Ok(app_pid_u32) = app_pid.parse::<u32>() {
930-
if app_pid_u32 == pid {
931-
*sink_input_idx_clone.lock().unwrap() = Some(info.index);
932-
}
925+
if let Some(app_pid) = info
926+
.proplist
927+
.get_str(libpulse_binding::proplist::properties::APPLICATION_PROCESS_ID)
928+
{
929+
if let Ok(app_pid_u32) = app_pid.parse::<u32>() {
930+
if app_pid_u32 == pid {
931+
*sink_input_idx_clone.lock().unwrap() = Some(info.index);
933932
}
934933
}
935934
}

0 commit comments

Comments
 (0)