From a8f95f4a5c956ca87f29e257e6aa57e79c686f1f Mon Sep 17 00:00:00 2001 From: Arnaud Gourlay Date: Sun, 8 Dec 2024 12:45:20 +0100 Subject: [PATCH] misc --- src/audio/midi_builder.rs | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/src/audio/midi_builder.rs b/src/audio/midi_builder.rs index e8a6733..c4da990 100644 --- a/src/audio/midi_builder.rs +++ b/src/audio/midi_builder.rs @@ -676,11 +676,7 @@ fn apply_velocity_effect( } else if effect.heavy_accentuated_note { velocity = MIN_VELOCITY.max(velocity + VELOCITY_INCREMENT * 2); } - if velocity > 127 { - 127 - } else { - velocity - } + velocity.min(127) } fn apply_duration_effect( @@ -713,11 +709,7 @@ fn apply_duration_effect( fn apply_static_duration(tempo: i32, duration: i32, maximum: usize) -> usize { let value = (tempo * duration / 60) as usize; - if value < maximum { - value - } else { - maximum - } + value.min(maximum) } #[cfg(test)]