|
Préférences
Moteurs de recherche
|
||||||||||||||||||||||||
JavaTM 2 Platform Std. Ed. v1.4.2
javax.sound.sampled
|
Nested Class Summary | |
static class |
Line.Info
A Line.Info object contains information about a line. |
Method Summary | |
void |
addLineListener(LineListener listener)
Adds a listener to this line. |
void |
close()
Closes the line, indicating that any system resources in use by the line can be released. |
Control |
getControl(Control.Type control)
Obtains a control of the specified type, if there is any. |
Control[] |
getControls()
Obtains the set of controls associated with this line. |
Line.Info |
getLineInfo()
Obtains the Line.Info object describing this
line. |
boolean |
isControlSupported(Control.Type control)
Indicates whether the line supports a control of the specified type. |
boolean |
isOpen()
Indicates whether the line is open, meaning that it has reserved system resources and is operational, although it might not currently be playing or capturing sound. |
void |
open()
Opens the line, indicating that it should acquire any required system resources and become operational. |
void |
removeLineListener(LineListener listener)
Removes the specified listener from this line's list of listeners. |
Method Detail |
public Line.Info getLineInfo()
Line.Info
object describing this
line.
public void open() throws LineUnavailableException
OPEN
event is dispatched
to the line's listeners.
Note that some lines, once closed, cannot be reopened. Attempts
to reopen such a line will always result in an LineUnavailableException
.
Some types of lines have configurable properties that may affect
resource allocation. For example, a DataLine
must
be opened with a particular format and buffer size. Such lines
should provide a mechanism for configuring these properties, such
as an additional open
method or methods which allow
an application to specify the desired settings.
This method takes no arguments, and opens the line with the current
settings. For
and
SourceDataLine
objects, this means that the line is
opened with default settings. For a TargetDataLine
, however,
the buffer size is determined when data is loaded. Since this method does not
allow the application to specify any data to load, it allocates
resources for a clip with zero frames of data, and there is no
means for subsequently loading data into that clip. Therefore,
you should instead use one of the Clip
open
methods provided in
the Clip
interface to load data into the Clip
.
LineUnavailableException
- if the line cannot be
opened due to resource restrictions.
SecurityException
- if the line cannot be
opened due to security restrictions.close()
,
isOpen()
,
LineEvent
,
DataLine
,
Clip.open(AudioFormat, byte[], int, int)
,
Clip.open(AudioInputStream)
public void close()
CLOSE
event is dispatched
to the line's listeners.
SecurityException
- if the line cannot be
closed due to security restrictions.open()
,
isOpen()
,
LineEvent
public boolean isOpen()
public Control[] getControls()
getControl(javax.sound.sampled.Control.Type)
public boolean isControlSupported(Control.Type control)
control
- the type of the control for which support is queried
true
if at least one control of the specified type is
supported, otherwise false
.public Control getControl(Control.Type control)
control
- the type of the requested control
IllegalArgumentException
- if a control of the specified type
is not supportedgetControls()
,
isControlSupported(Control.Type control)
public void addLineListener(LineListener listener)
update()
method is called with a LineEvent
object
that describes the change.
listener
- the object to add as a listener to this lineremoveLineListener(javax.sound.sampled.LineListener)
,
LineListener.update(javax.sound.sampled.LineEvent)
,
LineEvent
public void removeLineListener(LineListener listener)
listener
- listener to removeaddLineListener(javax.sound.sampled.LineListener)