Package heronarts.lx.snapshot
Class LXSnapshotEngine
java.lang.Object
heronarts.lx.LXComponent
heronarts.lx.snapshot.LXSnapshotEngine
- All Implemented Interfaces:
LXLoopTask
,LXPath
,LXSerializable
,LXOscComponent
,LXParameterListener
The snapshot engine stores snapshots in time of the state of project settings. This includes
mixer settings, the parameter values of the active patterns and effects that are running at
the given time.
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic enum
static enum
static interface
static enum
Nested classes/interfaces inherited from class heronarts.lx.LXComponent
LXComponent.Hidden, LXComponent.Placeholder, LXComponent.Renamable
Nested classes/interfaces inherited from interface heronarts.lx.LXSerializable
LXSerializable.Utils
-
Field Summary
Modifier and TypeFieldDescriptionfinal DiscreteParameter
final BooleanParameter
Whether auto pattern transition is enabled on this channelAuto-cycle to a random snapshot, not the next onefinal BoundedParameter
Time in seconds after which transition thru the pattern set is automatically initiated.static final String
final BooleanParameter
final BooleanParameter
final BooleanParameter
final BooleanParameter
final BooleanParameter
final BooleanParameter
final List<LXGlobalSnapshot>
Public read-only view of all the snapshots.final BooleanParameter
final BoundedParameter
Amount of time taken in seconds to transition into a new snapshot viewfinal TriggerParameter
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 TypeMethodDescriptionaddListener
(LXSnapshotEngine.Listener listener) Adds a new snapshot that takes the current state of the program.addSnapshot
(LXGlobalSnapshot snapshot) Adds a snapshot to the engine.addSnapshot
(LXGlobalSnapshot snapshot, int index) Adds a snapshot to the engine.void
clear()
Clears all snapshots from the engine.findSnapshotParameterViews
(LXParameter parameter) findSnapshotViews
(LXComponent component) Find all snapshot views that involve the selected component.double
Returns the snapshot that the cursor currently points to, if any.double
boolean
handleOscMessage
(OscMessage message, String[] parts, int index) Handles an OSC message sent to this component.void
load
(LX lx, JsonObject obj) Loads the LX component.void
loop
(double deltaMs) moveSnapshot
(LXGlobalSnapshot snapshot, int index) Moves a snapshot to a new order in the engine snapshot listvoid
onParameterChanged
(LXParameter parameter) Subclasses are free to override this if desired.boolean
recall
(LXGlobalSnapshot snapshot) Recall this snapshot, apply all of its valuesboolean
recall
(LXGlobalSnapshot snapshot, List<LXCommand> commands) Recall this snapshot, and populate an array of commands which would need to be undone by this operation.registerGlobal
(LXComponent component) Registers a global component for storage in global snapshotsremoveListener
(LXSnapshotEngine.Listener listener) removeSnapshot
(LXGlobalSnapshot snapshot) Removes a snapshot from the enginevoid
removeSnapshotParameterViews
(LXParameter parameter) Remove all snapshot views that reference the given parametervoid
removeSnapshotViews
(LXComponent component) Remove all snapshot views that reference the given componentvoid
save
(LX lx, JsonObject obj) Serializes the LX component.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, getOscAddress, getOscLabel, getOscPath, getParameter, getParameters, getParent, getPath, hasParameter, isValidOscParameter, loadParameters, loadPreset, 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.osc.LXOscComponent
getOscAddress
Methods inherited from interface heronarts.lx.LXPath
getCanonicalLabel, getCanonicalLabel, getCanonicalPath, getCanonicalPath, isDescendant
-
Field Details
-
snapshots
Public read-only view of all the snapshots. -
recallMixer
-
recallPattern
-
recallEffect
-
recallModulation
-
recallMaster
-
recallOutput
-
missingChannelMode
-
channelMode
-
autoCycleEnabled
Whether auto pattern transition is enabled on this channel -
autoCycleMode
Auto-cycle to a random snapshot, not the next one -
autoCycleTimeSecs
Time in seconds after which transition thru the pattern set is automatically initiated. -
transitionTimeSecs
Amount of time taken in seconds to transition into a new snapshot view -
transitionEnabled
-
triggerSnapshotCycle
-
autoCycleCursor
-
PATH_SNAPSHOT
- See Also:
-
-
Constructor Details
-
LXSnapshotEngine
-
-
Method Details
-
registerGlobal
Registers a global component for storage in global snapshots- Parameters:
component
- Global component- Returns:
- this
-
onParameterChanged
Description copied from class:LXComponent
Subclasses are free to override this if desired. It will automatically fire for any listenable parameter that is registered with this component.- Specified by:
onParameterChanged
in interfaceLXParameterListener
- Overrides:
onParameterChanged
in classLXComponent
- Parameters:
parameter
- Parameter that has a value change
-
addListener
-
removeListener
-
addSnapshot
Adds a new snapshot that takes the current state of the program.- Returns:
- New snapshot that holds a view of the current state
-
addSnapshot
Adds a snapshot to the engine. This snapshot is assumed to already exist and have been somehow populated.- Parameters:
snapshot
- Snapshot to add- Returns:
- this
-
addSnapshot
Adds a snapshot to the engine. This snapshot is assumed to already exist and have been somehow populated.- Parameters:
snapshot
- Snapshot to addindex
- Index to add at- Returns:
- this
-
removeSnapshot
Removes a snapshot from the engine- Parameters:
snapshot
- Snapshot to remove- Returns:
- this
-
moveSnapshot
Moves a snapshot to a new order in the engine snapshot list- Parameters:
snapshot
- Snapshotindex
- New position to occupy- Returns:
- this
-
getCursorSnapshot
Returns the snapshot that the cursor currently points to, if any.- Returns:
- Snapshot or null
-
recall
Recall this snapshot, apply all of its values- Parameters:
snapshot
- The snapshot to recall- Returns:
- True the snapshot was recalled, false if it was already mid-transition
-
recall
Recall this snapshot, and populate an array of commands which would need to be undone by this operation.- Parameters:
snapshot
- Snapshot to recallcommands
- Array to populate with all the commands processed- Returns:
- True the snapshot was recalled, false if it was already mid-transition
-
getTransitionProgress
public double getTransitionProgress() -
getAutoCycleProgress
public double getAutoCycleProgress() -
loop
public void loop(double deltaMs) - Specified by:
loop
in interfaceLXLoopTask
-
clear
public void clear()Clears all snapshots from the engine. Generally should not be publicly used. -
handleOscMessage
Description copied from class:LXComponent
Handles 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:
handleOscMessage
in interfaceLXOscComponent
- Overrides:
handleOscMessage
in 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:
true
if the OSC message was handled and should be considered consumed,false
otherwise
-
findSnapshotViews
Find all snapshot views that involve the selected component. This is typically called before removal of that component to identify now-defunct references.- Parameters:
component
- Component- Returns:
- List of all views that reference this component, or null
-
findSnapshotParameterViews
-
removeSnapshotViews
Remove all snapshot views that reference the given component- Parameters:
component
- Component that is referenced
-
removeSnapshotParameterViews
Remove all snapshot views that reference the given parameter- Parameters:
parameter
- Parameter that is referenced
-
save
Description copied from class:LXComponent
Serializes 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:
save
in interfaceLXSerializable
- Overrides:
save
in classLXComponent
- Parameters:
lx
- LX instanceobj
- Object to serialize into
-
load
Description copied from class:LXComponent
Loads 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:
load
in interfaceLXSerializable
- Overrides:
load
in classLXComponent
- Parameters:
lx
- LX instanceobj
- Object to deserialize
-