stop when no note is played
This commit is contained in:
parent
978a3fe213
commit
3ea2af5c60
1 changed files with 3 additions and 0 deletions
|
@ -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?;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue