Package heronarts.lx.snapshot
Class LXSnapshot
java.lang.Object
heronarts.lx.LXComponent
heronarts.lx.snapshot.LXSnapshot
- All Implemented Interfaces:
LXPath
,LXSerializable
,LXParameterListener
- Direct Known Subclasses:
LXClipSnapshot
,LXGlobalSnapshot
A snapshot holds a memory of the state of the program at a point in time.
The snapshot contains a collection of "views" which are memories of a piece
of state in the program at some time. Typically this is a parameter value,
but some special cases exist, like the active pattern on a channel.
-
Nested Class Summary
Modifier and TypeClassDescriptionclass
View for which pattern is active on a channelclass
class
Class for the recall of a simple parameter valueclass
A view is a component of a snapshot, it's a single piece of the snapshot that is "looking at" one piece of state.static enum
static enum
Type of snapshot viewNested 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 BoundedParameter
final List<LXSnapshot.View>
Public immutable list of all the views this snapshot comtains.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 TypeMethodDescriptionprotected void
addDeviceView
(LXSnapshot.ViewScope scope, LXDeviceComponent device) protected void
addEffectView
(LXEffect effect) protected void
addLayeredView
(LXSnapshot.ViewScope scope, LXLayeredComponent component) protected void
addParameterView
(LXSnapshot.ViewScope scope, LXParameter p) protected void
addPatternView
(LXPattern pattern) addView
(JsonObject viewObj) Adds a view to this snapshot from prior saved statevoid
addView
(LXSnapshot.View view) Add a view to this snapshotvoid
dispose()
Invoked when a component is being removed from the system and will no longer be used at all.abstract void
protected void
initializeClipBus
(LXBus bus) protected void
initializeGlobalBus
(LXBus bus) boolean
boolean
void
load
(LX lx, JsonObject obj) Loads the LX component.void
removeView
(LXSnapshot.View view) Remove a view from this snapshotvoid
save
(LX lx, JsonObject obj) Serializes the LX component.void
update()
Update this snapshot to reflect the current program stateMethods 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, getPath, 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.LXPath
getCanonicalLabel, getCanonicalLabel, getCanonicalPath, getCanonicalPath, isDescendant
-
Field Details
-
views
Public immutable list of all the views this snapshot comtains. -
transitionTimeSecs
-
-
Constructor Details
-
LXSnapshot
-
-
Method Details
-
isGlobalSnapshot
public boolean isGlobalSnapshot() -
isClipSnapshot
public boolean isClipSnapshot() -
getClipChannel
-
update
public void update()Update this snapshot to reflect the current program state -
initialize
public abstract void initialize() -
initializeGlobalBus
-
initializeClipBus
-
addEffectView
-
addPatternView
-
addDeviceView
-
addLayeredView
-
addParameterView
-
addView
Adds a view to this snapshot from prior saved state- Parameters:
viewObj
- JSON serialized view- Returns:
- The new view object
-
addView
Add a view to this snapshot- Parameters:
view
- View
-
removeView
Remove a view from this snapshot- Parameters:
view
- View to remove
-
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 classLXComponent
-
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
-