Package heronarts.lx.modulator
Class LXModulator
java.lang.Object
heronarts.lx.LXComponent
heronarts.lx.LXRunnableComponent
heronarts.lx.modulator.LXModulator
- All Implemented Interfaces:
LXComponent.Renamable
,LXLoopTask
,LXPath
,LXSerializable
,LXParameter
,LXParameterListener
- Direct Known Subclasses:
AbstractDmxModulator
,Accelerator
,Accumulator
,AHDSREnvelope
,BandGate
,BooleanLogic
,ComparatorModulator
,DampedParameter
,Damper
,DecibelMeter
,FocusedPatternControls
,HistoryBuffer
,LXModulator.Placeholder
,LXPeriodicModulator
,MacroKnobs
,MacroSwitches
,MacroTriggers
,MidiNoteTrigger
,MultiTrig
,NoiseModulator
,OperatorModulator
,Scaler
,Smoother
,SoundObject
,Spring
,Timer
public abstract class LXModulator
extends LXRunnableComponent
implements LXComponent.Renamable, LXParameter
A Modulator is an abstraction for a variable with a value that varies over
time, such as an envelope or a low frequency oscillator. Some modulators run
continuously, others may halt after they reach a certain value.
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic @interface
A market annotation which enables a registered modulator to appear in the device sectionstatic @interface
A market annotation which enables a registered modulator to appear in the global sectionstatic class
Placeholder pattern for when a class is missingNested classes/interfaces inherited from class heronarts.lx.LXComponent
LXComponent.Hidden, LXComponent.Renamable
Nested classes/interfaces inherited from interface heronarts.lx.parameter.LXParameter
LXParameter.Collection, LXParameter.Formatter, LXParameter.Monitor, LXParameter.MultiMonitor, LXParameter.Polarity, LXParameter.Units
Nested classes/interfaces inherited from interface heronarts.lx.LXSerializable
LXSerializable.Utils
-
Field Summary
Fields inherited from class heronarts.lx.LXRunnableComponent
runMs, running, trigger
Fields inherited from class heronarts.lx.LXComponent
children, internalParameters, KEY_CHILDREN, KEY_CLASS, KEY_COMPONENT_ID, KEY_ID, KEY_INTERNAL, KEY_PARAMETER_PATH, KEY_PARAMETERS, KEY_PATH, KEY_RESET, label, legacyInternalParameters, legacyParameters, lx, modulationColor, modulationControlsExpanded, modulationsExpanded, parameters, presetFile
Fields inherited from interface heronarts.lx.LXPath
ROOT, ROOT_PREFIX, ROOT_SLASH
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Auto start a newly created modulator.protected abstract double
computeValue
(double deltaMs) Implementation method to advance the modulator's internal state.protected LXModulator
getCrash()
Gets the formatter to be used for printing this parameter's valueint
getIndex()
Returns the ordering index of this modulator in its parentGets the OSC address for this objectAccessor for this component's OSC path relative to its parent.getPath()
Accessor for the path of this object.Gets the polarity of this parameter.getUnits()
Gets the unit format that this parameter's value stores.final double
getValue()
Retrieves the current value of the modulator in full precisionboolean
void
loop
(double deltaMs) protected void
onSetValue
(double value) Subclasses may override when actions are necessary on value change.protected final void
run
(double deltaMs) Applies updates to the modulator for the specified number of milliseconds.setComponent
(LXComponent component, String path) Sets the component that owns this parametersetFormatter
(LXParameter.Formatter formatter) Sets the formatter used for printing this parameter's valuesetIndex
(int index) Sets the index of this modulator in its parent listsetMappingSource
(boolean isMappingSource) setPolarity
(LXParameter.Polarity polarity) setUnits
(LXParameter.Units units) final LXModulator
setValue
(double value) Set the modulator to a certain value in its cycle.protected final LXModulator
setValue
(double value, boolean notify) protected final LXModulator
updateValue
(double value) Helper for subclasses to update value in situations where it needs to be recomputed.Methods inherited from class heronarts.lx.LXRunnableComponent
isRunning, onParameterChanged, onReset, onStart, onStop, onTrigger, postRun, reset, start, stop, toggle, trigger
Methods inherited from class heronarts.lx.LXComponent
addArray, addChild, addInternalParameter, addLegacyInternalParameter, addLegacyParameter, addParameter, addParameter, addParameters, contains, copyParameters, dispose, getCategory, getChild, getComponentName, getComponentName, getComponentName, getDescription, getId, getLabel, getLX, getOscLabel, getParameter, getParameters, getParent, handleOscMessage, hasParameter, isValidOscParameter, load, loadParameters, loadPreset, removeParameter, removeParameter, removeParameter, removeParameter, save, savePreset, setDescription, setParent, toOscQuery, toOscQuery, toOscQuery, toString, toString
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface heronarts.lx.parameter.LXParameter
dispose, getBaseValue, getBaseValuef, getLabel, getParentParameter, getValuef, isMappable, reset, setMappable
Methods inherited from interface heronarts.lx.LXPath
getCanonicalLabel, getCanonicalLabel, getCanonicalPath, getCanonicalPath, getDescription, getParent, isDescendant
-
Field Details
-
crashed
-
midiFilter
-
-
Constructor Details
-
LXModulator
Utility default constructor- Parameters:
label
- Label
-
-
Method Details
-
getCrash
-
getCrashStackTrace
-
disableAutoStart
-
setIndex
Sets the index of this modulator in its parent list- Parameters:
index
- Modulator index- Returns:
- this
-
getIndex
public int getIndex()Returns the ordering index of this modulator in its parent- Returns:
- Modulator index
-
getOscPath
Description copied from class:LXComponent
Accessor for this component's OSC path relative to its parent. This by default is no different fromLXComponent.getPath()
, but certain subclasses may modify this to support different types of OSC paths that aren't required to match the LX hierarchy.- Overrides:
getOscPath
in classLXComponent
- Returns:
- Path that this object can be accessed via OSC
-
getOscAddress
Description copied from class:LXComponent
Gets the OSC address for this object- Overrides:
getOscAddress
in classLXComponent
- Returns:
- Full OSC address for this component
-
setComponent
Description copied from interface:LXParameter
Sets the component that owns this parameter- Specified by:
setComponent
in interfaceLXParameter
- Parameters:
component
- Componentpath
- Path name for parameter- Returns:
- this
-
getPath
Description copied from class:LXComponent
Accessor for the path of this object. Returns the path this component was registered with. Some subclasses may override this if path structure is dynamic.- Specified by:
getPath
in interfaceLXPath
- Overrides:
getPath
in classLXComponent
- Returns:
- path of this component relative to its parent
-
setFormatter
Description copied from interface:LXParameter
Sets the formatter used for printing this parameter's value- Specified by:
setFormatter
in interfaceLXParameter
- Parameters:
formatter
- Formatter- Returns:
- The parameter
-
getFormatter
Description copied from interface:LXParameter
Gets the formatter to be used for printing this parameter's value- Specified by:
getFormatter
in interfaceLXParameter
- Returns:
- Formatter
-
setUnits
-
getUnits
Description copied from interface:LXParameter
Gets the unit format that this parameter's value stores.- Specified by:
getUnits
in interfaceLXParameter
- Returns:
- Units
-
setPolarity
-
getPolarity
Description copied from interface:LXParameter
Gets the polarity of this parameter.- Specified by:
getPolarity
in interfaceLXParameter
- Returns:
- polarity of this parameter
-
setMappingSource
-
isMappingSource
public boolean isMappingSource() -
getValue
public final double getValue()Retrieves the current value of the modulator in full precision- Specified by:
getValue
in interfaceLXParameter
- Returns:
- Current value of the modulator
-
setValue
Set the modulator to a certain value in its cycle.- Specified by:
setValue
in interfaceLXParameter
- Parameters:
value
- The value to apply- Returns:
- This modulator, for method chaining
-
setValue
-
onSetValue
protected void onSetValue(double value) Subclasses may override when actions are necessary on value change.- Parameters:
value
- New value
-
updateValue
Helper for subclasses to update value in situations where it needs to be recomputed. This cannot be overriden, and subclasses may assume that it ONLY updates the internal value without triggering any other recomputations.- Parameters:
value
- Value for modulator- Returns:
- this, for method chaining
-
autostart
public void autostart()Auto start a newly created modulator. Can be overriden by subclasses -
loop
public void loop(double deltaMs) - Specified by:
loop
in interfaceLXLoopTask
- Overrides:
loop
in classLXRunnableComponent
-
run
protected final void run(double deltaMs) Applies updates to the modulator for the specified number of milliseconds. This method is invoked by the core engine.- Specified by:
run
in classLXRunnableComponent
- Parameters:
deltaMs
- Milliseconds to advance by
-
computeValue
protected abstract double computeValue(double deltaMs) Implementation method to advance the modulator's internal state. Subclasses must provide and update value appropriately.- Parameters:
deltaMs
- Number of milliseconds to advance by- Returns:
- Computed value
-