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 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.
Line#getControls, Line#isControlSupported
| Modifier and Type | Class and Description |
|---|---|
| public static class | FloatControl.
An instance of the |
| Modifier and Type | Field and Description |
|---|---|
| private final float | maximum
The maximum supported value. |
| private final String | maxLabel
A label for the maximum value, such as "Right". |
| private final String | midLabel
A label for the mid-point value, such as "Center". |
| private final float | minimum
The minimum supported value. |
| private final String | minLabel
A label for the minimum value, such as "Left". |
| private final float | precision
The control's precision. |
| private final String | units
A label for the units in which the control values are expressed, such as "dB" for decibels. |
| private final int | updatePeriod
The smallest time increment in which a value change can be effected during a value shift, in microseconds. |
| private float | value
The current value. |
| Access | Constructor and Description |
|---|---|
| protected | FloatControl(FloatControl.
the kind of control represented by this float control object type,the smallest value permitted for the control minimum, float the largest value permitted for the control maximum, float the resolution or granularity of the control. This is
the size of the increment between discrete valid values. precision, int the smallest time interval, in microseconds, over
which the control can change from one discrete value to the next
during a updatePeriod, float shiftthe value that the control starts with when
constructed initialValue, String the label for the units in which the control's values are
expressed, such as "dB" or "frames per second" units, String the label for the minimum value, such as "Left" or "Off" minLabel, String the label for the midpoint value, such as "Center" or
"Default" midLabel, String the label for the maximum value, such as "Right" or
"Full" maxLabel)Constructs a new float control object with the given parameters. |
| protected | FloatControl(FloatControl.
the kind of control represented by this float control object type,the smallest value permitted for the control minimum, float the largest value permitted for the control maximum, float the resolution or granularity of the control. This is
the size of the increment between discrete valid values. precision, int the smallest time interval, in microseconds, over
which the control can change from one discrete value to the next
during a updatePeriod, float shiftthe value that the control starts with when
constructed initialValue, String the label for the units in which the control's values are
expressed, such as "dB" or "frames per second" units)Constructs a new float control object with the given parameters. |
| Modifier and Type | Method and Description |
|---|---|
| public float | |
| public String | Returns: the maximum value label, or a zero-length string if no label has been setObtains the label for the maximum value, such as "Right" or "Full". |
| public String | Returns: the mid-point value label, or a zero-length string if no label has been setObtains the label for the mid-point value, such as "Center" or "Default". |
| public float | |
| public String | Returns: the minimum value label, or a zero-length string if no label has been setObtains the label for the minimum value, such as "Left" or "Off". |
| public float | Returns: the control's precisionObtains the resolution or granularity of the control, in the units that the control measures. |
| public String | Returns: the units label, or a zero-length string if no labelObtains the label for the units in which the control's values are expressed, such as "dB" or "frames per second." |
| public int | Returns: update period in microseconds, or -1 if shifting over time is unsupportedObtains the smallest time interval, in microseconds, over which the control's value can change during a shift. |
| public float | |
| public void | |
| public void | shift(float
initial value at the beginning of the shift from, float final value after the shift to, int maximum duration of the shift in microseconds microseconds)Changes the control value from the initial value to the final value linearly over the specified time period, specified in microseconds. |
| public String | Returns: a string representation of the float controlOverrides javax. Returns a string representation of the float control. |
| maximum | back to summary |
|---|---|
| private final float maximum The maximum supported value. | |
| maxLabel | back to summary |
|---|---|
| private final String maxLabel A label for the maximum value, such as "Right". | |
| midLabel | back to summary |
|---|---|
| private final String midLabel A label for the mid-point value, such as "Center". | |
| minimum | back to summary |
|---|---|
| private final float minimum The minimum supported value. | |
| minLabel | back to summary |
|---|---|
| private final String minLabel A label for the minimum value, such as "Left". | |
| precision | back to summary |
|---|---|
| private final float precision The control's precision. | |
| units | back to summary |
|---|---|
| private final String units A label for the units in which the control values are expressed, such as "dB" for decibels. | |
| updatePeriod | back to summary |
|---|---|
| private final int updatePeriod The smallest time increment in which a value change can be effected during a value shift, in microseconds. | |
| value | back to summary |
|---|---|
| private float value The current value. | |
| FloatControl | back to summary |
|---|---|
| protected FloatControl(FloatControl. Constructs a new float control object with the given parameters.
| |
| FloatControl | back to summary |
|---|---|
| protected FloatControl(FloatControl. 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.
| |
| getMaximum | back to summary |
|---|---|
| public float getMaximum() Obtains the maximum value permitted.
| |
| getMaxLabel | back to summary |
|---|---|
| public String getMaxLabel() Obtains the label for the maximum value, such as "Right" or "Full".
| |
| getMidLabel | back to summary |
|---|---|
| public String getMidLabel() Obtains the label for the mid-point value, such as "Center" or "Default".
| |
| getMinimum | back to summary |
|---|---|
| public float getMinimum() Obtains the minimum value permitted.
| |
| getMinLabel | back to summary |
|---|---|
| public String getMinLabel() Obtains the label for the minimum value, such as "Left" or "Off".
| |
| getPrecision | back to summary |
|---|---|
| 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.
| |
| getUnits | back to summary |
|---|---|
| public String getUnits() Obtains the label for the units in which the control's values are expressed, such as "dB" or "frames per second."
| |
| getUpdatePeriod | back to summary |
|---|---|
| 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.
| |
| getValue | back to summary |
|---|---|
| public float getValue() Obtains this control's current value.
| |
| setValue | back to summary |
|---|---|
| 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
| |
| shift | back to summary |
|---|---|
| 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.
| |
| toString | back to summary |
|---|---|
| public String toString() Overrides javax. Returns a string representation of the float control. | |
FloatControl.Type inner class identifies one
kind of float control. Static instances are provided for the common
types.
| Modifier and Type | Field and Description |
|---|---|
| public static final FloatControl. | AUX_RETURN
Represents a control for the auxiliary return gain on a line. |
| public static final FloatControl. | AUX_SEND
Represents a control for the auxiliary send gain on a line. |
| public static final FloatControl. | BALANCE
Represents a control for the relative balance of a stereo signal between two stereo speakers. |
| public static final FloatControl. | MASTER_GAIN
Represents a control for the overall gain on a line. |
| public static final FloatControl. | PAN
Represents a control for the relative pan (left-right positioning) of the signal. |
| public static final FloatControl. | REVERB_RETURN
Represents a control for the post-reverb gain on a line. |
| public static final FloatControl. | REVERB_SEND
Represents a control for the pre-reverb gain on a line. |
| public static final FloatControl. | SAMPLE_RATE
Represents a control that changes the sample rate of audio playback. |
| public static final FloatControl. | VOLUME
Represents a control for the volume on a line. |
| Access | Constructor and Description |
|---|---|
| protected |
| AUX_RETURN | back to summary |
|---|---|
| public static final FloatControl. Represents a control for the auxiliary return gain on a line.
| |
| AUX_SEND | back to summary |
|---|---|
| public static final FloatControl. Represents a control for the auxiliary send gain on a line.
| |
| BALANCE | back to summary |
|---|---|
| public static final FloatControl. Represents a control for the relative balance of a stereo signal between two stereo speakers. The valid range of values is -1.0 (left channel only) to 1.0 (right channel only). The default is 0.0 (centered).
| |
| MASTER_GAIN | back to summary |
|---|---|
| public static final FloatControl. Represents a control for the overall gain on a line. Gain is a quantity in decibels (dB) that is added to the intrinsic decibel level of the audio signal--that is, the level of the signal before it is altered by the gain control. A positive gain amplifies (boosts) the signal's volume, and a negative gain attenuates(cuts)it. The gain setting defaults to a value of 0.0 dB, meaning the signal's loudness is unaffected. Note that gain measures dB, not amplitude. The relationship between a gain in decibels and the corresponding linear amplitude multiplier is:
The These comments apply to gain controls in general, not just master gain controls. A line can have more than one gain control. For example, a mixer (which is itself a line) might have a master gain control, an auxiliary return control, a reverb return control, and, on each of its source lines, an individual aux send and reverb send.
| |
| PAN | back to summary |
|---|---|
| public static final FloatControl. Represents a control for the relative pan (left-right positioning) of the signal. The signal may be mono; the pan setting affects how it is distributed by the mixer in a stereo mix. The valid range of values is -1.0 (left channel only) to 1.0 (right channel only). The default is 0.0 (centered).
| |
| REVERB_RETURN | back to summary |
|---|---|
| public static final FloatControl. Represents a control for the post-reverb gain on a line. This control may be used to control the relative amplitude of the signal returned from an internal reverberation unit.
| |
| REVERB_SEND | back to summary |
|---|---|
| public static final FloatControl. Represents a control for the pre-reverb gain on a line. This control may be used to affect how much of a line's signal is directed to a mixer's internal reverberation unit.
| |
| SAMPLE_RATE | back to summary |
|---|---|
| public static final FloatControl. Represents a control that changes the sample rate of audio playback.
The net effect of changing the sample rate depends on the
relationship between the media's natural rate and the rate that is
set via this control. The natural rate is the sample rate that is
specified in the data line's Changing the sample rate with this control does not affect the data line's audio format. Also note that whenever you change a sound's sample rate, a change in the sound's pitch results. For example, doubling the sample rate has the effect of doubling the frequencies in the sound's spectrum, which raises the pitch by an octave. | |
| VOLUME | back to summary |
|---|---|
| public static final FloatControl. Represents a control for the volume on a line. | |
| Type | back to summary |
|---|---|
| protected Type(final String name) Constructs a new float control type.
| |