Class LXPatternEngine

java.lang.Object
heronarts.lx.mixer.LXPatternEngine
All Implemented Interfaces:
LXSerializable, LXParameterListener

public class LXPatternEngine extends Object implements LXParameterListener, LXSerializable
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

  • Constructor Details

  • Method Details

    • isPlaylist

      public boolean isPlaylist()
    • isComposite

      public boolean isComposite()
    • onParameterChanged

      public void onParameterChanged(LXParameter p)
      Description copied from interface: LXParameterListener
      Invoked when the value of a parameter is changed.
      Specified by:
      onParameterChanged in interface LXParameterListener
      Parameters:
      p - The parameter that has changed its value
    • onPatternEnabled

      public void onPatternEnabled(LXPattern pattern)
    • addListener

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

      public final void removeListener(LXPatternEngine.Listener listener)
    • handleOscMessage

      public boolean handleOscMessage(OscMessage message, String[] parts, int index)
    • midiDispatch

      public void midiDispatch(LXShortMessage message)
    • 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 LXPatternEngine setPatterns(LXPattern[] patterns)
    • addPattern

      public final LXPatternEngine addPattern(LXPattern pattern)
    • addPattern

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

      public final LXPatternEngine removePattern(LXPattern pattern)
    • clearPatterns

      public void clearPatterns()
    • movePattern

      public LXPatternEngine 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 LXPatternEngine goPreviousPattern()
      Activates the previous pattern in this channel's pattern list
      Returns:
      this
    • goNextPattern

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

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

      public final LXPatternEngine 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 LXPatternEngine goRandomPattern()
      Activates a randomly selected pattern on the channel, from the set of patterns that have auto cycle enabled.
      Returns:
      this
    • goPatternIndex

      public final LXPatternEngine 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 LXPatternEngine disableAutoCycle()
    • enableAutoCycle

      public LXPatternEngine 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(LXBuffer blendBuffer, LXModel modelView, double deltaMs)
    • dispose

      public void dispose()
    • save

      public void save(LX lx, JsonObject obj)
      Description copied from interface: LXSerializable
      Serializes this instance into the JSON object
      Specified by:
      save in interface LXSerializable
      Parameters:
      lx - LX instance
      obj - Object to serialize into
    • load

      public void load(LX lx, JsonObject obj)
      Description copied from interface: LXSerializable
      Restores this instance from a JSON object
      Specified by:
      load in interface LXSerializable
      Parameters:
      lx - LX instance
      obj - Object to deserialize
    • loadPattern

      public LXPattern loadPattern(JsonObject patternObj, int index)