Class LXModulator

All Implemented Interfaces:
LXComponent.Renamable, LXLoopTask, LXPath, LXSerializable, LXParameter, LXParameterListener
Direct Known Subclasses:
AbstractDmxModulator, Accelerator, Accumulator, AHDSREnvelope, BandGate, BooleanLogic, ComparatorModulator, DampedParameter, Damper, DecibelMeter, FocusedPatternControls, HistoryBuffer, LXModulator.Placeholder, LXPeriodicModulator, MacroKnobs, MacroSwitches, MacroTriggers, MidiNoteTrigger, MultiTrig, NoiseModulator, OperatorModulator, Scaler, Smoother, SoundObject, Spring, Timer

public abstract class LXModulator extends LXRunnableComponent implements LXComponent.Renamable, LXParameter
A Modulator is an abstraction for a variable with a value that varies over time, such as an envelope or a low frequency oscillator. Some modulators run continuously, others may halt after they reach a certain value.
  • Field Details

  • Constructor Details

    • LXModulator

      protected LXModulator(String label)
      Utility default constructor
      Parameters:
      label - Label
  • Method Details

    • getCrash

      public Throwable getCrash()
    • getCrashStackTrace

      public String getCrashStackTrace()
    • disableAutoStart

      protected LXModulator disableAutoStart()
    • setIndex

      public LXModulator setIndex(int index)
      Sets the index of this modulator in its parent list
      Parameters:
      index - Modulator index
      Returns:
      this
    • getIndex

      public int getIndex()
      Returns the ordering index of this modulator in its parent
      Returns:
      Modulator index
    • getOscPath

      public String getOscPath()
      Description copied from class: LXComponent
      Accessor for this component's OSC path relative to its parent. This by default is no different from LXComponent.getPath(), but certain subclasses may modify this to support different types of OSC paths that aren't required to match the LX hierarchy.
      Overrides:
      getOscPath in class LXComponent
      Returns:
      Path that this object can be accessed via OSC
    • getOscAddress

      public String getOscAddress()
      Description copied from class: LXComponent
      Gets the OSC address for this object
      Overrides:
      getOscAddress in class LXComponent
      Returns:
      Full OSC address for this component
    • setComponent

      public LXParameter setComponent(LXComponent component, String path)
      Description copied from interface: LXParameter
      Sets the component that owns this parameter
      Specified by:
      setComponent in interface LXParameter
      Parameters:
      component - Component
      path - Path name for parameter
      Returns:
      this
    • getPath

      public String getPath()
      Description copied from class: LXComponent
      Accessor for the path of this object. Returns the path this component was registered with. Some subclasses may override this if path structure is dynamic.
      Specified by:
      getPath in interface LXPath
      Overrides:
      getPath in class LXComponent
      Returns:
      path of this component relative to its parent
    • setFormatter

      public LXModulator setFormatter(LXParameter.Formatter formatter)
      Description copied from interface: LXParameter
      Sets the formatter used for printing this parameter's value
      Specified by:
      setFormatter in interface LXParameter
      Parameters:
      formatter - Formatter
      Returns:
      The parameter
    • getFormatter

      public LXParameter.Formatter getFormatter()
      Description copied from interface: LXParameter
      Gets the formatter to be used for printing this parameter's value
      Specified by:
      getFormatter in interface LXParameter
      Returns:
      Formatter
    • setUnits

      public LXModulator setUnits(LXParameter.Units units)
    • getUnits

      public LXParameter.Units getUnits()
      Description copied from interface: LXParameter
      Gets the unit format that this parameter's value stores.
      Specified by:
      getUnits in interface LXParameter
      Returns:
      Units
    • setPolarity

      public LXModulator setPolarity(LXParameter.Polarity polarity)
    • getPolarity

      public LXParameter.Polarity getPolarity()
      Description copied from interface: LXParameter
      Gets the polarity of this parameter.
      Specified by:
      getPolarity in interface LXParameter
      Returns:
      polarity of this parameter
    • setMappingSource

      public LXModulator setMappingSource(boolean isMappingSource)
    • isMappingSource

      public boolean isMappingSource()
    • getValue

      public final double getValue()
      Retrieves the current value of the modulator in full precision
      Specified by:
      getValue in interface LXParameter
      Returns:
      Current value of the modulator
    • setValue

      public final LXModulator setValue(double value)
      Set the modulator to a certain value in its cycle.
      Specified by:
      setValue in interface LXParameter
      Parameters:
      value - The value to apply
      Returns:
      This modulator, for method chaining
    • setValue

      protected final LXModulator setValue(double value, boolean notify)
    • onSetValue

      protected void onSetValue(double value)
      Subclasses may override when actions are necessary on value change.
      Parameters:
      value - New value
    • updateValue

      protected final LXModulator updateValue(double value)
      Helper for subclasses to update value in situations where it needs to be recomputed. This cannot be overriden, and subclasses may assume that it ONLY updates the internal value without triggering any other recomputations.
      Parameters:
      value - Value for modulator
      Returns:
      this, for method chaining
    • autostart

      public void autostart()
      Auto start a newly created modulator. Can be overriden by subclasses
    • loop

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

      protected final void run(double deltaMs)
      Applies updates to the modulator for the specified number of milliseconds. This method is invoked by the core engine.
      Specified by:
      run in class LXRunnableComponent
      Parameters:
      deltaMs - Milliseconds to advance by
    • computeValue

      protected abstract double computeValue(double deltaMs)
      Implementation method to advance the modulator's internal state. Subclasses must provide and update value appropriately.
      Parameters:
      deltaMs - Number of milliseconds to advance by
      Returns:
      Computed value