Skip to content

Commit

Permalink
clippy fix
Browse files Browse the repository at this point in the history
  • Loading branch information
magnetophon committed Dec 13, 2024
1 parent 2d8186c commit 9ba699d
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 11 deletions.
12 changes: 6 additions & 6 deletions src/editor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -549,7 +549,7 @@ impl View for DelayGraph {

let target_time_scaling_factor = Self::compute_time_scaling_factor(&params);
let gui_decay_weight = Self::calculate_gui_decay_weight(&params);
let available_width = bounds.w - outline_width - border_width * 2.0;
let available_width = border_width.mul_add(-2.0, bounds.w - outline_width);
let time_scaling_factor = (Self::gui_smooth(
target_time_scaling_factor,
&params.previous_time_scaling_factor,
Expand Down Expand Up @@ -887,7 +887,7 @@ impl DelayGraph {
bounds.x + x_offset,
bounds.y + border_width,
line_width,
bounds.h - border_width * 2.0,
border_width.mul_add(-2.0, bounds.h),
),
None,
);
Expand Down Expand Up @@ -920,7 +920,7 @@ impl DelayGraph {
line_width: f32,
border_width: f32,
) {
let available_height = bounds.h - border_width * 2.0;
let available_height = border_width.mul_add(-2.0, bounds.h);
// Calculate and draw input meter
let input_db = util::gain_to_db(input_meter.load(Ordering::Relaxed));
let input_height = {
Expand Down Expand Up @@ -948,7 +948,7 @@ impl DelayGraph {
(tick_fraction * available_height).max(0.0)
};
path = vg::Path::new();
let x_val = bounds.x + bounds.w - border_width - 0.5 * line_width;
let x_val = 0.5f32.mul_add(-line_width, bounds.x + bounds.w - border_width);
path.move_to((x_val, bounds.y + bounds.h - border_width));
path.line_to((x_val, bounds.y + bounds.h - border_width - output_height));
// let x_val = line_width.mul_add(-0.5, bounds.x + bounds.w);
Expand Down Expand Up @@ -976,7 +976,7 @@ impl DelayGraph {
border_width: f32,
) {
let tap_counter = params.tap_counter.load(Ordering::SeqCst);
let available_height = bounds.h - border_width * 2.0;
let available_height = border_width.mul_add(-2.0, bounds.h);

let (r, g, b) = (velocity_color.r(), velocity_color.g(), velocity_color.b());
let ambient_color = Color::rgba(r, g, b, BLUE_GLOW_ALPHA);
Expand Down Expand Up @@ -1258,7 +1258,7 @@ impl DelayGraph {
pan_foreground_path.add_rect(
vg::Rect::from_xywh(
note_center_x,
note_center_y - line_width * 0.35,
line_width.mul_add(-0.35, note_center_y),
pan_foreground_length,
line_width * 0.7,
),
Expand Down
4 changes: 2 additions & 2 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1457,9 +1457,9 @@ impl Del2 {
fn v2s_f32_hz_then_khz_three_digits() -> Arc<dyn Fn(f32) -> String + Send + Sync> {
Arc::new(move |value| {
if value < 100.0 {
format!("{:.1} Hz", value)
format!("{value:.1} Hz")
} else if value < 1000.0 {
format!("{:.0} Hz", value)
format!("{value:.0} Hz")
} else if value < 10000.0 {
format!("{:.2} kHz", value / 1000.0)
} else {
Expand Down
6 changes: 3 additions & 3 deletions src/svf_simper.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,13 +52,13 @@ impl SVFSimper {
pub fn new(cutoff: f32, resonance: f32, sample_rate: f32) -> Self {
let g = (consts::PI * (cutoff / sample_rate)).tan();
// let k = 2f32 - (1.9f32 * resonance.min(1f32).max(0f32));
let k = 2f32 - (2.0f32 * resonance.min(1f32).max(0f32));
let k = 2.0f32.mul_add(-resonance.min(1f32).max(0f32), 2f32);

let a1 = 1.0 / (1.0 + (g * (g + k)));
let a1 = 1.0 / g.mul_add(g + k, 1.0);
let a2 = g * a1;
let a3 = g * a2;

SVFSimper {
Self {
a1: f32x4::splat(a1),
a2: f32x4::splat(a2),
a3: f32x4::splat(a3),
Expand Down

0 comments on commit 9ba699d

Please sign in to comment.