1
0
Fork 0

Directly pass a style to .with_smoother()

This commit is contained in:
Robbert van der Helm 2022-02-12 19:56:37 +01:00
parent d6b358f8ca
commit cd0b870682
3 changed files with 6 additions and 6 deletions

View file

@ -59,7 +59,7 @@ impl Default for GainParams {
max: 30.0, max: 30.0,
}, },
) )
.with_smoother(Smoother::new(SmoothingStyle::Linear(50.0))) .with_smoother(SmoothingStyle::Linear(50.0))
.with_unit(" dB") .with_unit(" dB")
.with_value_to_string(formatters::f32_rounded(2)), .with_value_to_string(formatters::f32_rounded(2)),
some_int: IntParam::new( some_int: IntParam::new(

View file

@ -66,7 +66,7 @@ impl Default for SineParams {
max: 0.0, max: 0.0,
}, },
) )
.with_smoother(Smoother::new(SmoothingStyle::Linear(3.0))) .with_smoother(SmoothingStyle::Linear(3.0))
.with_unit(" dB") .with_unit(" dB")
.with_value_to_string(formatters::f32_rounded(2)), .with_value_to_string(formatters::f32_rounded(2)),
frequency: FloatParam::new( frequency: FloatParam::new(
@ -78,7 +78,7 @@ impl Default for SineParams {
factor: Range::skew_factor(-2.0), factor: Range::skew_factor(-2.0),
}, },
) )
.with_smoother(Smoother::new(SmoothingStyle::Linear(10.0))) .with_smoother(SmoothingStyle::Linear(10.0))
.with_unit(" Hz") .with_unit(" Hz")
.with_value_to_string(formatters::f32_rounded(0)), .with_value_to_string(formatters::f32_rounded(0)),
use_midi: BoolParam::new("Use MIDI", false), use_midi: BoolParam::new("Use MIDI", false),

View file

@ -6,7 +6,7 @@ use std::fmt::Display;
use std::sync::Arc; use std::sync::Arc;
use self::range::{NormalizebleRange, Range}; use self::range::{NormalizebleRange, Range};
use self::smoothing::Smoother; use self::smoothing::{Smoother, SmoothingStyle};
pub mod internals; pub mod internals;
pub mod range; pub mod range;
@ -377,8 +377,8 @@ where
/// is the parameter's new value. This should not do anything expensive as it may be called /// is the parameter's new value. This should not do anything expensive as it may be called
/// multiple times in rapid succession, and it can be run from both the GUI and the audio /// multiple times in rapid succession, and it can be run from both the GUI and the audio
/// thread. /// thread.
pub fn with_smoother(mut self, smoother: Smoother<T>) -> Self { pub fn with_smoother(mut self, style: SmoothingStyle) -> Self {
self.smoothed = smoother; self.smoothed = Smoother::new(style);
self self
} }