Class LXChannel

All Implemented Interfaces:
LXEffect.Container, LXComponent.Renamable, LXLoopTask, LXPath, LXPresetComponent, LXSerializable, LXPatternEngine.Container, LXModulationContainer, LXOscComponent, LXParameterListener

public class LXChannel extends LXAbstractChannel implements LXPatternEngine.Container
A channel is a single component of the engine that has a set of patterns from which it plays and rotates. It also has a fader to control how this channel is blended with the channels before it.
  • Field Details

    • controlsExpanded

      public final BooleanParameter controlsExpanded
      Whether the channel control UI is expanded
    • controlSurfaceSemaphore

      public final MutableParameter controlSurfaceSemaphore
      A semaphore used to keep count of how many remote control surfaces may be controlling this channel's patterns. This may be used by UI implementations to indicate to the user that this component is under remote control.
    • viewPatternLabel

      public final BooleanParameter viewPatternLabel
    • patternEngine

      public final LXPatternEngine patternEngine
    • patterns

      public final List<LXPattern> patterns
    • KEY_IS_GROUP

      protected static final String KEY_IS_GROUP
      See Also:
  • Constructor Details

    • LXChannel

      public LXChannel(LX lx, int index, LXPattern[] patterns)
  • Method Details

    • getPatternEngine

      public LXPatternEngine getPatternEngine()
      Specified by:
      getPatternEngine in interface LXPatternEngine.Container
    • getPatternEngineDelegate

      public LXPatternEngine.Listener getPatternEngineDelegate()
      Specified by:
      getPatternEngineDelegate in interface LXPatternEngine.Container
    • isPlaylist

      public boolean isPlaylist()
      Overrides:
      isPlaylist in class LXAbstractChannel
    • isComposite

      public boolean isComposite()
      Overrides:
      isComposite in class LXAbstractChannel
    • getModelView

      public LXModel getModelView()
      Overrides:
      getModelView in class LXAbstractChannel
    • getClipLabel

      public String getClipLabel()
      Overrides:
      getClipLabel in class LXBus
    • addListener

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

      public final void removeListener(LXChannel.Listener 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 LXBus
      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
    • midiDispatch

      public void midiDispatch(LXShortMessage message)
      Description copied from class: LXAbstractChannel
      Dispatch a MIDI message to all the active devices on this channel, without notifying listeners.
      Overrides:
      midiDispatch in class LXAbstractChannel
      Parameters:
      message - Message
    • getGroup

      public LXGroup getGroup()
      Description copied from class: LXBus
      Returns the group that this channel belongs to
      Overrides:
      getGroup in class LXBus
      Returns:
      Group that this channel belongs to, or null
    • constructClip

      protected LXClip constructClip(int index)
      Specified by:
      constructClip in class LXBus
    • getPatterns

      public final List<LXPattern> getPatterns()
    • getPattern

      public final LXPattern getPattern(int index)
    • getPattern

      public final LXPattern getPattern(String label)
    • getPatternByClassName

      public final LXPattern getPatternByClassName(String className)
    • setPatterns

      public final LXChannel setPatterns(LXPattern[] patterns)
    • addPattern

      public final LXChannel addPattern(LXPattern pattern)
    • addPattern

      public final LXChannel addPattern(LXPattern pattern, int index)
    • removePattern

      public final LXChannel removePattern(LXPattern pattern)
    • movePattern

      public LXChannel movePattern(LXPattern pattern, int index)
    • getFocusedPatternIndex

      public final int getFocusedPatternIndex()
    • getFocusedPattern

      public final LXPattern getFocusedPattern()
      Returns the pattern that currently has focus in this channel's pattern list.
      Returns:
      Pattern focused in the list
    • getActivePatternIndex

      public final int getActivePatternIndex()
      Returns the index of the currently active pattern, if any
      Returns:
      Index of the currently active pattern
    • getActivePattern

      public final LXPattern getActivePattern()
    • getTargetPattern

      public final LXPattern getTargetPattern()
    • getNextPatternIndex

      public final int getNextPatternIndex()
    • getNextPattern

      public final LXPattern getNextPattern()
    • isInTransition

      public boolean isInTransition()
    • goPreviousPattern

      public final LXChannel goPreviousPattern()
      Activates the previous pattern in this channel's pattern list
      Returns:
      this
    • goNextPattern

      public final LXChannel goNextPattern()
      Activates the next pattern in this channel's pattern list
      Returns:
      this
    • goPattern

      public final LXChannel goPattern(LXPattern pattern)
      Activates the given pattern, which must belong to this channel.
      Parameters:
      pattern - Pattern to activate
      Returns:
      this
    • goPattern

      public final LXChannel goPattern(LXPattern pattern, boolean skipTransition)
      Activates the given pattern, which must belong to this channel. Transition can be optionally skipped
      Parameters:
      pattern - Pattern to activate
      skipTransition - Skip over a transition
      Returns:
      this
    • goRandomPattern

      public final LXChannel goRandomPattern()
      Activates a randomly selected pattern on the channel, from the set of patterns that have auto cycle enabled.
      Returns:
      this
    • goPatternIndex

      public final LXChannel goPatternIndex(int index)
      Activates the pattern at the given index, if it is within the bounds of this channel's pattern list.
      Parameters:
      index - Pattern index
      Returns:
      this
    • disableAutoCycle

      public LXChannel disableAutoCycle()
    • enableAutoCycle

      public LXBus enableAutoCycle(double autoCycleThreshold)
      Enable automatic transition from pattern to pattern on this channel
      Parameters:
      autoCycleThreshold - time in seconds
      Returns:
      this
    • getAutoCycleProgress

      public double getAutoCycleProgress()
      Return progress towards making a cycle
      Returns:
      amount of progress towards the next cycle
    • getTransitionProgress

      public double getTransitionProgress()
      Return progress through a transition
      Returns:
      amount of progress thru current transition
    • loop

      public void loop(double deltaMs)
      Specified by:
      loop in interface LXLoopTask
      Overrides:
      loop in class LXAbstractChannel
    • 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 LXAbstractChannel
    • getPresetClass

      public Class<?> getPresetClass()
      Specified by:
      getPresetClass in interface LXPresetComponent
      Overrides:
      getPresetClass in class LXBus
    • 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
      Overrides:
      postProcessPreset in class LXAbstractChannel
    • 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 LXBus
      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 LXAbstractChannel
      Parameters:
      lx - LX instance
      obj - Object to deserialize