pub struct ParamF64<const MAX_BLOCKSIZE: usize> { /* private fields */ }Expand description
An auto-smoothed parameter with an f64 value.
Implementations§
Source§impl<const MAX_BLOCKSIZE: usize> ParamF64<MAX_BLOCKSIZE>
impl<const MAX_BLOCKSIZE: usize> ParamF64<MAX_BLOCKSIZE>
Sourcepub fn from_value(
value: f64,
min: f64,
max: f64,
gradient: Gradient,
unit: Unit,
smooth_secs: Seconds,
sample_rate: SampleRate,
) -> (Self, ParamF64Handle)
pub fn from_value( value: f64, min: f64, max: f64, gradient: Gradient, unit: Unit, smooth_secs: Seconds, sample_rate: SampleRate, ) -> (Self, ParamF64Handle)
Create a Parameter/Handle pair from its (de-normalized) value.
- value - The initial (de-normalized) value of the parameter.
- min - The minimum (de-normalized) value of the parameter.
- max - The maximum (de-normalized) value of the parameter.
- gradient - The
Gradientmapping used when converting from the normalized value in the range[0.0, 1.0]to the desired value. If this parameter deals with decibels, you may useParamF64::DEFAULT_SMOOTH_SECSas a good default. - unit - The
Unitthat signifies how the value displayed to the end user should differ from the actual value used in DSP. - smooth_secs: The period of the low-pass parameter smoothing filter (for declicking). You
may use
ParamF64::DEFAULT_SMOOTH_SECSas a good default. - sample_rate: The sample rate of this process. This is used for the low-pass parameter smoothing filter.
Sourcepub fn from_normalized(
normalized: f64,
min_value: f64,
max_value: f64,
gradient: Gradient,
unit: Unit,
smooth_secs: Seconds,
sample_rate: SampleRate,
) -> (Self, ParamF64Handle)
pub fn from_normalized( normalized: f64, min_value: f64, max_value: f64, gradient: Gradient, unit: Unit, smooth_secs: Seconds, sample_rate: SampleRate, ) -> (Self, ParamF64Handle)
Create a Parameter/Handle pair from its normalized value in the range [0.0, 1.0].
- value - The initial normalized value of the parameter in the range
[0.0, 1.0]. - min - The minimum (de-normalized) value of the parameter.
- max - The maximum (de-normalized) value of the parameter.
- gradient - The
Gradientmapping used when converting from the normalized value in the range[0.0, 1.0]to the desired value. If this parameter deals with decibels, you may useParamF64::DEFAULT_SMOOTH_SECSas a good default. - unit - The
Unitthat signifies how the value displayed to the end user should differ from the actual value used in DSP. - smooth_secs: The period of the low-pass parameter smoothing filter (for declicking). You
may use
ParamF64::DEFAULT_SMOOTH_SECSas a good default. - sample_rate: The sample rate of this process. This is used for the low-pass parameter smoothing filter.
Sourcepub fn set_normalized(&mut self, normalized: f64)
pub fn set_normalized(&mut self, normalized: f64)
Set the normalized value of this parameter in the range [0.0, 1.0].
Sourcepub fn reset_from_value(&mut self, value: f64)
pub fn reset_from_value(&mut self, value: f64)
Reset this parameter (without any smoothing) to the given (de-normalized) value.
Sourcepub fn reset_from_normalized(&mut self, normalized: f64)
pub fn reset_from_normalized(&mut self, normalized: f64)
Reset this parameter (without any smoothing) to the given normalized value in the range [0.0, 1.0].
Sourcepub fn smoothed(&mut self, frames: usize) -> SmoothOutputF64<'_, MAX_BLOCKSIZE>
pub fn smoothed(&mut self, frames: usize) -> SmoothOutputF64<'_, MAX_BLOCKSIZE>
Get the smoothed buffer of values for use in DSP.
Sourcepub fn set_sample_rate(&mut self, sample_rate: SampleRate)
pub fn set_sample_rate(&mut self, sample_rate: SampleRate)
Update the sample rate (used for the parameter smoothing LPF).
Sourcepub fn gradient(&self) -> Gradient
pub fn gradient(&self) -> Gradient
The Gradient mapping used when converting from the normalized value
in the range [0.0, 1.0] to the desired value.
Sourcepub fn unit(&self) -> Unit
pub fn unit(&self) -> Unit
The Unit that signifies how the value displayed to the end user should
differ from the actual value used in DSP.
Sourcepub fn value_to_normalized(&self, value: f64) -> f64
pub fn value_to_normalized(&self, value: f64) -> f64
Convert the given value to the corresponding normalized range [0.0, 1.0]
of this parameter.
Sourcepub fn normalized_to_value(&self, normalized: f64) -> f64
pub fn normalized_to_value(&self, normalized: f64) -> f64
Convert the given normalized value in the range [0.0, 1.0] into the
corresponding value of this parameter.
Sourcepub fn normalized(&self) -> f64
pub fn normalized(&self) -> f64
The current normalized value in the range [0.0, 1.0]. This is only meant for
communicating with the host. This is not meant to be used to retrieve the latest
value for DSP. To get the latest value for DSP please use ParamF64::smoothed()
instead.
Please note that this should be called after calling ParamF64::smoothed()
if you need the latest value from the corresponding ParamF64Handle,
otherwise this may not return the latest value.
Get the shared normalized float value.
This can be useful to integrate with various plugin APIs.