Skip to content

Commit

Permalink
no need to iter the taps twice
Browse files Browse the repository at this point in the history
  • Loading branch information
magnetophon committed Nov 19, 2024
1 parent 82e3168 commit f5600c1
Showing 1 changed file with 4 additions and 9 deletions.
13 changes: 4 additions & 9 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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);
Expand Down

0 comments on commit f5600c1

Please sign in to comment.