1
0
Fork 0

Use the f32_hz_then_khz formatter

This commit is contained in:
Robbert van der Helm 2022-03-21 14:44:26 +01:00
parent 0f60ce9609
commit 5b2f8a417b
2 changed files with 6 additions and 5 deletions

View file

@ -170,8 +170,9 @@ impl DiopserParams {
) )
// This needs quite a bit of smoothing to avoid artifacts // This needs quite a bit of smoothing to avoid artifacts
.with_smoother(SmoothingStyle::Logarithmic(100.0)) .with_smoother(SmoothingStyle::Logarithmic(100.0))
.with_unit(" Hz") // This includes the unit
.with_value_to_string(formatters::f32_rounded(0)), .with_value_to_string(formatters::f32_hz_then_khz(0))
.with_string_to_value(formatters::from_f32_hz_then_khz()),
filter_resonance: FloatParam::new( filter_resonance: FloatParam::new(
"Filter Resonance", "Filter Resonance",
// The actual default neutral Q-value would be `sqrt(2) / 2`, but this value // The actual default neutral Q-value would be `sqrt(2) / 2`, but this value

View file

@ -69,10 +69,10 @@ impl Default for SineParams {
}, },
) )
.with_smoother(SmoothingStyle::Linear(10.0)) .with_smoother(SmoothingStyle::Linear(10.0))
.with_unit(" Hz")
// We purposely don't specify a step size here, but the parameter should still be // We purposely don't specify a step size here, but the parameter should still be
// displaeyd as rounded // displayed as if it were rounded. This formatter also includes the unit.
.with_value_to_string(formatters::f32_rounded(0)), .with_value_to_string(formatters::f32_hz_then_khz(0))
.with_string_to_value(formatters::from_f32_hz_then_khz()),
use_midi: BoolParam::new("Use MIDI", false), use_midi: BoolParam::new("Use MIDI", false),
} }
} }