not infinite buffer

master
Bel LaPointe 2023-11-30 09:41:12 -07:00
parent 479cfb055f
commit 8982276a90
1 changed files with 2 additions and 2 deletions

View File

@ -121,7 +121,7 @@ fn new_listener() -> Listener {
impl Listener {
fn listen(self, mut cb: impl FnMut(Vec<f32>)) {
let (send, recv) = std::sync::mpsc::channel();
let (send, recv) = std::sync::mpsc::sync_channel(5_000_000);
thread::spawn(move || { self._listen(send); });
loop {
match recv.recv() {
@ -131,7 +131,7 @@ impl Listener {
}
}
fn _listen(self, ch: std::sync::mpsc::Sender<Vec<f32>>) {
fn _listen(self, ch: std::sync::mpsc::SyncSender<Vec<f32>>) {
let host = cpal::default_host();
let device = host.default_input_device().unwrap();
let cfg = device.supported_input_configs()