public abstract class LXPeriodicModulator extends LXModulator
LXComponent.Placeholder, LXComponent.RenamableLXParameter.Formatter, LXParameter.Polarity, LXParameter.UnitsLXSerializable.Utils| Modifier and Type | Field and Description |
|---|---|
BooleanParameter |
looping
Whether this modulator runs continuously looping.
|
EnumParameter<Tempo.Division> |
tempoDivision |
BooleanParameter |
tempoLock |
BooleanParameter |
tempoSync |
runMs, running, triggercontrolSurfaceSemaphore, KEY_CLASS, KEY_COMPONENT_ID, KEY_ID, KEY_PARAMETER_PATH, KEY_PATH, label, lx, modulationColor| Modifier | Constructor and Description |
|---|---|
protected |
LXPeriodicModulator(String label,
LXParameter period)
Utility constructor with period
|
| Modifier and Type | Method and Description |
|---|---|
protected abstract double |
computeBasis(double basis,
double value)
Implementation method to compute the appropriate basis for a modulator
given its current basis and value.
|
protected double |
computeValue(double deltaMs)
Implementation method to advance the modulator's internal state.
|
protected abstract double |
computeValue(double deltaMs,
double basis)
Implementation method to compute the value of a modulator given its basis.
|
boolean |
finished()
For envelope modulators, which are not looping, this returns true if they
finished on this frame.
|
double |
getBasis()
Accessor for the current basis
|
float |
getBasisf()
Accessor for basis as a float
|
double |
getPeriod() |
float |
getPeriodf() |
void |
load(LX lx,
JsonObject object)
Loads the LX component.
|
boolean |
loop()
Returns true once each time this modulator loops through its starting position.
|
void |
loop(double deltaMs) |
void |
onParameterChanged(LXParameter p)
Subclasses are free to override this if desired.
|
protected void |
onReset()
Optional subclass method when reset happens.
|
void |
onSetValue(double value)
Set the modulator to a certain value in its cycle.
|
LXPeriodicModulator |
randomBasis()
Sets the basis to a random position
|
void |
save(LX lx,
JsonObject object)
Serializes the LX component.
|
LXPeriodicModulator |
setBasis(double basis)
Set the modulator to a certain basis position in its cycle.
|
LXPeriodicModulator |
setLooping(boolean looping)
Sets whether the modulator should loop after it completes a cycle or halt
at the end position.
|
LXPeriodicModulator |
setPeriod(double periodMs)
Modify the period of this modulator
|
LXPeriodicModulator |
setPeriod(LXParameter period)
Sets a parameter to the period of this modulator
|
protected void |
updateBasis(double value)
Updates the basis of the modulator based on present values.
|
getDescription, getFormatter, getIndex, getOscAddress, getOscPath, getPath, getPolarity, getUnits, getValue, getValuef, run, setComponent, setDescription, setFormatter, setIndex, setPolarity, setUnits, setValue, setValue, updateValueisRunning, onStart, onStop, reset, start, stop, toggle, triggeraddArray, addChild, addInternalParameter, addParameter, addParameter, contains, copyParameters, dispose, getChild, getComponentName, getComponentName, getComponentName, getId, getLabel, getLX, getOscLabel, getParameter, getParameters, getParent, handleOscMessage, loadParameters, removeParameter, removeParameter, saveParameters, setParent, toString, toStringclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitdispose, getLabel, isMappable, reset, setMappableget, get, getCanonicalLabel, getCanonicalLabel, getCanonicalPath, getCanonicalPath, getComponent, getComponent, getParameter, getParameter, getParentpublic final BooleanParameter looping
public final BooleanParameter tempoSync
public final EnumParameter<Tempo.Division> tempoDivision
public final BooleanParameter tempoLock
protected LXPeriodicModulator(String label, LXParameter period)
label - Labelperiod - Parameter for periodpublic void onParameterChanged(LXParameter p)
LXComponentonParameterChanged in interface LXParameterListeneronParameterChanged in class LXRunnableComponentp - Parameter that has a value changepublic LXPeriodicModulator setLooping(boolean looping)
looping - Whether to looppublic final double getBasis()
public final float getBasisf()
protected void onReset()
LXRunnableComponentonReset in class LXRunnableComponentpublic final LXPeriodicModulator randomBasis()
public final LXPeriodicModulator setBasis(double basis)
basis - Basis of modulator, from 0-1public void onSetValue(double value)
onSetValue in class LXModulatorvalue - The value to applyprotected final void updateBasis(double value)
value - New value of the modulatorpublic final LXPeriodicModulator setPeriod(double periodMs)
periodMs - New period, in millisecondspublic final double getPeriod()
public final float getPeriodf()
public final LXPeriodicModulator setPeriod(LXParameter period)
period - Parameter for period valuepublic void loop(double deltaMs)
loop in interface LXLoopTaskloop in class LXRunnableComponentprotected final double computeValue(double deltaMs)
LXModulatorcomputeValue in class LXModulatordeltaMs - Number of milliseconds to advance bypublic final boolean loop()
public final boolean finished()
protected abstract double computeValue(double deltaMs,
double basis)
deltaMs - Milliseconds elapsedbasis - Basis of the modulatorprotected abstract double computeBasis(double basis,
double value)
basis - Last basis of modulatorvalue - Current value of modulatorpublic void save(LX lx, JsonObject object)
LXComponentsuper.save(lx, obj)
at the appropriate time.save in interface LXSerializablesave in class LXComponentlx - LX instanceobject - Object to serialize intopublic void load(LX lx, JsonObject object)
LXComponentload in interface LXSerializableload in class LXComponentlx - LX instanceobject - Object to deserializeLX library by Mark C. Slee. © 2012-2020