From 17f20d2b39c325363fc867f7f03e0090f9b8aff3 Mon Sep 17 00:00:00 2001 From: lif <> Date: Sun, 14 Jan 2024 01:01:58 -0800 Subject: [PATCH] fix simultaneous flag_repeat + flag_end_tick --- src/main.rs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/main.rs b/src/main.rs index a46a0ea..a5c6b5d 100644 --- a/src/main.rs +++ b/src/main.rs @@ -172,7 +172,7 @@ struct Lsdpack { setlist: &'static [usize], current_ptr: usize, sample_ptr: usize, - repeat_cmd: Option, + repeat_cmd: Option<(LsdpackCmd, bool)>, repeat_cmd_counter: usize, sample_pitch: u16, stopped: bool, @@ -243,10 +243,11 @@ impl Lsdpack { } let mut ongoing = true; while ongoing { - if let Some(cmd) = self.repeat_cmd { + if let Some((cmd, flagged_ongoing)) = self.repeat_cmd { if self.repeat_cmd_counter > 0 { self.repeat_cmd_counter -= 1; - ongoing = self.apply_cmd(cmd); + ongoing = flagged_ongoing; + ongoing &= self.apply_cmd(cmd); continue; } else { self.repeat_cmd = None; @@ -270,7 +271,7 @@ impl Lsdpack { } if cmd & FLAG_REPEAT != 0 { cmd &= !FLAG_REPEAT; - self.repeat_cmd = Some(cmd.into()); + self.repeat_cmd = Some((cmd.into(), ongoing)); self.repeat_cmd_counter = self.next_byte() as usize; } (cmd.into(), ongoing)