Don't panic if the song has finished

This commit is contained in:
Gwilym Kuiper 2021-06-25 21:54:12 +01:00
parent 773729de98
commit c81d73f8d5

View file

@ -27,8 +27,7 @@ pub fn main() -> ! {
input.update(); input.update();
{ {
let channel = mixer.get_channel(&channel_id).unwrap(); if let Some(channel) = mixer.get_channel(&channel_id) {
let half: Num<i16, 4> = Num::new(1) / 2; let half: Num<i16, 4> = Num::new(1) / 2;
let half_usize: Num<usize, 8> = Num::new(1) / 2; let half_usize: Num<usize, 8> = Num::new(1) / 2;
match input.x_tri() { match input.x_tri() {
@ -43,6 +42,7 @@ pub fn main() -> ! {
Tri::Positive => channel.playback(half_usize), Tri::Positive => channel.playback(half_usize),
}; };
} }
}
vblank_provider.wait_for_VBlank(); vblank_provider.wait_for_VBlank();
mixer.vblank(); mixer.vblank();