pub struct ModulatedParam {
pub base: f64,
pub cv: f64,
pub attenuverter: f64,
pub range: ParamRange,
}Expand description
A parameter that combines a base value (knob) with CV modulation
Fields§
§base: f64Base value from panel knob (typically 0.0–1.0 normalized)
cv: f64Incoming CV voltage (set during tick).
Interpreted on the bipolar ±5 V scale: value normalizes it by
CV_FULL_SCALE_VOLTS so that a full +5 V of CV
(with attenuverter at +1.0) contributes +1.0 to the normalized parameter.
attenuverter: f64Attenuverter setting (-1.0 to 1.0) Positive: CV adds to base Negative: CV subtracts from base (inverted)
range: ParamRangeOutput range mapping
Implementations§
Source§impl ModulatedParam
impl ModulatedParam
Sourcepub const CV_FULL_SCALE_VOLTS: f64 = 5.0
pub const CV_FULL_SCALE_VOLTS: f64 = 5.0
Full-scale CV voltage used to normalize cv into the 0–1 base domain.
Bipolar CV spans ±5 V, so dividing by 5 V maps a full-swing CV signal onto the
same normalized 0–1 range as base before the two are combined.
pub fn new(range: ParamRange) -> Self
pub fn with_base(self, base: f64) -> Self
Sourcepub fn value(&self) -> f64
pub fn value(&self) -> f64
Compute the effective parameter value.
base is a normalized 0–1 knob position; cv is a voltage that is normalized by
CV_FULL_SCALE_VOLTS before being scaled by the
attenuverter (±1.0) and summed with base. This keeps CV modulation proportional:
a full +5 V of CV shifts the normalized value by at most ±1.0 rather than slamming
the parameter to its rail. The combined value is then mapped through range.
Trait Implementations§
Source§impl Clone for ModulatedParam
impl Clone for ModulatedParam
Source§fn clone(&self) -> ModulatedParam
fn clone(&self) -> ModulatedParam
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more