Class LXBus

All Implemented Interfaces:
LXLoopTask, LXPath, LXPresetComponent, LXSerializable, LXOscComponent, LXParameterListener
Direct Known Subclasses:
LXAbstractChannel, LXMasterBus

public abstract class LXBus extends LXModelComponent implements LXPresetComponent, LXOscComponent
Abstract representation of a channel, which could be a normal channel with patterns or the master channel.
  • Field Details

  • Method Details

    • constructProfiler

      protected LXModulatorComponent.Profiler constructProfiler()
      Overrides:
      constructProfiler in class LXModulatorComponent
    • getIndex

      public abstract int getIndex()
    • setMixer

      protected void setMixer(LXMixerEngine mixer)
    • addListener

      public final void addListener(LXBus.Listener listener)
    • removeListener

      public final void removeListener(LXBus.Listener listener)
    • addClipListener

      public LXBus addClipListener(LXBus.ClipListener listener)
    • removeClipListener

      public LXBus removeClipListener(LXBus.ClipListener listener)
    • handleOscMessage

      public boolean handleOscMessage(OscMessage message, String[] parts, int index)
      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 interface LXOscComponent
      Overrides:
      handleOscMessage in class LXComponent
      Parameters:
      message - Full OSC message object
      parts - The OSC address pattern, broken into an array of parts
      index - 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
    • getGroup

      public LXGroup getGroup()
      Returns the group that this channel belongs to
      Returns:
      Group that this channel belongs to, or null
    • isGroup

      public boolean isGroup()
      Returns true if this is a group channel
      Returns:
      True if this is a group channel
    • isEmptyGroup

      public boolean isEmptyGroup()
      Returns true if this is an empty group with no channels
      Returns:
      true if this is a group with no subchannels
    • isChannel

      public boolean isChannel()
      Returns true if this is a basic channel
      Returns:
      True if this is a basic channel
    • isInGroup

      public boolean isInGroup()
      Returns true if this channel belongs to a group
      Returns:
      True if this channel is part of a group
    • addEffect

      public final LXBus addEffect(LXEffect effect)
    • addEffect

      public final LXBus addEffect(LXEffect effect, int index)
    • removeEffect

      public final LXBus removeEffect(LXEffect effect)
    • reloadEffect

      public LXBus reloadEffect(LXEffect effect)
    • moveEffect

      public LXBus moveEffect(LXEffect effect, int index)
    • getEffects

      public final List<LXEffect> getEffects()
    • getEffect

      public LXEffect getEffect(int i)
    • getEffect

      public LXEffect getEffect(String label)
    • getClip

      public LXClip getClip(int index)
    • getClip

      public LXClip getClip(int index, boolean create)
    • addClip

      public LXClip addClip()
    • addClip

      public LXClip addClip(int index)
    • addClip

      public LXClip addClip(JsonObject clipObj, int index)
    • getClipLabel

      protected String getClipLabel()
    • stopClips

      public LXBus stopClips()
    • constructClip

      protected abstract LXClip constructClip(int index)
    • removeClip

      public void removeClip(LXClip clip)
    • removeClip

      public void removeClip(int index)
    • loop

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

      protected void loop(double deltaMs, boolean runComponents)
    • disposeClips

      protected void disposeClips()
    • 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 LXModulatorComponent
    • getPresetClass

      public Class<?> getPresetClass()
      Specified by:
      getPresetClass in interface LXPresetComponent
    • postProcessPreset

      public void postProcessPreset(LX lx, JsonObject obj)
      Description copied from interface: LXPresetComponent
      Presets by default contain the results of a normal save() call, but we may not always want all of the information contained. This method post-processes the JSON object before writing to disk.
      Specified by:
      postProcessPreset in interface LXPresetComponent
    • 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