diff --git a/src/editor.rs b/src/editor.rs index cc37a5f..8659b34 100644 --- a/src/editor.rs +++ b/src/editor.rs @@ -394,13 +394,23 @@ impl View for DelayGraph { let outline_width = draw_context.outline_width(); // Compute the time scaling factor - let time_scaling_factor = Self::compute_time_scaling_factor( + let target_time_scaling_factor = Self::compute_time_scaling_factor( self.params.clone(), bounds.w, border_width, outline_width, ); + let factor = 0.9; + let time_scaling_factor = (self + .params + .previous_time_scaling_factor + .load(Ordering::SeqCst) + * factor) + + (target_time_scaling_factor * (1.0 - factor)); + self.params + .previous_time_scaling_factor + .store(time_scaling_factor, Ordering::SeqCst); // Draw components Self::draw_background(canvas, bounds, background_color); Self::draw_delay_times_as_lines( diff --git a/src/lib.rs b/src/lib.rs index d68a7e7..7e30779 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -147,6 +147,7 @@ pub struct Del2Params { max_tap_samples: Arc, #[persist = "first-note"] first_note: Arc, + previous_time_scaling_factor: Arc, /// A voice's gain. This can be polyphonically modulated. #[id = "gain"] @@ -523,6 +524,7 @@ impl Del2Params { current_time: Arc::new(AtomicU32::new(0)), max_tap_samples: Arc::new(AtomicU32::new(0)), first_note: Arc::new(AtomicU8::new(NO_LEARNED_NOTE)), + previous_time_scaling_factor: Arc::new(AtomicF32::new(0.0)), gain: FloatParam::new( "Gain",