1
0
Fork 0

Use the step sizes

This commit is contained in:
Robbert van der Helm 2022-02-13 16:43:11 +01:00
parent adf59c192b
commit 3d8cfd7477
3 changed files with 9 additions and 5 deletions

View file

@ -60,8 +60,8 @@ impl Default for GainParams {
}, },
) )
.with_smoother(SmoothingStyle::Linear(50.0)) .with_smoother(SmoothingStyle::Linear(50.0))
.with_unit(" dB") .with_step_size(0.01)
.with_value_to_string(formatters::f32_rounded(2)), .with_unit(" dB"),
some_int: IntParam::new( some_int: IntParam::new(
"Something", "Something",
3, 3,

View file

@ -51,9 +51,11 @@ impl Default for GainParams {
min: -30.0, min: -30.0,
max: 30.0, max: 30.0,
}, },
step_size: None, step_size: Some(0.01),
name: "Gain", name: "Gain",
unit: " dB", unit: " dB",
// This is actually redundant, because a step size of two decimal places already
// causes the parameter to shown rounded
value_to_string: Some(formatters::f32_rounded(2)), value_to_string: Some(formatters::f32_rounded(2)),
string_to_value: None, string_to_value: None,
// ...or specify the fields you want to initialize directly and leave the other // ...or specify the fields you want to initialize directly and leave the other

View file

@ -67,8 +67,8 @@ impl Default for SineParams {
}, },
) )
.with_smoother(SmoothingStyle::Linear(3.0)) .with_smoother(SmoothingStyle::Linear(3.0))
.with_unit(" dB") .with_step_size(0.01)
.with_value_to_string(formatters::f32_rounded(2)), .with_unit(" dB"),
frequency: FloatParam::new( frequency: FloatParam::new(
"Frequency", "Frequency",
420.0, 420.0,
@ -80,6 +80,8 @@ impl Default for SineParams {
) )
.with_smoother(SmoothingStyle::Linear(10.0)) .with_smoother(SmoothingStyle::Linear(10.0))
.with_unit(" Hz") .with_unit(" Hz")
// We purposely don't specify a step size here, but the parameter should still be
// displaeyd as rounded
.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),
} }