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,DJTTMidiFighterTwister.Knob
Simple parameter class with a double value.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumstatic classNested classes/interfaces inherited from interface heronarts.lx.parameter.LXNormalizedParameter
LXNormalizedParameter.OscModeNested classes/interfaces inherited from interface heronarts.lx.parameter.LXParameter
LXParameter.Collection, LXParameter.Formatter, LXParameter.Monitor, LXParameter.MultiMonitor, LXParameter.Polarity, LXParameter.Units -
Field Summary
FieldsFields inherited from class heronarts.lx.parameter.LXListenableParameter
descriptionFields inherited from interface heronarts.lx.LXPath
DEFAULT_SEPARATOR, ROOT, ROOT_PREFIX, ROOT_SLASH -
Constructor Summary
ConstructorsModifierConstructorDescriptionBoundedParameter(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.protectedBoundedParameter(String label, double value, double v0, double v1, LXListenableParameter underlying) -
Method Summary
Modifier and TypeMethodDescriptiondoubleGets a normalized value of the parameter from 0 to 1floatNormalized value as a floatdoublegetRange()Get the range of values for this parameterdoublegetValueFromNormalized(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) booleanSet 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 BoundedParametersetDetents(double[] detents, boolean normalized) setDetentsEnabled(boolean detentEnabled) setDetentsNormalized(double... detents) setExponent(double exponent) setFormatter(LXParameter.Formatter formatter) Sets the formatter used for printing this parameter's valuesetMappable(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-1setOscMode(LXNormalizedParameter.OscMode oscMode) setPolarity(LXParameter.Polarity polarity) setUnits(LXParameter.Units units) setWrappable(boolean wrappable) protected doubleupdateValue(double value) Invoked when the value has changed.Methods inherited from class heronarts.lx.parameter.LXListenableNormalizedParameter
getExponent, getNormalizedWithModulation, getOscMode, incrementNormalized, isWrappableMethods 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, setValue, setValueMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface heronarts.lx.parameter.LXNormalizedParameter
getBaseNormalized, getBaseNormalizedfMethods inherited from interface heronarts.lx.parameter.LXParameter
dispose, getBaseValue, getBaseValuef, getFormatter, getLabel, getParentParameter, getPolarity, getUnits, getValue, getValuef, isMappable, setComponent, setValueMethods inherited from interface heronarts.lx.LXPath
getCanonicalLabel, getCanonicalLabel, getCanonicalLabel, 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:
setWrappablein classLXListenableNormalizedParameter
-
setMappable
Description copied from interface:LXParameterSets whether this parameter should be eligible for MIDI/modulation mapping or not.- Specified by:
setMappablein interfaceLXParameter- Overrides:
setMappablein classLXListenableParameter- Parameters:
mappable- Whether parameter should be available for mapping- Returns:
- this
-
setFormatter
Description copied from interface:LXParameterSets the formatter used for printing this parameter's value- Specified by:
setFormatterin interfaceLXParameter- Overrides:
setFormatterin classLXListenableParameter- Parameters:
formatter- Formatter- Returns:
- The parameter
-
setUnits
- Overrides:
setUnitsin classLXListenableNormalizedParameter
-
setDescription
- Overrides:
setDescriptionin classLXListenableParameter
-
setPolarity
- Overrides:
setPolarityin classLXListenableParameter
-
setExponent
- Overrides:
setExponentin classLXListenableNormalizedParameter
-
setNormalizationCurve
-
setOscMode
- Overrides:
setOscModein classLXListenableNormalizedParameter
-
getNormalizationCurve
-
isDetentEnabled
public boolean isDetentEnabled() -
setDetentsEnabled
-
setDetents
-
setDetentsNormalized
-
setDetents
-
reset
Description copied from interface:LXParameterA method to reset the value of the parameter, if a default is available. Not necessarily defined for all parameters, may be ignored.- Specified by:
resetin interfaceLXParameter- Overrides:
resetin classLXListenableParameter- Returns:
- this
-
incrementValue
- Overrides:
incrementValuein 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:
incrementNormalizedin 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:LXNormalizedParameterGet 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:LXListenableParameterInvoked when the value has changed. Subclasses should update any special internal state according to this new value.- Specified by:
updateValuein classLXListenableParameter- Parameters:
value- New value- Returns:
- this
-