From f5600c157386d98243a3605b41a8c0c0687c98a6 Mon Sep 17 00:00:00 2001 From: Bart Brouns Date: Tue, 19 Nov 2024 12:44:27 +0100 Subject: [PATCH] no need to iter the taps twice --- src/lib.rs | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index 1ed8487..573c7fb 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -804,6 +804,10 @@ impl Plugin for Del2 { amplitude += (left.abs() + right.abs()) * 0.5; } + if delay_tap.releasing && delay_tap.amp_envelope.previous_value() == 0.0 { + delay_tap.is_alive = false; + } + if self.params.editor_state.is_open() { let weight = self.peak_meter_decay_weight * 0.91; amplitude = (amplitude / block_len as f32).min(1.0); @@ -819,15 +823,6 @@ impl Plugin for Del2 { } } }); - // Terminate inactive delay taps - for delay_tap in self.delay_taps.iter_mut() { - if delay_tap.is_alive - && delay_tap.releasing - && delay_tap.amp_envelope.previous_value() == 0.0 - { - delay_tap.is_alive = false; - } - } block_start = block_end; block_end = (block_start + MAX_BLOCK_SIZE).min(num_samples);