Class AggregateParameter

java.lang.Object
heronarts.lx.parameter.LXListenableParameter
heronarts.lx.parameter.AggregateParameter
All Implemented Interfaces:
LXPath, LXParameter
Direct Known Subclasses:
ColorParameter, MidiFilterParameter, TimeParameter

public abstract class AggregateParameter extends LXListenableParameter
An aggregate parameter is a parameter that may be directly monitored for changes, but whose value is constructed from a number of underlying parameters. Changes to the underlying parameters are automatically monitored and will trigger an update of the parameter's direct value if necessary. There is also a mechanism to update the sub-parameter values if the aggregate value is set directly (it is not required that this be supported/implemented based upon the nature of the parameter). The sub-parameters are automatically registered with the parent component at OSC paths under the path of the aggregate parameter itself. The canonical example of an AggregateParameter is the ColorParameter which is comprised of an underlying hue, saturation, and brightness value that generate a single resulting color value.
  • Field Details

  • Constructor Details

    • AggregateParameter

      protected AggregateParameter(String label)
    • AggregateParameter

      protected AggregateParameter(String label, double value)
  • Method Details

    • addSubparameter

      protected void addSubparameter(String path, LXListenableParameter parameter)
    • updateValue

      protected final double updateValue(double value)
      Description copied from class: LXListenableParameter
      Invoked when the value has changed. Subclasses should update any special internal state according to this new value.
      Specified by:
      updateValue in class LXListenableParameter
      Parameters:
      value - New value
      Returns:
      this
    • onUpdateValue

      protected double onUpdateValue(double value)
      Subclasses may optionally override to take action based upon directly updated value
      Parameters:
      value - Updated value
      Returns:
      Value to store
    • updateSubparameters

      protected abstract void updateSubparameters(double value)
      Subclasses should update the subparameter values based upon the raw parameter value if it has been set directly.
    • onSubparameterUpdate

      protected abstract void onSubparameterUpdate(LXParameter p)
      Subclasses should update the main parameter value when a sub-parameter has changed
      Parameters:
      p - Subparameter that has changed
    • getRemoteControl

      public LXListenableNormalizedParameter getRemoteControl()
      Subclasses may override. By default an AggregateParameter returns its first subparameter that is an LXListenableNormalizedParameter for remote control surface.
      Returns:
      Subparameter to be used by a remote control surface
    • dispose

      public void dispose()
      Description copied from interface: LXParameter
      Invoked when the parameter is done being used and none of its resources are needed anymore.
      Specified by:
      dispose in interface LXParameter
      Overrides:
      dispose in class LXListenableParameter