Package heronarts.lx.parameter
Class BoundedParameter
java.lang.Object
heronarts.lx.parameter.LXListenableParameter
heronarts.lx.parameter.LXListenableNormalizedParameter
heronarts.lx.parameter.BoundedParameter
- All Implemented Interfaces:
LXPath
,LXNormalizedParameter
,LXParameter
- Direct Known Subclasses:
CompoundParameter
Simple parameter class with a double value.
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic enum
static class
Nested classes/interfaces inherited from interface heronarts.lx.parameter.LXNormalizedParameter
LXNormalizedParameter.OscMode
Nested classes/interfaces inherited from interface heronarts.lx.parameter.LXParameter
LXParameter.Collection, LXParameter.Formatter, LXParameter.Monitor, LXParameter.MultiMonitor, LXParameter.Polarity, LXParameter.Units
-
Field Summary
Fields inherited from class heronarts.lx.parameter.LXListenableParameter
description
Fields inherited from interface heronarts.lx.LXPath
ROOT, ROOT_PREFIX, ROOT_SLASH
-
Constructor Summary
ModifierConstructorDescriptionBoundedParameter
(LXListenableParameter underlying, double v0, double v1) Creates a BoundedParameter which limits the value of an underlying MutableParameter to a given range.BoundedParameter
(String label) Labeled parameter with value of 0 and range of 0-1BoundedParameter
(String label, double value) A bounded parameter with label and value, initial value of 0 and a range of 0-1BoundedParameter
(String label, double value, double max) A bounded parameter with an initial value, and range from 0 to maxBoundedParameter
(String label, double value, double v0, double v1) A bounded parameter with initial value and range from v0 to v1.protected
BoundedParameter
(String label, double value, double v0, double v1, LXListenableParameter underlying) -
Method Summary
Modifier and TypeMethodDescriptiondouble
Gets a normalized value of the parameter from 0 to 1float
Normalized value as a floatdouble
getRange()
Get the range of values for this parameterdouble
getValueFromNormalized
(double normalized) Get the equivalent raw parameter value from a normalized valueincrementDetentTicks
(boolean increase) incrementDetentTicks
(boolean increase, boolean wrap) incrementNormalized
(double amount, boolean wrap) incrementValue
(double amount) incrementValue
(double amount, boolean wrap) boolean
Set the parameter to the next detent valuenextDetent
(boolean wrap) Set the parameter to the next detent value, with wrapping specifiedSet the parameter to the previous detent valueprevDetent
(boolean wrap) Set the parameter to the previous detent value, with wrapping specifiedreset()
A method to reset the value of the parameter, if a default is available.setDescription
(String description) setDetents
(double... detents) protected BoundedParameter
setDetents
(double[] detents, boolean normalized) setDetentsEnabled
(boolean detentEnabled) setDetentsNormalized
(double... detents) setExponent
(double exponent) setMappable
(boolean mappable) Sets whether this parameter should be eligible for MIDI/modulation mapping or not.setNormalized
(double normalized) Sets the value of parameter using normal 0-1setPolarity
(LXParameter.Polarity polarity) setUnits
(LXParameter.Units units) setWrappable
(boolean wrappable) protected double
updateValue
(double value) Invoked when the value has changed.Methods inherited from class heronarts.lx.parameter.LXListenableNormalizedParameter
getExponent, getNormalizedWithModulation, getOscMode, incrementNormalized, isWrappable, setOscMode
Methods inherited from class heronarts.lx.parameter.LXListenableParameter
addListener, addListener, bang, dispose, getDescription, getFormatter, getLabel, getParent, getParentParameter, getPath, getPolarity, getUnits, getValue, isDefault, isMappable, removeListener, reset, setComponent, setFormatter, setValue, setValue
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface heronarts.lx.parameter.LXNormalizedParameter
getBaseNormalized, getBaseNormalizedf
Methods inherited from interface heronarts.lx.parameter.LXParameter
dispose, getBaseValue, getBaseValuef, getFormatter, getLabel, getParentParameter, getPolarity, getUnits, getValue, getValuef, isMappable, setComponent, setFormatter, setValue
Methods inherited from interface heronarts.lx.LXPath
getCanonicalLabel, getCanonicalLabel, getCanonicalPath, getCanonicalPath, getDescription, getParent, getPath, isDescendant
-
Field Details
-
range
Range of the parameter
-
-
Constructor Details
-
BoundedParameter
Labeled parameter with value of 0 and range of 0-1- Parameters:
label
- Label for parameter
-
BoundedParameter
A bounded parameter with label and value, initial value of 0 and a range of 0-1- Parameters:
label
- Labelvalue
- value
-
BoundedParameter
A bounded parameter with an initial value, and range from 0 to max- Parameters:
label
- Labelvalue
- valuemax
- Maximum value
-
BoundedParameter
A bounded parameter with initial value and range from v0 to v1. Note that it is not necessary for v0 to be less than v1, if it is desired for the knob's value to progress negatively.- Parameters:
label
- Labelvalue
- Initial valuev0
- Start of rangev1
- End of range
-
BoundedParameter
Creates a BoundedParameter which limits the value of an underlying MutableParameter to a given range. Changes to the BoundedParameter are forwarded to the MutableParameter, and vice versa. If the MutableParameter is set to a value outside the specified bounds, this BoundedParmaeter will ignore the update and the values will be inconsistent. The typical use of this mode is to create a parameter suitable for limited-range UI control of a parameter, typically a MutableParameter.- Parameters:
underlying
- The underlying parameterv0
- Beginning of rangev1
- End of range
-
BoundedParameter
protected BoundedParameter(String label, double value, double v0, double v1, LXListenableParameter underlying)
-
-
Method Details
-
setWrappable
- Overrides:
setWrappable
in classLXListenableNormalizedParameter
-
setMappable
Description copied from interface:LXParameter
Sets whether this parameter should be eligible for MIDI/modulation mapping or not.- Specified by:
setMappable
in interfaceLXParameter
- Overrides:
setMappable
in classLXListenableParameter
- Parameters:
mappable
- Whether parameter should be available for mapping- Returns:
- this
-
setUnits
- Overrides:
setUnits
in classLXListenableNormalizedParameter
-
setDescription
- Overrides:
setDescription
in classLXListenableParameter
-
setPolarity
- Overrides:
setPolarity
in classLXListenableParameter
-
setExponent
- Overrides:
setExponent
in classLXListenableNormalizedParameter
-
setNormalizationCurve
-
getNormalizationCurve
-
isDetentEnabled
public boolean isDetentEnabled() -
setDetentsEnabled
-
setDetents
-
setDetentsNormalized
-
setDetents
-
reset
Description copied from interface:LXParameter
A method to reset the value of the parameter, if a default is available. Not necessarily defined for all parameters, may be ignored.- Specified by:
reset
in interfaceLXParameter
- Overrides:
reset
in classLXListenableParameter
- Returns:
- this
-
incrementValue
- Overrides:
incrementValue
in classLXListenableParameter
-
incrementValue
-
setNormalized
Sets the value of parameter using normal 0-1- Parameters:
normalized
- Value from 0-1 through the parameter range- Returns:
- this, for method chaining
-
incrementDetentTicks
-
incrementDetentTicks
-
incrementNormalized
- Overrides:
incrementNormalized
in classLXListenableNormalizedParameter
-
nextDetent
Set the parameter to the next detent value- Returns:
- this
-
nextDetent
Set the parameter to the next detent value, with wrapping specified- Parameters:
wrap
- Whether wrapping is enabled- Returns:
- this
-
prevDetent
Set the parameter to the previous detent value- Returns:
- this
-
prevDetent
Set the parameter to the previous detent value, with wrapping specified- Parameters:
wrap
- Whether wrapping is enabled- Returns:
- this
-
getRange
public double getRange()Get the range of values for this parameter- Returns:
- range from min and max
-
getNormalized
public double getNormalized()Gets a normalized value of the parameter from 0 to 1- Returns:
- Normalized value, from 0 to 1
-
getValueFromNormalized
public double getValueFromNormalized(double normalized) Description copied from interface:LXNormalizedParameter
Get the equivalent raw parameter value from a normalized value- Parameters:
normalized
- Normalized value- Returns:
- The equivalent raw value
-
getNormalizedf
public float getNormalizedf()Normalized value as a float- Returns:
- Normalized value from 0-1 as a float
-
updateValue
protected double updateValue(double value) Description copied from class:LXListenableParameter
Invoked when the value has changed. Subclasses should update any special internal state according to this new value.- Specified by:
updateValue
in classLXListenableParameter
- Parameters:
value
- New value- Returns:
- this
-