pub struct IntParam {
pub info: ParamInfo,
/* private fields */
}Expand description
An integer parameter.
Fields§
§info: ParamInfoImplementations§
Source§impl IntParam
impl IntParam
Sourcepub fn new(info: ParamInfo) -> Self
pub fn new(info: ParamInfo) -> Self
§Panics
Panics if info.default_plain is non-finite or doesn’t
round-trip through i64. The cast f64 as i64 saturates
silently - default_plain = -1.0 lands on -1 (fine), but
default_plain = 1e30 saturates to i64::MAX and f64::NAN
becomes 0. The derive populates default_plain from
#[param(default = ...)]; a user-supplied float there is a
programmer error, not a runtime condition we should
silently absorb.
pub fn value(&self) -> i64
Sourcepub fn value_f32(&self) -> f32
pub fn value_f32(&self) -> f32
Read the value widened to f32. Useful when an int param feeds
a per-sample DSP loop that runs in f32.
Sourcepub fn value_usize(&self) -> usize
pub fn value_usize(&self) -> usize
Read the value as a non-negative usize. Negatives clamp to 0;
values above usize::MAX saturate.
Sourcepub fn set_value(&self, v: i64)
pub fn set_value(&self, v: i64)
Set the value, clamped to the declared range - symmetric with
FloatParam::set_value. A corrupt preset or hostile automation
value (i64::MAX into a [0, 8] param) must not reach the plugin,
where it could index out of range and panic the audio thread. The
bounds are normalized so a mis-ordered range can’t panic clamp.