not infinite buffer
parent
479cfb055f
commit
8982276a90
|
|
@ -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()
|
||||
|
|
|
|||
Loading…
Reference in New Issue