feat: Add basic functionality to all audio usecases

This commit is contained in:
Fabio Lenherr / DashieTM 2023-11-14 21:25:39 +01:00
parent 2f1099267a
commit c1984b5b79
32 changed files with 368 additions and 201 deletions

View file

@ -42,7 +42,7 @@ impl SourceEntry {
println!("{fraction}");
let percentage = (fraction).to_string() + "%";
imp.resetVolumePercentage.set_text(&percentage);
set_inputstream_volume(value, imp.stream.clone());
set_source_volume(value, imp.stream.clone());
Propagation::Proceed
}),
);
@ -51,7 +51,7 @@ impl SourceEntry {
}
}
fn set_inputstream_volume(value: f64, stream: Arc<RefCell<Source>>) -> bool {
pub fn set_source_volume(value: f64, stream: Arc<RefCell<Source>>) -> bool {
let mut stream = stream.borrow_mut().clone();
// let x = stream.volume.iter_mut().map(|_| value as u32);
stream.volume = vec![value as u32; stream.channels as usize];
@ -61,7 +61,7 @@ fn set_inputstream_volume(value: f64, stream: Arc<RefCell<Source>>) -> bool {
let proxy = conn.with_proxy(
"org.xetibo.ReSet",
"/org/xetibo/ReSet",
Duration::from_millis(100),
Duration::from_millis(1000),
);
let res: Result<(bool,), Error> =
proxy.method_call("org.xetibo.ReSet", "SetSourceVolume", (stream,));