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,
},
)
.with_smoother(Smoother::new(SmoothingStyle::Linear(50.0)))
.with_smoother(SmoothingStyle::Linear(50.0))
.with_unit(" dB")
.with_value_to_string(formatters::f32_rounded(2)),
some_int: IntParam::new(

View file

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

View file

@ -6,7 +6,7 @@ use std::fmt::Display;
use std::sync::Arc;
use self::range::{NormalizebleRange, Range};
use self::smoothing::Smoother;
use self::smoothing::{Smoother, SmoothingStyle};
pub mod internals;
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
/// multiple times in rapid succession, and it can be run from both the GUI and the audio
/// thread.
pub fn with_smoother(mut self, smoother: Smoother<T>) -> Self {
self.smoothed = smoother;
pub fn with_smoother(mut self, style: SmoothingStyle) -> Self {
self.smoothed = Smoother::new(style);
self
}