From 78caa0f78d50dca16e9bcc1a68c289a2625e7941 Mon Sep 17 00:00:00 2001 From: Robbert van der Helm Date: Sun, 5 Jun 2022 23:48:41 +0200 Subject: [PATCH] Move Q constant to the biquad module --- plugins/crossover/src/biquad.rs | 2 ++ plugins/crossover/src/crossover/iir.rs | 4 +--- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/plugins/crossover/src/biquad.rs b/plugins/crossover/src/biquad.rs index 4fb1e9a9..d238acd9 100644 --- a/plugins/crossover/src/biquad.rs +++ b/plugins/crossover/src/biquad.rs @@ -20,6 +20,8 @@ use std::f32::consts; use std::ops::{Add, Mul, Sub}; use std::simd::f32x2; +pub const NEUTRAL_Q: f32 = std::f32::consts::FRAC_1_SQRT_2; + /// A simple biquad filter with functions for generating coefficients for second order low-pass and /// high-pass filters. Since these filters have 3 dB of attenuation at the center frequency, we'll /// two of them in series to get 6 dB of attenutation at the crossover point for the LR24 diff --git a/plugins/crossover/src/crossover/iir.rs b/plugins/crossover/src/crossover/iir.rs index 36252e7a..c8784cad 100644 --- a/plugins/crossover/src/crossover/iir.rs +++ b/plugins/crossover/src/crossover/iir.rs @@ -18,11 +18,9 @@ use nih_plug::buffer::ChannelSamples; use nih_plug::debug::*; use std::simd::f32x2; -use crate::biquad::{Biquad, BiquadCoefficients}; +use crate::biquad::{Biquad, BiquadCoefficients, NEUTRAL_Q}; use crate::NUM_BANDS; -const NEUTRAL_Q: f32 = std::f32::consts::FRAC_1_SQRT_2; - #[derive(Debug)] pub struct IirCrossover { /// The kind of crossover to use. `.update_filters()` must be called after changing this.