1
Fork 0

stop when no note is played

This commit is contained in:
Andy Killorin 2025-01-18 23:48:32 -05:00
parent 978a3fe213
commit 3ea2af5c60
Signed by: ank
GPG key ID: 23F9463ECB67FE8C

View file

@ -83,6 +83,7 @@ async fn controller(mut notes: mpsc::Receiver<(Option<pitch_detection::Pitch<f32
let mut control = ControlPacket::Stop; let mut control = ControlPacket::Stop;
let result::Result::Ok(note) = timeout(Duration::from_millis(95), notes.recv()).await else { let result::Result::Ok(note) = timeout(Duration::from_millis(95), notes.recv()).await else {
println!("timeout");
send_packet(&mut controller, ControlPacket::Stop).await?; send_packet(&mut controller, ControlPacket::Stop).await?;
continue; continue;
}; };
@ -130,6 +131,8 @@ async fn controller(mut notes: mpsc::Receiver<(Option<pitch_detection::Pitch<f32
send_packet(&mut controller, control).await?; send_packet(&mut controller, control).await?;
} else {
send_packet(&mut controller, ControlPacket::Stop).await?;
} }
} }
} }