pub struct FloatParam {
pub info: ParamInfo,
pub smoother: Smoother,
/* private fields */
}Expand description
A continuous floating-point parameter.
Fields§
§info: ParamInfo§smoother: SmootherImplementations§
Source§impl FloatParam
impl FloatParam
pub fn new(info: ParamInfo, smoothing: SmoothingStyle) -> Self
Sourcepub fn value_usize(&self) -> usize
pub fn value_usize(&self) -> usize
Read the value rounded to the nearest non-negative usize.
Use this for discrete-range params consumed as array indices.
Negatives, NaN, and infinities saturate at 0 / usize::MAX.
Sourcepub fn value_i32(&self) -> i32
pub fn value_i32(&self) -> i32
Read the value rounded to the nearest i32. Out-of-range
values saturate at i32::MIN / i32::MAX; NaN → 0.
Sourcepub fn value_u8(&self) -> u8
pub fn value_u8(&self) -> u8
Read the value rounded to the nearest u8. Negatives clamp to
0; values above 255 saturate at u8::MAX; NaN → 0.
Sourcepub fn is_smoothing(&self) -> bool
pub fn is_smoothing(&self) -> bool
True when the smoother is mid-step toward a new target.
Inverse of Smoother::is_converged.
Use to branch in process() between a constant-gain fast
path (smoothers at target, gain identical across the whole
block, one gain_block per channel) and the envelope slow
path (read_block + per-sample envelope + chunks_mut).
SmoothingStyle::None always reports false here, so the
fast path is unconditional for plugins that disable
smoothing.
if !self.params.gain.is_smoothing() && !self.params.pan.is_smoothing() {
// fast path: gain is constant for the whole block.
} else {
// slow path: envelope precompute + chunked apply.
}Trait Implementations§
Source§impl FloatParamReadF32 for FloatParam
impl FloatParamReadF32 for FloatParam
Source§fn read_block<const N: usize>(&self) -> [f32; N]
fn read_block<const N: usize>(&self) -> [f32; N]
use read_into(&mut scratch[..n]) instead; read_block::<N> advances the smoother by N regardless of how many samples the caller consumes, which steps the value at the next block boundary when the host’s block size isn’t a multiple of N
N samples in one call,
returning the per-sample values as a stack array. Read moreSource§fn read_into(&self, out: &mut [f32])
fn read_into(&self, out: &mut [f32])
out with the next out.len() smoothed samples; advance
the smoother by out.len() (not by the slice’s capacity).
Same one atomic load + one atomic store amortization as
Self::read_block; runtime length instead of const-generic
N. The right primitive when chunking process()’s block
dynamically: Read moreSource§fn read_after(&self, n_samples: usize) -> f32
fn read_after(&self, n_samples: usize) -> f32
n_samples in one call, returning
only the final value. Use for block-rate DSP - hard
gates, mode switches, anything that needs one smoothed value
per audio block. Pass buffer.num_samples() to keep the
smoother’s wall-clock convergence time matching the smoother
declaration (smooth = "exp(20)" then actually settles in
~20 ms instead of ~20 blocks). One atomic load + one atomic
store; the intermediate envelope from Self::read_block
is skipped.Source§fn value(&self) -> f32
fn value(&self) -> f32
set_normalized / host automation),
not the smoothed output. Use Self::read / Self::current
in the DSP loop.Source§impl FloatParamReadF64 for FloatParam
impl FloatParamReadF64 for FloatParam
fn read(&self) -> f64
Source§fn read_block<const N: usize>(&self) -> [f64; N]
fn read_block<const N: usize>(&self) -> [f64; N]
use read_into(&mut scratch[..n]) instead; read_block::<N> advances the smoother by N regardless of how many samples the caller consumes
FloatParamReadF32::read_block; same
deprecation rationale - use Self::read_into for any
runtime-length chunk.Source§fn read_into(&self, out: &mut [f64])
fn read_into(&self, out: &mut [f64])
FloatParamReadF32::read_into; one widen per
slot on top of the same one-atomic-pair fast path.Source§fn read_after(&self, n_samples: usize) -> f64
fn read_after(&self, n_samples: usize) -> f64
FloatParamReadF32::read_after; one widen
on top of the same one-atomic-pair fast path.