Package heronarts.lx.effect
Class LXEffect
- All Implemented Interfaces:
LXComponent.Renamable
,LXLoopTask
,LXPath
,LXPresetComponent
,LXSerializable
,LXMidiListener
,LXModulationContainer
,LXOscComponent
,LXParameterListener
- Direct Known Subclasses:
BlurEffect
,ColorizeEffect
,ColorMaskEffect
,DynamicsEffect
,GateEffect
,HueSaturationEffect
,ImageMaskEffect
,InvertEffect
,LXEffect.Placeholder
,LXModelEffect
,ScriptEffect
,SoundObjectEffect
,SparkleEffect
,StrobeEffect
public abstract class LXEffect
extends LXDeviceComponent
implements LXComponent.Renamable, LXOscComponent
Class to represent an effect that may be applied to the color array. Effects
may be stateless or stateful, though typically they operate on a single
frame. Only the current frame is provided at runtime.
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
Placeholder pattern for when a class is missingclass
Nested classes/interfaces inherited from class heronarts.lx.LXDeviceComponent
LXDeviceComponent.Midi
Nested classes/interfaces inherited from class heronarts.lx.LXComponent
LXComponent.Hidden, LXComponent.Renamable
Nested classes/interfaces inherited from interface heronarts.lx.LXSerializable
LXSerializable.Utils
-
Field Summary
Modifier and TypeFieldDescriptionfinal BooleanParameter
protected final LinearEnvelope
protected final MutableParameter
protected final MutableParameter
protected boolean
final LXEffect.Profiler
Fields inherited from class heronarts.lx.LXDeviceComponent
controlsExpanded, controlsExpandedAux, controlsExpandedCue, controlSurfaceSemaphore, crashed, DEVICE_CATEGORY_NAME_SORT, DEVICE_VERSION_UNSPECIFIED, KEY_DEVICE_VERSION, midiFilter, modulation, modulationExpanded, remoteControlsChanged, view, viewPriority
Fields inherited from class heronarts.lx.LXLayeredComponent
colors, layers, palette
Fields inherited from class heronarts.lx.LXModelComponent
model
Fields inherited from class heronarts.lx.LXModulatorComponent
modulators
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 TypeMethodDescriptionfinal LXEffect
disable()
Disables the effect.void
dispose()
Invoked when a component is being removed from the system and will no longer be used at all.final LXEffect
enable()
Enables the effect.getBus()
final int
getIndex()
Gets the index of this effect in the channel FX bus.getPath()
Accessor for the path of this object.boolean
final boolean
boolean
isHiddenControl
(LXParameter parameter) Returns whether this parameter is visible in default remote control or device control UIsboolean
protected void
protected void
onEnable()
final void
onLoop
(double deltaMs) Applies this effect to the current frameprotected abstract void
run
(double deltaMs, double enabledAmount) Implementation of the effect.final LXEffect
setDamping
(boolean hasDamping) Sets whether this effect uses damping or notsetDampingTime
(double dampingTimeMs) Set the amount of damping time used when this effect is enabled and disabled.protected LXEffect
setDampingTime
(double dampingTimeEnabledMs, double dampingTimeDisabledMs) Set the amount of damping time used when this effect is enabled and disabled.final LXEffect
setIndex
(int index) Called by the engine to assign index on this effect.final LXEffect
setPattern
(LXPattern pattern) final LXEffect
toggle()
Toggles the effect.Methods inherited from class heronarts.lx.LXDeviceComponent
addControlSurface, clearCustomRemoteControls, getControlSurfaces, getCrash, getCrashStackTrace, getCustomRemoteControls, getDeviceVersion, getModulationEngine, getRemoteControls, isSnapshotControl, load, loop, midiDispatch, removeControlSurface, removeCustomRemoteControl, resetRemoteControls, save, setCustomRemoteControls, setRemoteControls
Methods inherited from class heronarts.lx.LXLayeredComponent
addColor, addColor, addLayer, afterLayers, blendColor, blendColor, clearColors, getBuffer, getColor, getColor, getColors, getLayers, removeLayer, setBuffer, setBuffer, setColor, setColor, setColor, setColors, subtractColor
Methods inherited from class heronarts.lx.LXModelComponent
getModel, onModelChanged, setModel
Methods inherited from class heronarts.lx.LXModulatorComponent
addModulator, addModulator, addModulator, addModulator, addModulator, constructProfiler, getModulator, getModulators, moveModulator, removeModulator, startModulator
Methods inherited from class heronarts.lx.LXComponent
addArray, addChild, addInternalParameter, addLegacyInternalParameter, addLegacyParameter, addParameter, addParameter, addParameters, contains, copyParameters, getCategory, getChild, getComponentName, getComponentName, getComponentName, getDescription, getId, getLabel, getLX, getOscAddress, getOscLabel, getOscPath, getParameter, getParameters, getParent, handleOscMessage, hasParameter, isValidOscParameter, loadParameters, loadPreset, onParameterChanged, removeParameter, removeParameter, removeParameter, removeParameter, 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.midi.LXMidiListener
aftertouchReceived, controlChangeReceived, noteOffReceived, noteOnReceived, pitchBendReceived, programChangeReceived
Methods inherited from interface heronarts.lx.osc.LXOscComponent
getOscAddress, handleOscMessage
Methods inherited from interface heronarts.lx.LXPath
getCanonicalLabel, getCanonicalLabel, getCanonicalPath, getCanonicalPath, isDescendant
Methods inherited from interface heronarts.lx.LXPresetComponent
getPresetClass, postProcessPreset
-
Field Details
-
enabled
-
hasDamping
protected boolean hasDamping -
enabledDampingAttack
-
enabledDampingRelease
-
enabledDamped
-
profiler
-
-
Constructor Details
-
LXEffect
-
-
Method Details
-
isHiddenControl
Description copied from class:LXDeviceComponent
Returns whether this parameter is visible in default remote control or device control UIs- Overrides:
isHiddenControl
in classLXDeviceComponent
- Parameters:
parameter
- Parameter to check- Returns:
- true if this should be hidden by default
-
setDamping
Sets whether this effect uses damping or not- Parameters:
hasDamping
- If true, damping employed when effect is turned on/off- Returns:
- this
-
setDampingTime
Set the amount of damping time used when this effect is enabled and disabled.- Parameters:
dampingTimeMs
- Damping time in milliseconds- Returns:
- this
-
setDampingTime
Set the amount of damping time used when this effect is enabled and disabled.- Parameters:
dampingTimeEnabledMs
- Damping time in milliseconds when effect enableddampingTimeDisabledMs
- Damping time in milliseconds when effect disabled- Returns:
- this
-
getModelView
- Overrides:
getModelView
in classLXDeviceComponent
-
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
-
setIndex
Called by the engine to assign index on this effect. Should never be called otherwise.- Parameters:
index
- Effect index- Returns:
- this
-
getIndex
public final int getIndex()Gets the index of this effect in the channel FX bus.- Returns:
- index of this effect in the channel FX bus
-
setBus
-
isBusEffect
public boolean isBusEffect() -
isPatternEffect
public boolean isPatternEffect() -
getBus
-
setPattern
-
getPattern
-
isEnabled
public final boolean isEnabled()- Returns:
- whether the effect is currently enabled
-
toggle
Toggles the effect.- Returns:
- this
-
enable
Enables the effect.- Returns:
- this
-
disable
Disables the effect.- Returns:
- this
-
onEnable
protected void onEnable() -
onDisable
protected void onDisable() -
onLoop
public final void onLoop(double deltaMs) Applies this effect to the current frame- Overrides:
onLoop
in classLXLayeredComponent
- Parameters:
deltaMs
- Milliseconds since last frame
-
run
protected abstract void run(double deltaMs, double enabledAmount) Implementation of the effect. Subclasses need to override this to implement their functionality.- Parameters:
deltaMs
- Number of milliseconds elapsed since last invocationenabledAmount
- The amount of the effect to apply, scaled from 0-1
-
dispose
public void dispose()Description copied from class:LXComponent
Invoked when a component is being removed from the system and will no longer be used at all. This unregisters the component and should free up any resources and parameter listeners. Ideally after this method is called the object should be eligible for garbage collection. Subclasses are generally expected to override this method to handle their particular cleanup work. They should also generally callsuper.dispose()
at the appropriate time to perform the basic cleanup, which may need to happen either before or after cleaning up other objects.- Overrides:
dispose
in classLXDeviceComponent
-