pub struct PotHead<TIn: 'static, TOut: 'static = TIn> { /* private fields */ }Implementations§
Source§impl<TIn, TOut> PotHead<TIn, TOut>where
TIn: 'static + Copy + PartialOrd + AsPrimitive<f32>,
TOut: 'static + Copy + PartialOrd + AsPrimitive<f32>,
f32: AsPrimitive<TOut>,
impl<TIn, TOut> PotHead<TIn, TOut>where
TIn: 'static + Copy + PartialOrd + AsPrimitive<f32>,
TOut: 'static + Copy + PartialOrd + AsPrimitive<f32>,
f32: AsPrimitive<TOut>,
pub fn new(config: &'static Config<TIn, TOut>) -> Result<Self, ConfigError>
pub fn config(&self) -> &Config<TIn, TOut>
pub fn process(&mut self, input: TIn) -> TOut
Sourcepub fn physical_position(&self) -> f32
pub fn physical_position(&self) -> f32
Returns the current physical input position in normalized 0.0..1.0 range. Useful for UI display when grab mode is active.
This always reflects where the pot physically is (after normalize→filter→curve→hysteresis), but BEFORE virtual modifications like snap zones and grab mode logic.
Sourcepub fn current_output(&self) -> f32
pub fn current_output(&self) -> f32
Returns the current output value in normalized 0.0..1.0 range without updating state. Useful for reading the locked virtual value in grab mode.
Sourcepub fn is_waiting_for_grab(&self) -> bool
pub fn is_waiting_for_grab(&self) -> bool
Returns true if grab mode is active but not yet grabbed.
When true, physical_position() != current_output()
Sourcepub fn set_virtual_value(&mut self, value: TOut)
pub fn set_virtual_value(&mut self, value: TOut)
Set the virtual parameter value (e.g., after preset change or automation). This unlocks grab mode, requiring the pot to be grabbed again.
value is in the same output space as process() returns.
When switching which parameter a physical pot controls, use attach instead —
it also seeds the filter to prevent false grabs on reactivation.
Sourcepub fn attach(&mut self, current_input: TIn)
pub fn attach(&mut self, current_input: TIn)
Attach a physical pot to this parameter.
Call this when switching which parameter the pot controls. Seeds the EMA filter to the current physical position so grab detection starts from a clean state — no cold-start ramp that PassThrough mode could misread as physical movement.
If the parameter value has changed since it was last active (e.g. after a preset
load), call set_virtual_value before attach.
Pair with detach on the outgoing parameter.
Sourcepub fn detach(&mut self)
pub fn detach(&mut self)
Detach the physical pot from this parameter.
If the pot was grabbed (actively tracking this parameter), snapshots the current
physical position into virtual_value so the user must pass through it again to
re-grab on the next attach. If the pot was not yet grabbed
(still waiting to cross the stored value), virtual_value is left unchanged —
it already holds the correct stored parameter value and overwriting it with the
physical position would corrupt it.
Safe to call unconditionally when switching pot control to another parameter.
Pair with attach on the incoming parameter.