|
JSR-927 (Maintenance Release) | ||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
GainControl
is an interface for manipulating audio signal
gain.
float
values. A gain of 0.0 dB implies that the audio signal
is neither amplified nor attenuated. Positive values
amplify the audio signal, negative values attenuate
the audio signal. The relationship between a linear
gain multiplier and the gain specified in decibels is:
value = pow(10.0, gainDB/20.0)
setLevel
will affect subsequent getDB
invocations.
Level and dB are interrelated in the following ways:
setLevel(0.0)
, getDB
returns the value for which smaller values are not usefully
distinguishable from silence.
Calling setDB
with values equal to or less than this silence
threshold causes getLevel
to return a value of 0.0.
setLevel(1.0)
, getDB
returns the value for which larger values are not useful.
Calling setDB
with values equal to or greater than this
threshold causes getLevel
to return a value of 1.0.
setDB
with a value that is greater than the
maximum level threshold and then immediately call
getDB
, getDB
returns the gain
that was returned by the setDB
, not the value that
would be returned if you called setLevel(1.0)
and then
called getDB
.
true
,
no audio signal is produced by this object; if mute is false
an audio signal is produced and the gain is applied to the
signal.
GainControl
changes, a
GainChangeEvent
is posted.
This event is delivered through an object
that implements GainChangeListener
and has been registered as a listener
with the GainControl
using addGainChangeListener
.
GainChangeEvent
,
GainChangeListener
,
Control
Method Summary | |
void |
addGainChangeListener(GainChangeListener listener)
Register for gain change update events. |
float |
getDB()
Get the current gain set for this object in dB. |
float |
getLevel()
Get the current gain set for this object as a value between 0.0 and 1.0 |
boolean |
getMute()
Get the mute state of the signal associated with this GainControl . |
void |
removeGainChangeListener(GainChangeListener listener)
Remove interest in gain change update events. |
float |
setDB(float gain)
Set the gain in decibels. |
float |
setLevel(float level)
Set the gain using a floating point scale with values between 0.0 and 1.0. |
void |
setMute(boolean mute)
Mute or unmute the signal associated with this GainControl . |
Methods inherited from interface javax.media.Control |
getControlComponent |
Method Detail |
public void setMute(boolean mute)
GainControl
.
Calling setMute(true)
on
an object that is already muted is ignored, as is calling
setMute(false)
on an object that is not currently muted.
Going from a muted to an unmuted state doesn't effect the
gain.
mute
- Specify true
to mute the signal, false
to unmute the signal.public boolean getMute()
GainControl
.
public float setDB(float gain)
gain
- The new gain in dB.
public float getDB()
public float setLevel(float level)
GainControl
supports.
level
- The new gain value specified in the level scale.
public float getLevel()
public void addGainChangeListener(GainChangeListener listener)
GainChangeEvent
is posted when the state
of the GainControl
changes.
listener
- The object to deliver events to.public void removeGainChangeListener(GainChangeListener listener)
No action is performed if the specified listener is not registered.
listener
- The object that has been receiving events.
|
JSR-927 (Maintenance Release) | ||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |