Package heronarts.lx

Class LXDeviceComponent

All Implemented Interfaces:
LXLoopTask, LXPath, LXPresetComponent, LXSerializable, LXMidiListener, LXModulationContainer, LXOscComponent, LXParameterListener
Direct Known Subclasses:
LXEffect, LXPattern

public abstract class LXDeviceComponent extends LXLayeredComponent implements LXPresetComponent, LXModulationContainer, LXOscComponent, LXMidiListener
A component which may have its own scoped user-level modulators. The concrete subclasses of this are Patterns and Effects.
  • Field Details

  • Constructor Details

    • LXDeviceComponent

      protected LXDeviceComponent(LX lx)
    • LXDeviceComponent

      protected LXDeviceComponent(LX lx, String label)
  • Method Details

    • getModelView

      public LXModel getModelView()
    • setRemoteControls

      protected void setRemoteControls(LXListenableNormalizedParameter... remoteControls)
    • clearCustomRemoteControls

      public void clearCustomRemoteControls()
    • setCustomRemoteControls

      public void setCustomRemoteControls(LXListenableNormalizedParameter... remoteControls)
    • removeCustomRemoteControl

      protected LXComponent removeCustomRemoteControl(LXParameter parameter)
    • getCustomRemoteControls

      public LXListenableNormalizedParameter[] getCustomRemoteControls()
    • isSnapshotControl

      public boolean isSnapshotControl(LXParameter parameter)
      Returns whether this parameter is stored along with snapshots
      Parameters:
      parameter - Parameter
      Returns:
      true if this can be included in snapshots
    • isHiddenControl

      public boolean isHiddenControl(LXParameter parameter)
      Returns whether this parameter is visible in default remote control or device control UIs
      Parameters:
      parameter - Parameter to check
      Returns:
      true if this should be hidden by default
    • resetRemoteControls

      protected LXDeviceComponent resetRemoteControls()
    • getRemoteControls

      public final LXListenableNormalizedParameter[] getRemoteControls()
      Subclasses may override this. The method returns an array of parameters in order that can be addressed by a remote control surface
      Returns:
      Array of parameters for a remote control surface to address
    • addControlSurface

      public LXComponent addControlSurface(LXMidiSurface surface)
    • removeControlSurface

      public LXComponent removeControlSurface(LXMidiSurface surface)
    • getControlSurfaces

      public Set<LXMidiSurface> getControlSurfaces()
    • getDeviceVersion

      public int getDeviceVersion()
      Subclasses may override this and provide a version identifier. This will be written to project files when this device is saved. The version should be incremented when change to the code makes old parameter values incompatible, and the implementation should handle loading old values if possible.
      Returns:
      Version number of this device
    • loop

      public void loop(double deltaMs)
      Specified by:
      loop in interface LXLoopTask
      Overrides:
      loop in class LXLayeredComponent
    • getCrash

      public Throwable getCrash()
    • getCrashStackTrace

      public String getCrashStackTrace()
    • getModulationEngine

      public LXModulationEngine getModulationEngine()
      Specified by:
      getModulationEngine in interface LXModulationContainer
    • midiDispatch

      public void midiDispatch(LXShortMessage message)
      Dispatch a MIDI message to this device, and any of its modulators which should receive that
      Parameters:
      message - Message
    • 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 LXLayeredComponent
    • 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