All Implemented Interfaces:
AutoCloseable
All Known Implementing Classes:
TargetDataLine, Mixer, Clip, Port, DataLine, SourceDataLine
Line
interface represents a mono or multi-channel
audio feed. A line is an element of the digital audio
"pipeline," such as a mixer, an input or output port,
or a data path into or out of a mixer.
A line can have controls, such as gain, pan, and reverb.
The controls themselves are instances of classes that extend the
base Control
class.
The Line
interface provides two accessor methods for
obtaining the line's controls: getControls
returns the
entire set, and getControl
returns a single control of
specified type.
Lines exist in various states at different times. When a line opens, it reserves system
resources for itself, and when it closes, these resources are freed for
other objects or applications. The #isOpen()
method lets
you discover whether a line is open or closed.
An open line need not be processing data, however. Such processing is
typically initiated by subinterface methods such as
SourceDataLine.write
and
TargetDataLine.read
.
You can register an object to receive notifications whenever the line's
state changes. The object must implement the LineListener
interface, which consists of the single method
update
.
This method will be invoked when a line opens and closes (and, if it's a
DataLine , when it starts and stops).
An object can be registered to listen to multiple lines. The event it
receives in its update
method will specify which line created
the event, what type of event it was
(OPEN
, CLOSE
, START
, or STOP
),
and how many sample frames the line had processed at the time the event occurred.
Certain line operations, such as open and close, can generate security exceptions if invoked by unprivileged code when the line is a shared audio resource.
Kara
- Kytle1.3
- Nested Class Summary: | ||
---|---|---|
public static class | Line.Info | A Line.Info object contains information about a line.
The only information provided by Line.Info itself
is the Java class of the line.
A subclass of Line.Info adds other kinds of information
about the line. This additional information depends on which Line
subinterface is implemented by the kind of line that the Line.Info
subclass describes.
A |
Method from javax.sound.sampled.Line Summary: |
---|
addLineListener, close, getControl, getControls, getLineInfo, isControlSupported, isOpen, open, removeLineListener |
Method from javax.sound.sampled.Line Detail: |
---|
update() method is called with a LineEvent object
that describes the change. |
CLOSE event is dispatched
to the line's listeners. |
|
|
Line.Info object describing this
line. |
|
|
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
Some types of lines have configurable properties that may affect
resource allocation. For example, a
This method takes no arguments, and opens the line with the current
settings. For
For |
|