javax.sound.sampled
Class FloatControl

java.lang.Object sample code for java.lang.Object definition code for java.lang.Object 
  extended by javax.sound.sampled.Control sample code for javax.sound.sampled.Control definition code for javax.sound.sampled.Control 
      extended by javax.sound.sampled.FloatControl

public abstract class FloatControl
extends Control sample code for javax.sound.sampled.Control definition code for javax.sound.sampled.Control

A FloatControl object provides control over a range of floating-point values. Float controls are often represented in graphical user interfaces by continuously adjustable objects such as sliders or rotary knobs. Concrete subclasses of FloatControl implement controls, such as gain and pan, that affect a line's audio signal in some way that an application can manipulate. The FloatControl.Type sample code for javax.sound.sampled.FloatControl.Type definition code for javax.sound.sampled.FloatControl.Type inner class provides static instances of types that are used to identify some common kinds of float control.

The FloatControl abstract class provides methods to set and get the control's current floating-point value. Other methods obtain the possible range of values and the control's resolution (the smallest increment between returned values). Some float controls allow ramping to a new value over a specified period of time. FloatControl also includes methods that return string labels for the minimum, maximum, and midpoint positions of the control.

Since:
1.3
See Also:
Line.getControls() sample code for javax.sound.sampled.Line.getControls() definition code for javax.sound.sampled.Line.getControls() , Line.isControlSupported(javax.sound.sampled.Control.Type) sample code for javax.sound.sampled.Line.isControlSupported(javax.sound.sampled.Control.Type) definition code for javax.sound.sampled.Line.isControlSupported(javax.sound.sampled.Control.Type)

Nested Class Summary
static class FloatControl.Type sample code for javax.sound.sampled.FloatControl.Type definition code for javax.sound.sampled.FloatControl.Type
          An instance of the FloatControl.Type inner class identifies one kind of float control.
 
Constructor Summary
protected FloatControl sample code for javax.sound.sampled.FloatControl.FloatControl(javax.sound.sampled.FloatControl.Type, float, float, float, int, float, java.lang.String) definition code for javax.sound.sampled.FloatControl.FloatControl(javax.sound.sampled.FloatControl.Type, float, float, float, int, float, java.lang.String) (FloatControl.Type sample code for javax.sound.sampled.FloatControl.Type definition code for javax.sound.sampled.FloatControl.Type  type, float minimum, float maximum, float precision, int updatePeriod, float initialValue, String sample code for java.lang.String definition code for java.lang.String  units)
          Constructs a new float control object with the given parameters.
protected FloatControl sample code for javax.sound.sampled.FloatControl.FloatControl(javax.sound.sampled.FloatControl.Type, float, float, float, int, float, java.lang.String, java.lang.String, java.lang.String, java.lang.String) definition code for javax.sound.sampled.FloatControl.FloatControl(javax.sound.sampled.FloatControl.Type, float, float, float, int, float, java.lang.String, java.lang.String, java.lang.String, java.lang.String) (FloatControl.Type sample code for javax.sound.sampled.FloatControl.Type definition code for javax.sound.sampled.FloatControl.Type  type, float minimum, float maximum, float precision, int updatePeriod, float initialValue, String sample code for java.lang.String definition code for java.lang.String  units, String sample code for java.lang.String definition code for java.lang.String  minLabel, String sample code for java.lang.String definition code for java.lang.String  midLabel, String sample code for java.lang.String definition code for java.lang.String  maxLabel)
          Constructs a new float control object with the given parameters
 
Method Summary
 float getMaximum sample code for javax.sound.sampled.FloatControl.getMaximum() definition code for javax.sound.sampled.FloatControl.getMaximum() ()
          Obtains the maximum value permitted.
 String sample code for java.lang.String definition code for java.lang.String getMaxLabel sample code for javax.sound.sampled.FloatControl.getMaxLabel() definition code for javax.sound.sampled.FloatControl.getMaxLabel() ()
          Obtains the label for the maximum value, such as "Right" or "Full."
 String sample code for java.lang.String definition code for java.lang.String getMidLabel sample code for javax.sound.sampled.FloatControl.getMidLabel() definition code for javax.sound.sampled.FloatControl.getMidLabel() ()
          Obtains the label for the mid-point value, such as "Center" or "Default."
 float getMinimum sample code for javax.sound.sampled.FloatControl.getMinimum() definition code for javax.sound.sampled.FloatControl.getMinimum() ()
          Obtains the minimum value permitted.
 String sample code for java.lang.String definition code for java.lang.String getMinLabel sample code for javax.sound.sampled.FloatControl.getMinLabel() definition code for javax.sound.sampled.FloatControl.getMinLabel() ()
          Obtains the label for the minimum value, such as "Left" or "Off."
 float getPrecision sample code for javax.sound.sampled.FloatControl.getPrecision() definition code for javax.sound.sampled.FloatControl.getPrecision() ()
          Obtains the resolution or granularity of the control, in the units that the control measures.
 String sample code for java.lang.String definition code for java.lang.String getUnits sample code for javax.sound.sampled.FloatControl.getUnits() definition code for javax.sound.sampled.FloatControl.getUnits() ()
          Obtains the label for the units in which the control's values are expressed, such as "dB" or "frames per second."
 int getUpdatePeriod sample code for javax.sound.sampled.FloatControl.getUpdatePeriod() definition code for javax.sound.sampled.FloatControl.getUpdatePeriod() ()
          Obtains the smallest time interval, in microseconds, over which the control's value can change during a shift.
 float getValue sample code for javax.sound.sampled.FloatControl.getValue() definition code for javax.sound.sampled.FloatControl.getValue() ()
          Obtains this control's current value.
 void setValue sample code for javax.sound.sampled.FloatControl.setValue(float) definition code for javax.sound.sampled.FloatControl.setValue(float) (float newValue)
          Sets the current value for the control.
 void shift sample code for javax.sound.sampled.FloatControl.shift(float, float, int) definition code for javax.sound.sampled.FloatControl.shift(float, float, int) (float from, float to, int microseconds)
          Changes the control value from the initial value to the final value linearly over the specified time period, specified in microseconds.
 String sample code for java.lang.String definition code for java.lang.String toString sample code for javax.sound.sampled.FloatControl.toString() definition code for javax.sound.sampled.FloatControl.toString() ()
          Provides a string representation of the control
 
Methods inherited from class javax.sound.sampled.Control sample code for javax.sound.sampled.Control definition code for javax.sound.sampled.Control
getType sample code for javax.sound.sampled.Control.getType() definition code for javax.sound.sampled.Control.getType()
 
Methods inherited from class java.lang.Object sample code for java.lang.Object definition code for java.lang.Object
clone sample code for java.lang.Object.clone() definition code for java.lang.Object.clone() , equals sample code for java.lang.Object.equals(java.lang.Object) definition code for java.lang.Object.equals(java.lang.Object) , finalize sample code for java.lang.Object.finalize() definition code for java.lang.Object.finalize() , getClass sample code for java.lang.Object.getClass() definition code for java.lang.Object.getClass() , hashCode sample code for java.lang.Object.hashCode() definition code for java.lang.Object.hashCode() , notify sample code for java.lang.Object.notify() definition code for java.lang.Object.notify() , notifyAll sample code for java.lang.Object.notifyAll() definition code for java.lang.Object.notifyAll() , wait sample code for java.lang.Object.wait() definition code for java.lang.Object.wait() , wait sample code for java.lang.Object.wait(long) definition code for java.lang.Object.wait(long) , wait sample code for java.lang.Object.wait(long, int) definition code for java.lang.Object.wait(long, int)
 

Constructor Detail

FloatControl sample code for javax.sound.sampled.FloatControl(javax.sound.sampled.FloatControl.Type, float, float, float, int, float, java.lang.String, java.lang.String, java.lang.String, java.lang.String) definition code for javax.sound.sampled.FloatControl(javax.sound.sampled.FloatControl.Type, float, float, float, int, float, java.lang.String, java.lang.String, java.lang.String, java.lang.String)

protected FloatControl(FloatControl.Type sample code for javax.sound.sampled.FloatControl.Type definition code for javax.sound.sampled.FloatControl.Type  type,
                       float minimum,
                       float maximum,
                       float precision,
                       int updatePeriod,
                       float initialValue,
                       String sample code for java.lang.String definition code for java.lang.String  units,
                       String sample code for java.lang.String definition code for java.lang.String  minLabel,
                       String sample code for java.lang.String definition code for java.lang.String  midLabel,
                       String sample code for java.lang.String definition code for java.lang.String  maxLabel)
Constructs a new float control object with the given parameters

Parameters:
type - the kind of control represented by this float control object
minimum - the smallest value permitted for the control
maximum - the largest value permitted for the control
precision - the resolution or granularity of the control. This is the size of the increment between discrete valid values.
updatePeriod - the smallest time interval, in microseconds, over which the control can change from one discrete value to the next during a shift sample code for javax.sound.sampled.FloatControl.shift(float, float, int) definition code for javax.sound.sampled.FloatControl.shift(float, float, int)
initialValue - the value that the control starts with when constructed
units - the label for the units in which the control's values are expressed, such as "dB" or "frames per second"
minLabel - the label for the minimum value, such as "Left" or "Off"
midLabel - the label for the midpoint value, such as "Center" or "Default"
maxLabel - the label for the maximum value, such as "Right" or "Full"

FloatControl sample code for javax.sound.sampled.FloatControl(javax.sound.sampled.FloatControl.Type, float, float, float, int, float, java.lang.String) definition code for javax.sound.sampled.FloatControl(javax.sound.sampled.FloatControl.Type, float, float, float, int, float, java.lang.String)

protected FloatControl(FloatControl.Type sample code for javax.sound.sampled.FloatControl.Type definition code for javax.sound.sampled.FloatControl.Type  type,
                       float minimum,
                       float maximum,
                       float precision,
                       int updatePeriod,
                       float initialValue,
                       String sample code for java.lang.String definition code for java.lang.String  units)
Constructs a new float control object with the given parameters. The labels for the minimum, maximum, and mid-point values are set to zero-length strings.

Parameters:
type - the kind of control represented by this float control object
minimum - the smallest value permitted for the control
maximum - the largest value permitted for the control
precision - the resolution or granularity of the control. This is the size of the increment between discrete valid values.
updatePeriod - the smallest time interval, in microseconds, over which the control can change from one discrete value to the next during a shift sample code for javax.sound.sampled.FloatControl.shift(float, float, int) definition code for javax.sound.sampled.FloatControl.shift(float, float, int)
initialValue - the value that the control starts with when constructed
units - the label for the units in which the control's values are expressed, such as "dB" or "frames per second"
Method Detail

setValue sample code for javax.sound.sampled.FloatControl.setValue(float) definition code for javax.sound.sampled.FloatControl.setValue(float)

public void setValue(float newValue)
Sets the current value for the control. The default implementation simply sets the value as indicated. If the value indicated is greater than the maximum value, or smaller than the minimum value, an IllegalArgumentException is thrown. Some controls require that their line be open before they can be affected by setting a value.

Parameters:
newValue - desired new value
Throws:
IllegalArgumentException sample code for java.lang.IllegalArgumentException definition code for java.lang.IllegalArgumentException - if the value indicated does not fall within the allowable range

getValue sample code for javax.sound.sampled.FloatControl.getValue() definition code for javax.sound.sampled.FloatControl.getValue()

public float getValue()
Obtains this control's current value.

Returns:
the current value

getMaximum sample code for javax.sound.sampled.FloatControl.getMaximum() definition code for javax.sound.sampled.FloatControl.getMaximum()

public float getMaximum()
Obtains the maximum value permitted.

Returns:
the maximum allowable value

getMinimum sample code for javax.sound.sampled.FloatControl.getMinimum() definition code for javax.sound.sampled.FloatControl.getMinimum()

public float getMinimum()
Obtains the minimum value permitted.

Returns:
the minimum allowable value

getUnits sample code for javax.sound.sampled.FloatControl.getUnits() definition code for javax.sound.sampled.FloatControl.getUnits()

public String sample code for java.lang.String definition code for java.lang.String  getUnits()
Obtains the label for the units in which the control's values are expressed, such as "dB" or "frames per second."

Returns:
the units label, or a zero-length string if no label

getMinLabel sample code for javax.sound.sampled.FloatControl.getMinLabel() definition code for javax.sound.sampled.FloatControl.getMinLabel()

public String sample code for java.lang.String definition code for java.lang.String  getMinLabel()
Obtains the label for the minimum value, such as "Left" or "Off."

Returns:
the minimum value label, or a zero-length string if no label * has been set

getMidLabel sample code for javax.sound.sampled.FloatControl.getMidLabel() definition code for javax.sound.sampled.FloatControl.getMidLabel()

public String sample code for java.lang.String definition code for java.lang.String  getMidLabel()
Obtains the label for the mid-point value, such as "Center" or "Default."

Returns:
the mid-point value label, or a zero-length string if no label * has been set

getMaxLabel sample code for javax.sound.sampled.FloatControl.getMaxLabel() definition code for javax.sound.sampled.FloatControl.getMaxLabel()

public String sample code for java.lang.String definition code for java.lang.String  getMaxLabel()
Obtains the label for the maximum value, such as "Right" or "Full."

Returns:
the maximum value label, or a zero-length string if no label * has been set

getPrecision sample code for javax.sound.sampled.FloatControl.getPrecision() definition code for javax.sound.sampled.FloatControl.getPrecision()

public float getPrecision()
Obtains the resolution or granularity of the control, in the units that the control measures. The precision is the size of the increment between discrete valid values for this control, over the set of supported floating-point values.

Returns:
the control's precision

getUpdatePeriod sample code for javax.sound.sampled.FloatControl.getUpdatePeriod() definition code for javax.sound.sampled.FloatControl.getUpdatePeriod()

public int getUpdatePeriod()
Obtains the smallest time interval, in microseconds, over which the control's value can change during a shift. The update period is the inverse of the frequency with which the control updates its value during a shift. If the implementation does not support value shifting over time, it should set the control's value to the final value immediately and return -1 from this method.

Returns:
update period in microseconds, or -1 if shifting over time is unsupported
See Also:
shift(float, float, int) sample code for javax.sound.sampled.FloatControl.shift(float, float, int) definition code for javax.sound.sampled.FloatControl.shift(float, float, int)

shift sample code for javax.sound.sampled.FloatControl.shift(float, float, int) definition code for javax.sound.sampled.FloatControl.shift(float, float, int)

public void shift(float from,
                  float to,
                  int microseconds)
Changes the control value from the initial value to the final value linearly over the specified time period, specified in microseconds. This method returns without blocking; it does not wait for the shift to complete. An implementation should complete the operation within the time specified. The default implementation simply changes the value to the final value immediately.

Parameters:
from - initial value at the beginning of the shift
to - final value after the shift
microseconds - maximum duration of the shift in microseconds
See Also:
getUpdatePeriod() sample code for javax.sound.sampled.FloatControl.getUpdatePeriod() definition code for javax.sound.sampled.FloatControl.getUpdatePeriod()

toString sample code for javax.sound.sampled.FloatControl.toString() definition code for javax.sound.sampled.FloatControl.toString()

public String sample code for java.lang.String definition code for java.lang.String  toString()
Provides a string representation of the control

Overrides:
toString sample code for javax.sound.sampled.Control.toString() definition code for javax.sound.sampled.Control.toString() in class Control sample code for javax.sound.sampled.Control definition code for javax.sound.sampled.Control
Returns:
a string description