Class FunctionalModulator

All Implemented Interfaces:
LXComponent.Renamable, LXLoopTask, LXPath, LXSerializable, LXNormalizedParameter, LXParameter, LXParameterListener

public abstract class FunctionalModulator extends LXRangeModulator
An extendable modulator class that lets a custom normalized function be supplied by simply extending this class and supplying a compute() and invert() method.
  • Constructor Details

    • FunctionalModulator

      public FunctionalModulator(double startValue, double endValue, double periodMs)
    • FunctionalModulator

      public FunctionalModulator(LXParameter startValue, double endValue, double periodMs)
    • FunctionalModulator

      public FunctionalModulator(double startValue, LXParameter endValue, double periodMs)
    • FunctionalModulator

      public FunctionalModulator(double startValue, double endValue, LXParameter periodMs)
    • FunctionalModulator

      public FunctionalModulator(LXParameter startValue, LXParameter endValue, double periodMs)
    • FunctionalModulator

      public FunctionalModulator(LXParameter startValue, double endValue, LXParameter periodMs)
    • FunctionalModulator

      public FunctionalModulator(double startValue, LXParameter endValue, LXParameter periodMs)
    • FunctionalModulator

      public FunctionalModulator(LXParameter startValue, LXParameter endValue, LXParameter periodMs)
    • FunctionalModulator

      public FunctionalModulator(String label, double startValue, double endValue, double periodMs)
    • FunctionalModulator

      public FunctionalModulator(String label, LXParameter startValue, double endValue, double periodMs)
    • FunctionalModulator

      public FunctionalModulator(String label, double startValue, LXParameter endValue, double periodMs)
    • FunctionalModulator

      public FunctionalModulator(String label, double startValue, double endValue, LXParameter periodMs)
    • FunctionalModulator

      public FunctionalModulator(String label, LXParameter startValue, LXParameter endValue, double periodMs)
    • FunctionalModulator

      public FunctionalModulator(String label, LXParameter startValue, double endValue, LXParameter periodMs)
    • FunctionalModulator

      public FunctionalModulator(String label, double startValue, LXParameter endValue, LXParameter periodMs)
    • FunctionalModulator

      public FunctionalModulator(String label, LXParameter startValue, LXParameter endValue, LXParameter periodMs)
  • Method Details

    • computeNormalizedValue

      protected double computeNormalizedValue(double deltaMs, double basis)
      Description copied from class: LXRangeModulator
      Subclasses implement this which returns their value from a 0-1 scale. This class automatically takes care of scaling to the startValue/endValue range.
      Specified by:
      computeNormalizedValue in class LXRangeModulator
      Parameters:
      deltaMs - Milliseconds elapsed
      basis - Basis of modulator
      Returns:
      Modulator value
    • computeNormalizedBasis

      protected double computeNormalizedBasis(double basis, double normalizedValue)
      Subclasses determine the basis based on a normalized value from 0 to 1.
      Specified by:
      computeNormalizedBasis in class LXRangeModulator
      Parameters:
      normalizedValue - A normalize value from 0 to 1
      basis - Modulator basis
      Returns:
      Computed normalized basis for modulator
    • compute

      public abstract double compute(double basis)
      Subclasses override this method to compute the value of the function. Basis is a value from 0-1, the result must be a value from 0-1.
      Parameters:
      basis - Basis of modulator
      Returns:
      Computed value for given basis
    • invert

      public double invert(double basis, double value)
      Subclasses optionally override this method to support inversion of the value to a basis. This is not well-defined for all functions. If it is not implemented, an UnsupportedOperationException may be thrown at runtime on invocations to methods that would directly change the value or bounds of the function.
      Parameters:
      basis - Previous basis, from 0-1
      value - New value from 0-1
      Returns:
      New basis, from 0-1