@@ -5,6 +5,7 @@ use fastrand_contrib::RngExt;
55use nih_plug:: nih_log;
66use nih_plug:: util:: { db_to_gain, db_to_gain_fast} ;
77use num_traits:: { ConstOne , ConstZero } ;
8+ use numeric_literals:: replace_float_literals;
89use std:: sync:: atomic:: { AtomicU64 , Ordering } ;
910use std:: sync:: Arc ;
1011use valib:: dsp:: { BlockAdapter , DSPMeta , DSPProcess , SampleAdapter } ;
@@ -431,15 +432,16 @@ impl<T: Scalar> FilterImpl<T> {
431432 }
432433 }
433434
435+ #[ replace_float_literals( T :: from_f64( literal) ) ]
434436 fn set_params ( & mut self , samplerate : T , cutoff : T , resonance : T ) {
435437 match self {
436438 Self :: Transistor ( p) => {
437439 p. set_cutoff ( cutoff) ;
438- p. set_resonance ( T :: from_f64 ( 4. ) * resonance) ;
440+ p. set_resonance ( 4. * resonance) ;
439441 }
440442 Self :: Ota ( p) => {
441443 p. set_cutoff ( cutoff) ;
442- p. set_resonance ( T :: from_f64 ( 4. ) * resonance) ;
444+ p. set_resonance ( 4. * resonance) ;
443445 }
444446 Self :: Svf ( _, p) => {
445447 p. set_cutoff ( cutoff) ;
@@ -448,7 +450,7 @@ impl<T: Scalar> FilterImpl<T> {
448450 Self :: Biquad ( p) => {
449451 p. update_coefficients ( & Biquad :: lowpass (
450452 cutoff / samplerate,
451- T :: from_f64 ( 4.7 ) * ( T :: from_f64 ( 2. ) * resonance - T :: one ( ) ) . simd_exp ( ) ,
453+ 0.1 + 4.7 * ( 2. * resonance - 1. ) . simd_exp ( ) * resonance ,
452454 ) ) ;
453455 }
454456 }
@@ -552,8 +554,8 @@ impl<T: Scalar> Filter<T> {
552554 Svf :: new ( self . samplerate , cutoff, T :: one ( ) - resonance) . with_saturator ( Sinh ) ,
553555 ) ,
554556 FilterType :: Digital if !matches ! ( self . fimpl, FilterImpl :: Biquad ( ..) ) => {
555- let resonance =
556- T :: from_f64 ( 4.7 ) * ( T :: from_f64 ( 2. ) * resonance - T :: one ( ) ) . simd_exp ( ) ;
557+ let resonance = T :: from_f64 ( 0.1 )
558+ + T :: from_f64 ( 4.7 ) * ( T :: from_f64 ( 2. ) * resonance - T :: one ( ) ) . simd_exp ( ) ;
557559 FilterImpl :: Biquad (
558560 Biquad :: lowpass ( cutoff / self . samplerate , resonance)
559561 . with_saturators ( Default :: default ( ) , Default :: default ( ) ) ,
0 commit comments