fix simultaneous flag_repeat + flag_end_tick

This commit is contained in:
lif 2024-01-14 01:01:58 -08:00
parent eef96a70de
commit 17f20d2b39

View file

@ -172,7 +172,7 @@ struct Lsdpack {
setlist: &'static [usize],
current_ptr: usize,
sample_ptr: usize,
repeat_cmd: Option<LsdpackCmd>,
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)