fix: sluggish controls

This commit is contained in:
2024-06-29 22:05:01 +02:00
parent 4db37a1107
commit 94338d2e37

View File

@@ -7,6 +7,7 @@ use std::{
io::{Read, Write}, io::{Read, Write},
os::unix::net::{UnixListener, UnixStream}, os::unix::net::{UnixListener, UnixStream},
path::Path, path::Path,
process::exit,
sync::{ sync::{
mpsc::{channel, Receiver, Sender}, mpsc::{channel, Receiver, Sender},
Arc, Mutex, Arc, Mutex,
@@ -592,6 +593,16 @@ impl Mixer {
} }
pub fn iterate_mainloop(mainloop: &mut pulse::mainloop::standard::Mainloop) { pub fn iterate_mainloop(mainloop: &mut pulse::mainloop::standard::Mainloop) {
mainloop.borrow_mut().iterate(false); match mainloop.borrow_mut().iterate(false) {
thread::sleep(Duration::from_millis(5)); IterateResult::Success(s) => {
if s == 0 {
thread::sleep(Duration::from_millis(5));
}
}
IterateResult::Quit(_) => exit(0),
IterateResult::Err(e) => {
println!("Err: {:?}", e);
exit(1);
}
};
} }