Class BoundValue
- Namespace
- PluginUI
- Assembly
- PluginUI.dll
One normalized value of a multi-value control (range slider, XY pad, envelope, multi-slider): either stored locally or bound to an IParameter, with the gesture protocol and change notification. Reusable by custom controls that edit several parameters at once.
public sealed class BoundValue
- Inheritance
-
BoundValue
- Inherited Members
Remarks
Call Attach() from OnAttached and Detach() from OnDetached so the binding
follows the host lifetime (no leaked event subscriptions, no gesture left open).
Constructors
BoundValue(Action<BoundValue>, double, double)
Creates a value; changed is called after every change (user, code or parameter).
public BoundValue(Action<BoundValue> changed, double initial = 0, double defaultValue = 0)
Parameters
changedAction<BoundValue>initialdoubledefaultValuedouble
Properties
DefaultValue
Default normalized value (parameter default when bound and not overridden).
public double DefaultValue { get; set; }
Property Value
Formatter
Optional formatter used by Format(double) (normalized → text).
[Browsable(false)]
public Func<double, string>? Formatter { get; set; }
Property Value
IsEditing
true during a gesture.
public bool IsEditing { get; }
Property Value
Parameter
Bound parameter (null = local value).
public IParameter? Parameter { get; set; }
Property Value
StepCount
Discrete steps (parameter's when bound).
public int StepCount { get; set; }
Property Value
Text
Text of the current value.
public string Text { get; }
Property Value
Value
Current normalized value.
public double Value { get; }
Property Value
Methods
Attach()
Subscribes to the parameter (call from the control's OnAttached).
public void Attach()
Begin()
Starts a gesture.
public void Begin()
Detach()
Ends any gesture and unsubscribes (call from the control's OnDetached).
public void Detach()
End()
Ends the gesture.
public void End()
Format(double)
Text of a normalized value (formatter, parameter text with units, or a percentage).
public string Format(double normalized)
Parameters
normalizeddouble
Returns
Quantize(double)
Rounds to the step grid and clamps.
public double Quantize(double normalized)
Parameters
normalizeddouble
Returns
Set(double)
Changes the value (inside a gesture: performEdit; outside: a complete single-step edit).
public void Set(double normalized)
Parameters
normalizeddouble
SetByUser(double)
Complete single-step edit (reset, wheel, keyboard).
public void SetByUser(double normalized)
Parameters
normalizeddouble