Class EnumControl

java.lang.Object
javax.sound.sampled.Control
javax.sound.sampled.EnumControl

public abstract class EnumControl extends Control
An EnumControl provides control over a set of discrete possible values, each represented by an object. In a graphical user interface, such a control might be represented by a set of buttons, each of which chooses one value or setting. For example, a reverb control might provide several preset reverberation settings, instead of providing continuously adjustable parameters of the sort that would be represented by FloatControl objects.

Controls that provide a choice between only two settings can often be implemented instead as a BooleanControl, and controls that provide a set of values along some quantifiable dimension might be implemented instead as a FloatControl with a coarse resolution. However, a key feature of EnumControl is that the returned values are arbitrary objects, rather than numerical or boolean values. This means that each returned object can provide further information. As an example, the settings of a REVERB control are instances of ReverbType that can be queried for the parameter values used for each setting.

Since:
1.3
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static class 
    An instance of the EnumControl.Type inner class identifies one kind of enumerated control.
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    protected
    EnumControl(EnumControl.Type type, Object[] values, Object value)
    Constructs a new enumerated control object with the given parameters.
  • Method Summary

    Modifier and Type
    Method
    Description
    Obtains this control's current value.
    Returns the set of possible values for this control.
    void
    Sets the current value for the control.
    Returns a string representation of the enumerated control.

    Methods declared in class Control

    getType
    Modifier and Type
    Method
    Description
    Obtains the control's type.

    Methods declared in class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    Modifier and Type
    Method
    Description
    protected Object
    Answers a new instance of the same class as the receiver, whose slots have been filled in with the values in the slots of the receiver.
    boolean
    Compares the argument to the receiver, and answers true if they represent the same object using a class specific comparison.
    protected void
    Deprecated, for removal: This API element is subject to removal in a future version.
    May cause performance issues, deadlocks and hangs.
    final Class<? extends Object>
    Answers the unique instance of java.lang.Class which represents the class of the receiver.
    int
    Answers an integer hash code for the receiver.
    final void
    Causes one thread which is waiting on the receiver to be made ready to run.
    final void
    Causes all threads which are waiting on the receiver to be made ready to run.
    final void
    Causes the thread which sent this message to be made not ready to run pending some change in the receiver (as indicated by notify or notifyAll).
    final void
    wait(long time)
    Causes the thread which sent this message to be made not ready to run either pending some change in the receiver (as indicated by notify or notifyAll) or the expiration of the timeout.
    final void
    wait(long time, int frac)
    Causes the thread which sent this message to be made not ready to run either pending some change in the receiver (as indicated by notify or notifyAll) or the expiration of the timeout.
  • Constructor Details

    • EnumControl

      protected EnumControl(EnumControl.Type type, Object[] values, Object value)
      Constructs a new enumerated control object with the given parameters.
      Parameters:
      type - the type of control represented this enumerated control object
      values - the set of possible values for the control
      value - the initial control value
  • Method Details

    • setValue

      public void setValue(Object value)
      Sets the current value for the control. The default implementation simply sets the value as indicated. If the value indicated is not supported, an IllegalArgumentException is thrown. Some controls require that their line be open before they can be affected by setting a value.
      Parameters:
      value - the desired new value
      Throws:
      IllegalArgumentException - if the value indicated does not fall within the allowable range
    • getValue

      public Object getValue()
      Obtains this control's current value.
      Returns:
      the current value
    • getValues

      public Object[] getValues()
      Returns the set of possible values for this control.
      Returns:
      the set of possible values
    • toString

      public String toString()
      Returns a string representation of the enumerated control.
      Overrides:
      toString in class Control
      Returns:
      a string representation of the enumerated control