All Implemented Interfaces:
Line
All Known Implementing Classes:
TargetDataLine, Clip, SourceDataLine
DataLine
adds media-related functionality to its
superinterface, Line
. This functionality includes
transport-control methods that start, stop, drain, and flush
the audio data that passes through the line. A data line can also
report the current position, volume, and audio format of the media.
Data lines are used for output of audio by means of the
subinterfaces SourceDataLine
or
Clip
, which allow an application program to write data. Similarly,
audio input is handled by the subinterface TargetDataLine
,
which allows data to be read.
A data line has an internal buffer in which
the incoming or outgoing audio data is queued. The
#drain()
method blocks until this internal buffer
becomes empty, usually because all queued data has been processed. The
#flush()
method discards any available queued data
from the internal buffer.
A data line produces START
and
STOP
events whenever
it begins or ceases active presentation or capture of data. These events
can be generated in response to specific requests, or as a result of
less direct state changes. For example, if #start()
is called
on an inactive data line, and data is available for capture or playback, a
START
event will be generated shortly, when data playback
or capture actually begins. Or, if the flow of data to an active data
line is constricted so that a gap occurs in the presentation of data,
a STOP
event is generated.
Mixers often support synchronized control of multiple data lines.
Synchronization can be established through the Mixer interface's
synchronize
method.
See the description of the Mixer
interface
for a more complete description.
Kara
- Kytle1.3
- Nested Class Summary: | ||
---|---|---|
public static class | DataLine.Info | Besides the class information inherited from its superclass,
DataLine.Info provides additional information specific to data lines.
This information includes:
Line.Info knows the class of the line its describes, a
DataLine.Info object can describe DataLine
subinterfaces such as {@link SourceDataLine} ,
{@link TargetDataLine} , and {@link Clip} .
You can query a mixer for lines of any of these types, passing an appropriate
instance of DataLine.Info as the argument to a method such as
{@link Mixer#getLine Mixer.getLine(Line.Info)} . |
Method from javax.sound.sampled.DataLine Summary: |
---|
available, drain, flush, getBufferSize, getFormat, getFramePosition, getLevel, getLongFramePosition, getMicrosecondPosition, isActive, isRunning, start, stop |
Method from javax.sound.sampled.DataLine Detail: |
---|
Note that the units used are bytes, but will always correspond to an integral number of sample frames of audio data.
An application is guaranteed that a read or
write operation of up to the number of bytes returned from
|
drain()
is invoked on a stopped line that has data in its queue, the method will
block until the line is running and the data queue becomes empty. If
drain() is invoked by one thread, and another continues to
fill the data queue, the operation will not complete.
This method always returns when the data line is closed. |
|
|
If the line is not open and has never been opened, it returns
the default format. The default format is an implementation
specific audio format, or, if the |
getLongFramePosition instead. |
|
|
|
|
false .
An open line begins running when the first data is presented in response to an
invocation of the start method, and continues
until presentation ceases in response to a call to stop or
because playback completes. |
START event is generated. |
flush method.
When audio capture or playback stops, a STOP event is generated. |