Skip to content

Commit

Permalink
fix subtle time-line drawing bug
Browse files Browse the repository at this point in the history
  • Loading branch information
magnetophon committed Nov 19, 2024
1 parent e52201d commit 70d11ae
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1045,10 +1045,9 @@ impl Del2 {
.store(NO_LEARNED_NOTE, Ordering::SeqCst);
}
}

fn prepare_for_delay(&mut self, buffer_samples: usize) {
// Cache the current tap value to reduce atomic loads
let tap_counter = self.params.tap_counter.load(Ordering::SeqCst);
let samples_since_last_event = self.samples_since_last_event; // Cache to a local variable
match self.counting_state {
CountingState::TimeOut => {}
CountingState::CountingInBuffer => {
Expand All @@ -1074,6 +1073,8 @@ impl Del2 {
}
}

let samples_since_last_event = self.samples_since_last_event;

// Calculate the current time based on whether there are taps
let current_time = if tap_counter > 0 {
let last_delay_time = self.params.delay_times[tap_counter - 1].load(Ordering::SeqCst);
Expand Down

0 comments on commit 70d11ae

Please sign in to comment.