Class Click

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

public class Click extends LXPeriodicModulator
A click is a simple modulator that fires a value of 1 every time its period has passed. Otherwise it always returns 0.
  • Constructor Details

    • Click

      public Click(double periodMs)
    • Click

      public Click(LXParameter periodMs)
    • Click

      public Click(String label, double periodMs)
    • Click

      public Click(String label, LXParameter periodMs)
  • Method Details

    • loop

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

      public LXModulator fire()
      Sets the value of the click to 1, so that code querying it in this frame of execution sees it as active. On the next iteration of the run loop it will be off again.
      Returns:
      this
    • click

      public boolean click()
      Helper to conditionalize logic based on the click. Typical use is to query as follows:
       if (clickInstance.click()) {
         // perform periodic operation
       }
       
      Returns:
      true if the value is 1, otherwise false
    • computeValue

      protected double computeValue(double deltaMs, double basis)
      Description copied from class: LXPeriodicModulator
      Implementation method to compute the value of a modulator given its basis.
      Specified by:
      computeValue in class LXPeriodicModulator
      Parameters:
      deltaMs - Milliseconds elapsed
      basis - Basis of the modulator
      Returns:
      Value of modulator
    • computeBasis

      protected double computeBasis(double basis, double value)
      Description copied from class: LXPeriodicModulator
      Implementation method to compute the appropriate basis for a modulator given its current basis and value.
      Specified by:
      computeBasis in class LXPeriodicModulator
      Parameters:
      basis - Last basis of modulator
      value - Current value of modulator
      Returns:
      Basis of modulator