1
0
Fork 0

Move Diopser frequency range to a function

We'll reuse this in the spectrum analyzer.
This commit is contained in:
Robbert van der Helm 2022-11-18 00:39:13 +01:00
parent 3e935dc5ad
commit 025513e3b4

View file

@ -44,6 +44,15 @@ const MAX_AUTOMATION_STEP_SIZE: u32 = 512;
/// The maximum number of samples to iterate over at a time. /// The maximum number of samples to iterate over at a time.
const MAX_BLOCK_SIZE: usize = 64; const MAX_BLOCK_SIZE: usize = 64;
/// The filter frequency parameter's range. Also used in the `SpectrumAnalyzer` widget.
pub(crate) fn filter_frequency_range() -> FloatRange {
FloatRange::Skewed {
min: 5.0, // This must never reach 0
max: 20_000.0,
factor: FloatRange::skew_factor(-2.5),
}
}
// All features from the original Diopser have been implemented (and the spread control has been // All features from the original Diopser have been implemented (and the spread control has been
// improved). Other features I want to implement are: // improved). Other features I want to implement are:
// - Briefly muting the output when changing the number of filters to get rid of the clicks // - Briefly muting the output when changing the number of filters to get rid of the clicks
@ -200,11 +209,9 @@ impl DiopserParams {
filter_frequency: FloatParam::new( filter_frequency: FloatParam::new(
"Filter Frequency", "Filter Frequency",
200.0, 200.0,
FloatRange::Skewed { // This value is also used in the spectrum analyzer to match the spectrum analyzer
min: 5.0, // This must never reach 0 // with this parameter which is bound to the X-Y pad's X-axis
max: 20_000.0, filter_frequency_range(),
factor: FloatRange::skew_factor(-2.5),
},
) )
// 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))