Package heronarts.lx.pattern
Class LXPattern
- All Implemented Interfaces:
LXEffect.Container,LXComponent.Renamable,LXLoopTask,LXPath,LXPresetComponent,LXSerializable,LXMidiListener,LXModulationContainer,LXOscComponent,LXParameterListener
- Direct Known Subclasses:
AlternatingPattern,ChasePattern,ChevronPattern,DmxPattern,GeometryTestPattern,GradientPattern,GraphicEqualizerPattern,ImagePattern,LifePattern,LXModelPattern,LXPattern.Placeholder,NoisePattern,OrboxPattern,PlanesPattern,ScriptPattern,SlideshowPattern,SolidPattern,SoundObjectPattern,SparklePattern,TestPattern
public abstract class LXPattern
extends LXDeviceComponent
implements LXComponent.Renamable, LXOscComponent, LXEffect.Container
A pattern is the core object that the animation engine uses to generate
colors for all the points.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfaceListener interface for objects which want to be notified when the pattern's set of effects are modifiedstatic classPlaceholder pattern for when a class is missingclassNested classes/interfaces inherited from class heronarts.lx.LXDeviceComponent
LXDeviceComponent.MidiNested 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.LXSerializable
LXSerializable.Utils -
Field Summary
FieldsModifier and TypeFieldDescriptionfinal CompoundParameterfinal ObjectParameter<LXBlend> final BoundedParameterCustom time for this pattern to cyclefinal BooleanParameterfinal BooleanParameterstatic final Stringfinal LXPattern.Profilerfinal TriggerParameterprotected doubleFields inherited from class heronarts.lx.LXDeviceComponent
automationChildren, controlsExpanded, controlsExpandedAux, controlsExpandedCue, controlSurfaceSemaphore, crashed, DEVICE_CATEGORY_NAME_SORT, DEVICE_VERSION_UNSPECIFIED, KEY_DEVICE_VERSION, midiFilter, modulation, modulationExpanded, remoteControlsChanged, view, viewPriorityFields inherited from class heronarts.lx.LXLayeredComponent
colors, layers, paletteFields inherited from class heronarts.lx.LXModelComponent
modelFields inherited from class heronarts.lx.LXModulatorComponent
modulatorsFields 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
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfinal voidMethod invoked by the mixer engine to notify a pattern that it is going to become activated.final LXPatternfinal voidaddListener(LXPattern.Listener listener) protected final voidapplyEffects(double deltaMs) Clears a timer interval set to this pattern.final voidMethod invoked by the mixer engine to notify a pattern that it is not going to be run.voiddispose()Invoked when a component is being removed from the system and will no longer be used at all.final LXChannelGets the channel that this pattern is loaded in.doubleintgetIndex()getPath()Accessor for the path of this object.booleanhandleOscMessage(OscMessage message, String[] parts, int index) Handles an OSC message sent to this component.final booleanTests whether there is an interval for this pattern.voidinitCompositeDamping(boolean wasActivePattern) final booleanDetermines whether this pattern is eligible to be run at the moment.booleanisHiddenControl(LXParameter parameter) Returns whether this parameter is visible in default remote control or device control UIsfinal booleanTests whether this pattern is in an eligible interval.booleanisSnapshotControl(LXParameter parameter) Returns whether this parameter is stored along with snapshotsvoidload(LX lx, JsonObject obj) Loads the LX component.voidmidiDispatch(LXShortMessage message) Dispatch a MIDI message to this device, and any of its modulators which should receive thatmoveEffect(LXEffect effect, int index) protected voidonActive()Subclasses may override this method.protected voidSubclasses may override this method.protected final voidonLoop(double deltaMs) voidSubclasses may override this method.voidSubclasses may override this method.final LXPatternremoveEffect(LXEffect effect) final voidremoveListener(LXPattern.Listener listener) protected abstract voidrun(double deltaMs) Main pattern loop function.voidsave(LX lx, JsonObject obj) Serializes the LX component.final LXPatternsetAutoCycleEligible(boolean eligible) Sets whether this pattern is eligible for automatic selection.final LXPatternsetChannel(LXChannel channel) Called by the engine when pattern is loaded onto a channel.voidsetIndex(int index) setInterval(int begin, int end) Set an interval during which this pattern is allowed to run.final LXPatternToggles the eligibility state of this pattern.voidvoidupdateCompositeDamping(double deltaMs, boolean dampingOn, double dampingTimeSecs) Methods inherited from class heronarts.lx.LXDeviceComponent
addAutomationChild, addControlSurface, clearCustomRemoteControls, getControlSurfaces, getCrash, getCrashStackTrace, getCustomRemoteControls, getDeviceDescription, getDeviceVersion, getModelView, getModulationEngine, getModulationExpanded, getRemoteControls, loop, removeControlSurface, removeCustomRemoteControl, resetRemoteControls, setCustomRemoteControls, setRemoteControlsMethods 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, subtractColorMethods inherited from class heronarts.lx.LXModelComponent
getModel, onModelChanged, setModelMethods inherited from class heronarts.lx.LXModulatorComponent
addModulator, addModulator, addModulator, addModulator, addModulator, constructProfiler, getModulator, getModulators, moveModulator, removeModulator, startModulatorMethods inherited from class heronarts.lx.LXComponent
addArray, addChild, addInternalParameter, addLegacyInternalParameter, addLegacyParameter, addParameter, addParameter, addParameters, assertDisposed, contains, copyParameters, getCategory, getChild, getComponentDescription, getComponentName, getComponentName, getComponentName, getDescription, getId, getLabel, getLX, getOscAddress, getOscLabel, getOscPath, getParameter, getParameters, getParent, hasParameter, isValidOscParameter, loadParameters, loadPreset, onParameterChanged, 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.effect.LXEffect.Container
addEffect, getEffect, getEffect, loadEffectMethods inherited from interface heronarts.lx.midi.LXMidiListener
aftertouchReceived, controlChangeReceived, midiPanicReceived, noteOffReceived, noteOnReceived, pitchBendReceived, programChangeReceived, sysexReceivedMethods inherited from interface heronarts.lx.osc.LXOscComponent
getOscAddressMethods inherited from interface heronarts.lx.LXPath
getCanonicalLabel, getCanonicalLabel, getCanonicalLabel, getCanonicalLabel, getCanonicalLabel, getCanonicalPath, getCanonicalPath, isDescendantMethods inherited from interface heronarts.lx.LXPresetComponent
getPresetClass, postProcessPreset
-
Field Details
-
enabled
-
recall
-
launch
-
compositeMode
-
compositeLevel
-
hasCustomCycleTime
-
customCycleTimeSecs
Custom time for this pattern to cycle -
runMs
protected double runMs -
profiler
-
mutableEffects
-
effects
-
PATH_EFFECT
- See Also:
-
-
Constructor Details
-
LXPattern
-
-
Method Details
-
addListener
-
removeListener
-
isSnapshotControl
Description copied from class:LXDeviceComponentReturns whether this parameter is stored along with snapshots- Overrides:
isSnapshotControlin classLXDeviceComponent- Parameters:
parameter- Parameter- Returns:
- true if this can be included in snapshots
-
isHiddenControl
Description copied from class:LXDeviceComponentReturns whether this parameter is visible in default remote control or device control UIs- Overrides:
isHiddenControlin classLXDeviceComponent- Parameters:
parameter- Parameter to check- Returns:
- true if this should be hidden by default
-
getPath
Description copied from class:LXComponentAccessor 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:
getPathin interfaceLXPath- Overrides:
getPathin classLXComponent- Returns:
- path of this component relative to its parent
-
updateCompositeBlendOptions
public void updateCompositeBlendOptions() -
setIndex
public void setIndex(int index) -
getIndex
public int getIndex() -
getChannel
Gets the channel that this pattern is loaded in. May be null if the pattern is not yet loaded onto any channel.- Returns:
- Channel pattern is loaded onto
-
setChannel
Called by the engine when pattern is loaded onto a channel. This may only be called once, by the engine. Do not call directly.- Parameters:
channel- Channel pattern is loaded onto- Returns:
- this
-
setInterval
Set an interval during which this pattern is allowed to run. Begin and end times are specified in minutes of the daytime. So midnight corresponds to the value of 0, 360 would be 6:00am, 1080 would be 18:00 (or 6:00pm)- Parameters:
begin- Interval start timeend- Interval end time- Returns:
- this
-
clearInterval
Clears a timer interval set to this pattern.- Returns:
- this
-
hasInterval
public final boolean hasInterval()Tests whether there is an interval for this pattern.- Returns:
- true if there is an interval
-
isInInterval
public final boolean isInInterval()Tests whether this pattern is in an eligible interval.- Returns:
- true if the pattern has an interval, and is currently in it.
-
setAutoCycleEligible
Sets whether this pattern is eligible for automatic selection.- Parameters:
eligible- Whether eligible for auto-rotation- Returns:
- this
-
toggleAutoCycleEligible
Toggles the eligibility state of this pattern.- Returns:
- this
-
isAutoCycleEligible
public final boolean isAutoCycleEligible()Determines whether this pattern is eligible to be run at the moment. A pattern is eligible if its eligibility flag has not been set to false, and if it either has no interval, or is currently in its interval.- Returns:
- True if pattern is eligible to run now
-
initCompositeDamping
public void initCompositeDamping(boolean wasActivePattern) -
updateCompositeDamping
public void updateCompositeDamping(double deltaMs, boolean dampingOn, double dampingTimeSecs) -
getCompositeDampingLevel
public double getCompositeDampingLevel() -
addEffect
- Specified by:
addEffectin interfaceLXEffect.Container
-
removeEffect
- Specified by:
removeEffectin interfaceLXEffect.Container
-
moveEffect
- Specified by:
moveEffectin interfaceLXEffect.Container
-
getEffects
- Specified by:
getEffectsin interfaceLXEffect.Container
-
handleOscMessage
Description copied from class:LXComponentHandles an OSC message sent to this component. By default this method handles registered components and parameters, but subclasses may override this method to handle different types of OSC messages.- Specified by:
handleOscMessagein interfaceLXOscComponent- Overrides:
handleOscMessagein classLXComponent- Parameters:
message- Full OSC message objectparts- The OSC address pattern, broken into an array of partsindex- Which index into the parts array corresponds to this component's children- Returns:
trueif the OSC message was handled and should be considered consumed,falseotherwise
-
onLoop
protected final void onLoop(double deltaMs) - Overrides:
onLoopin classLXLayeredComponent
-
applyEffects
protected final void applyEffects(double deltaMs) - Overrides:
applyEffectsin classLXLayeredComponent
-
run
protected abstract void run(double deltaMs) Main pattern loop function. Invoked in a render loop. Subclasses must implement this function.- Parameters:
deltaMs- Number of milliseconds elapsed since last invocation
-
activate
Method invoked by the mixer engine to notify a pattern that it is going to become activated. Not a user-facing API. -
deactivate
Method invoked by the mixer engine to notify a pattern that it is not going to be run. Not a user-facing API. -
onActive
protected void onActive()Subclasses may override this method. It will be invoked when the pattern is about to become active. Patterns may take care of any initialization needed or reset parameters if desired. -
onInactive
protected void onInactive()Subclasses may override this method. It will be invoked when the pattern is no longer active. Resources may be freed if desired. -
onTransitionStart
public void onTransitionStart()Subclasses may override this method. It will be invoked if a transition into this pattern is taking place. This will be called after onActive. This is not invoked on an already-running pattern. It is only called on the new pattern. -
onTransitionEnd
public void onTransitionEnd()Subclasses may override this method. It will be invoked when the transition into this pattern is complete. -
midiDispatch
Description copied from class:LXDeviceComponentDispatch a MIDI message to this device, and any of its modulators which should receive that- Overrides:
midiDispatchin classLXDeviceComponent- Parameters:
message- Message
-
save
Description copied from class:LXComponentSerializes the LX component. By default, all internal and user-facing parameters are serialized, as well as any explicitly registered child components. Note that child arrays are not serialized, or any other dynamic components. Subclasses may override to perform more saving, and are expected to callsuper.save(lx, obj)at the appropriate time.- Specified by:
savein interfaceLXSerializable- Overrides:
savein classLXDeviceComponent- Parameters:
lx- LX instanceobj- Object to serialize into
-
load
Description copied from class:LXComponentLoads the LX component. Restores the ID of the component, as well as its internal and user-facing parameters. Any explicitly registered children will be automatically loaded, so long as they are direct descendants. Dynamic arrays will not be automatically loaded, this is left to subclasses to implement.- Specified by:
loadin interfaceLXSerializable- Overrides:
loadin classLXDeviceComponent- Parameters:
lx- LX instanceobj- Object to deserialize
-
dispose
public void dispose()Description copied from class:LXComponentInvoked 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:
disposein classLXDeviceComponent
-