Package heronarts.lx.modulator
Class FunctionalModulator
java.lang.Object
heronarts.lx.LXComponent
heronarts.lx.LXRunnableComponent
heronarts.lx.modulator.LXModulator
heronarts.lx.modulator.LXPeriodicModulator
heronarts.lx.modulator.LXRangeModulator
heronarts.lx.modulator.FunctionalModulator
- All Implemented Interfaces:
LXComponent.Renamable,LXLoopTask,LXPath,LXSerializable,LXNormalizedParameter,LXParameter,LXParameterListener
An extendable modulator class that lets a custom normalized function be
supplied by simply extending this class and supplying a compute() and
invert() method.
-
Nested Class Summary
Nested classes/interfaces inherited from class heronarts.lx.modulator.LXModulator
LXModulator.Device, LXModulator.Global, LXModulator.PlaceholderNested classes/interfaces inherited from class heronarts.lx.LXComponent
LXComponent.Description, LXComponent.Hidden, LXComponent.Name, LXComponent.PluginRequired, LXComponent.RenamableNested 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.UnitsNested classes/interfaces inherited from interface heronarts.lx.LXSerializable
LXSerializable.Utils -
Field Summary
Fields inherited from class heronarts.lx.modulator.LXPeriodicModulator
looping, tempoDivision, tempoLock, tempoSyncFields inherited from class heronarts.lx.modulator.LXModulator
crashed, midiFilter, midiSourceFields inherited from class heronarts.lx.LXRunnableComponent
runMs, running, triggerFields inherited from class heronarts.lx.LXComponent
childArrays, 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, presetFileFields inherited from interface heronarts.lx.LXPath
DEFAULT_SEPARATOR, ROOT, ROOT_PREFIX, ROOT_SLASH -
Constructor Summary
ConstructorsConstructorDescriptionFunctionalModulator(double startValue, double endValue, double periodMs) FunctionalModulator(double startValue, double endValue, LXParameter periodMs) FunctionalModulator(double startValue, LXParameter endValue, double periodMs) FunctionalModulator(double startValue, LXParameter endValue, LXParameter periodMs) FunctionalModulator(LXParameter startValue, double endValue, double periodMs) FunctionalModulator(LXParameter startValue, double endValue, LXParameter periodMs) FunctionalModulator(LXParameter startValue, LXParameter endValue, double periodMs) FunctionalModulator(LXParameter startValue, LXParameter endValue, LXParameter periodMs) FunctionalModulator(String label, double startValue, double endValue, double periodMs) FunctionalModulator(String label, double startValue, double endValue, LXParameter periodMs) FunctionalModulator(String label, double startValue, LXParameter endValue, double periodMs) FunctionalModulator(String label, double startValue, LXParameter endValue, LXParameter periodMs) FunctionalModulator(String label, LXParameter startValue, double endValue, double periodMs) FunctionalModulator(String label, LXParameter startValue, double endValue, LXParameter periodMs) FunctionalModulator(String label, LXParameter startValue, LXParameter endValue, double periodMs) FunctionalModulator(String label, LXParameter startValue, LXParameter endValue, LXParameter periodMs) -
Method Summary
Modifier and TypeMethodDescriptionabstract doublecompute(double basis) Subclasses override this method to compute the value of the function.protected doublecomputeNormalizedBasis(double basis, double normalizedValue) Subclasses determine the basis based on a normalized value from 0 to 1.protected doublecomputeNormalizedValue(double deltaMs, double basis) Subclasses implement this which returns their value from a 0-1 scale.doubleinvert(double basis, double value) Subclasses optionally override this method to support inversion of the value to a basis.Methods inherited from class heronarts.lx.modulator.LXRangeModulator
computeBasis, computeValue, getExponent, getNormalized, getNormalizedf, onSetValue, setEndValue, setEndValue, setExponent, setNormalized, setRange, setRange, setRangeFromHereTo, setRangeFromHereTo, setStartValue, setStartValueMethods inherited from class heronarts.lx.modulator.LXPeriodicModulator
computeValue, disableAutoReset, finished, getBasis, getBasisf, getPeriod, getPeriodf, load, loop, loop, numLoops, onParameterChanged, onReset, randomBasis, save, setBasis, setLooping, setPeriod, setPeriod, updateBasisMethods inherited from class heronarts.lx.modulator.LXModulator
autostart, disableAutoStart, getCrash, getCrashStackTrace, getFormatter, getIndex, getOscAddress, getOscPath, getPath, getPolarity, getUnits, getValue, isMappingSource, run, setComponent, setFormatter, setIndex, setMappingSource, setPolarity, setUnits, setValue, setValue, updateValueMethods inherited from class heronarts.lx.LXRunnableComponent
isRunning, onStart, onStop, onTrigger, postRun, reset, start, stop, toggle, triggerMethods inherited from class heronarts.lx.LXComponent
addArray, addChild, addInternalParameter, addLegacyInternalParameter, addLegacyParameter, addParameter, addParameter, addParameters, assertDisposed, contains, copyParameters, dispose, getCategory, getChild, getComponentDescription, getComponentName, getComponentName, getComponentName, getDescription, getId, getLabel, getLX, getOscLabel, getParameter, getParameters, getParent, handleOscMessage, hasParameter, isValidOscParameter, loadParameters, loadPreset, removeParameter, removeParameter, removeParameter, removeParameter, savePreset, setDescription, setParent, toOscQuery, toOscQuery, toOscQuery, toString, toStringMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface heronarts.lx.parameter.LXNormalizedParameter
getBaseNormalized, getBaseNormalizedf, getOscMode, getValueFromNormalized, isWrappableMethods inherited from interface heronarts.lx.parameter.LXParameter
dispose, getBaseValue, getBaseValuef, getFormatter, getLabel, getParentParameter, getPolarity, getUnits, getValue, getValuef, isMappable, reset, setComponent, setFormatter, setMappable, setValueMethods inherited from interface heronarts.lx.LXPath
getCanonicalLabel, getCanonicalLabel, getCanonicalLabel, getCanonicalLabel, getCanonicalLabel, getCanonicalPath, getCanonicalPath, getDescription, getParent, getPath, isDescendant
-
Constructor Details
-
FunctionalModulator
public FunctionalModulator(double startValue, double endValue, double periodMs) -
FunctionalModulator
-
FunctionalModulator
-
FunctionalModulator
-
FunctionalModulator
-
FunctionalModulator
-
FunctionalModulator
-
FunctionalModulator
-
FunctionalModulator
-
FunctionalModulator
-
FunctionalModulator
-
FunctionalModulator
-
FunctionalModulator
public FunctionalModulator(String label, LXParameter startValue, LXParameter endValue, double periodMs) -
FunctionalModulator
public FunctionalModulator(String label, LXParameter startValue, double endValue, LXParameter periodMs) -
FunctionalModulator
public FunctionalModulator(String label, double startValue, LXParameter endValue, LXParameter periodMs) -
FunctionalModulator
public FunctionalModulator(String label, LXParameter startValue, LXParameter endValue, LXParameter periodMs)
-
-
Method Details
-
computeNormalizedValue
protected double computeNormalizedValue(double deltaMs, double basis) Description copied from class:LXRangeModulatorSubclasses implement this which returns their value from a 0-1 scale. This class automatically takes care of scaling to the startValue/endValue range.- Specified by:
computeNormalizedValuein classLXRangeModulator- Parameters:
deltaMs- Milliseconds elapsedbasis- Basis of modulator- Returns:
- Modulator value
-
computeNormalizedBasis
protected double computeNormalizedBasis(double basis, double normalizedValue) Subclasses determine the basis based on a normalized value from 0 to 1.- Specified by:
computeNormalizedBasisin classLXRangeModulator- Parameters:
basis- Modulator basisnormalizedValue- A normalize value from 0 to 1- Returns:
- Computed normalized basis for modulator
-
compute
public abstract double compute(double basis) Subclasses override this method to compute the value of the function. Basis is a value from 0-1, the result must be a value from 0-1.- Parameters:
basis- Basis of modulator- Returns:
- Computed value for given basis
-
invert
public double invert(double basis, double value) Subclasses optionally override this method to support inversion of the value to a basis. This is not well-defined for all functions. If it is not implemented, an UnsupportedOperationException may be thrown at runtime on invocations to methods that would directly change the value or bounds of the function.- Parameters:
basis- Previous basis, from 0-1value- New value from 0-1- Returns:
- New basis, from 0-1
-