From 94338d2e37366feae7149a2a712b00ae19d4fc25 Mon Sep 17 00:00:00 2001 From: 409 Date: Sat, 29 Jun 2024 22:05:01 +0200 Subject: [PATCH] fix: sluggish controls --- src/mixer.rs | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/src/mixer.rs b/src/mixer.rs index d4a17c5..ebae9c6 100644 --- a/src/mixer.rs +++ b/src/mixer.rs @@ -7,6 +7,7 @@ use std::{ io::{Read, Write}, os::unix::net::{UnixListener, UnixStream}, path::Path, + process::exit, sync::{ mpsc::{channel, Receiver, Sender}, Arc, Mutex, @@ -592,6 +593,16 @@ impl Mixer { } pub fn iterate_mainloop(mainloop: &mut pulse::mainloop::standard::Mainloop) { - mainloop.borrow_mut().iterate(false); - thread::sleep(Duration::from_millis(5)); + match mainloop.borrow_mut().iterate(false) { + IterateResult::Success(s) => { + if s == 0 { + thread::sleep(Duration::from_millis(5)); + } + } + IterateResult::Quit(_) => exit(0), + IterateResult::Err(e) => { + println!("Err: {:?}", e); + exit(1); + } + }; }