From ba07279059f1ceea45f0b933018c7a6319de8cbe Mon Sep 17 00:00:00 2001 From: Bart Brouns Date: Fri, 25 Oct 2024 22:33:19 +0200 Subject: [PATCH] don't restart when doing RESET_TAPS --- src/lib.rs | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index 97e5581..9cf01a9 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -614,7 +614,7 @@ impl Del2 { CountingState::TimeOut => { if is_delay_note && !is_learning && taps_unlocked { // If in TimeOut state, reset and start new counting phase - self.reset_taps(timing); + self.reset_taps(timing, true); } } CountingState::CountingInBuffer => { @@ -712,7 +712,7 @@ impl Del2 { // self.last_played_notes.note_off(note); } if self.is_playing_action(RESET_TAPS) { - self.reset_taps(timing); + self.reset_taps(timing, false); } } } @@ -737,7 +737,7 @@ impl Del2 { } } - fn reset_taps(&mut self, timing: u32) { + fn reset_taps(&mut self, timing: u32, restart: bool) { self.mute_all_outs(true); if self.params.global.mute_is_toggle.value() { self.enabled_actions.store(MUTE_IN, false); @@ -745,8 +745,14 @@ impl Del2 { } self.enabled_actions.store(LOCK_TAPS, false); self.delay_data.current_tap = 0; - self.timing_last_event = timing; - self.counting_state = CountingState::CountingInBuffer; + if restart { + self.timing_last_event = timing; + self.counting_state = CountingState::CountingInBuffer; + } else { + self.counting_state = CountingState::TimeOut; + self.timing_last_event = 0; + self.samples_since_last_event = 0; + } } fn mute_all_outs(&mut self, mute: bool) {