Class LXSnapshot

java.lang.Object
heronarts.lx.LXComponent
heronarts.lx.snapshot.LXSnapshot
All Implemented Interfaces:
LXPath, LXSerializable, LXParameterListener
Direct Known Subclasses:
LXClipSnapshot, LXGlobalSnapshot

public abstract class LXSnapshot extends LXComponent
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.
  • Field Details

    • views

      public final List<LXSnapshot.View> views
      Public immutable list of all the views this snapshot comtains.
    • transitionTimeSecs

      public final BoundedParameter transitionTimeSecs
  • Constructor Details

    • LXSnapshot

      protected LXSnapshot(LX lx, LXComponent snapshotParameterScope)
  • Method Details

    • isGlobalSnapshot

      public boolean isGlobalSnapshot()
    • isClipSnapshot

      public boolean isClipSnapshot()
    • getClipChannel

      public LXChannel getClipChannel()
    • update

      public void update()
      Update this snapshot to reflect the current program state
    • initialize

      public abstract void initialize()
    • initializeGlobalBus

      protected void initializeGlobalBus(LXBus bus)
    • initializeClipBus

      protected void initializeClipBus(LXBus bus)
    • addEffectView

      protected void addEffectView(LXEffect effect)
    • addPatternView

      protected void addPatternView(LXPattern pattern)
    • addDeviceView

      protected void addDeviceView(LXSnapshot.ViewScope scope, LXDeviceComponent device)
    • addLayeredView

      protected void addLayeredView(LXSnapshot.ViewScope scope, LXLayeredComponent component)
    • addParameterView

      protected void addParameterView(LXSnapshot.ViewScope scope, LXParameter p)
    • addView

      public LXSnapshot.View addView(JsonObject viewObj)
      Adds a view to this snapshot from prior saved state
      Parameters:
      viewObj - JSON serialized view
      Returns:
      The new view object
    • addView

      public void addView(LXSnapshot.View view)
      Add a view to this snapshot
      Parameters:
      view - View
    • removeView

      public void removeView(LXSnapshot.View view)
      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 call super.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 class LXComponent
    • save

      public void save(LX lx, JsonObject obj)
      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 call super.save(lx, obj) at the appropriate time.
      Specified by:
      save in interface LXSerializable
      Overrides:
      save in class LXComponent
      Parameters:
      lx - LX instance
      obj - Object to serialize into
    • load

      public void load(LX lx, JsonObject obj)
      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 interface LXSerializable
      Overrides:
      load in class LXComponent
      Parameters:
      lx - LX instance
      obj - Object to deserialize