Merge pull request #62 from Xetibo/dashie

Dashie
This commit is contained in:
takotori 2023-11-21 17:00:58 +01:00 committed by GitHub
commit 2e8c7eda33
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 27 additions and 5 deletions

View file

@ -392,6 +392,8 @@ pub fn start_audio_listener(
return;
}
let mut conn = start_dbus_audio_listener(conn);
if sink_box.is_some() {
conn = start_output_box_listener(conn, sink_box.unwrap());
}
@ -405,6 +407,7 @@ pub fn start_audio_listener(
let _ = conn.process(Duration::from_millis(1000));
if !listeners.pulse_listener.load(Ordering::SeqCst) {
println!("stopping audio listener");
stop_dbus_audio_listener(conn);
break;
}
// thread::sleep(Duration::from_millis(1000));
@ -412,3 +415,22 @@ pub fn start_audio_listener(
}
});
}
fn start_dbus_audio_listener(conn: Connection) -> Connection {
let proxy = conn.with_proxy(
"org.xetibo.ReSet",
"/org/xetibo/ReSet",
Duration::from_millis(1000),
);
let _: Result<(), Error> = proxy.method_call("org.xetibo.ReSet", "StartAudioListener", ());
conn
}
fn stop_dbus_audio_listener(conn: Connection) {
let proxy = conn.with_proxy(
"org.xetibo.ReSet",
"/org/xetibo/ReSet",
Duration::from_millis(1000),
);
let _: Result<(), Error> = proxy.method_call("org.xetibo.ReSet", "StopAudioListener", ());
}