javax.sound.sampled
Class DataLine.Info
- DataLine
Besides the class information inherited from its superclass,
DataLine.Info provides additional information specific to data lines.
This information includes:
- the audio formats supported by the data line
- the minimum and maximum sizes of its internal buffer
Because a
Line.Info knows the class of the line its describes, a
DataLine.Info object can describe
DataLine
subinterfaces such as
SourceDataLine,
TargetDataLine, and
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
Mixer.getLine(Line.Info).
Info(Class> lineClass, AudioFormat format)- Constructs a data line's info object from the specified information,
which includes a single audio format.
|
Info(Class> lineClass, AudioFormat format, int bufferSize)- Constructs a data line's info object from the specified information,
which includes a single audio format and a desired buffer size.
|
Info(Class> lineClass, AudioFormat[] formats, int minBufferSize, int maxBufferSize)- Constructs a data line's info object from the specified information,
which includes a set of supported audio formats and a range for the buffer size.
|
clone, equals, extends Object> getClass, finalize, hashCode, notify, notifyAll, toString, wait, wait, wait |
Info
public Info(Class> lineClass,
AudioFormat format) Constructs a data line's info object from the specified information,
which includes a single audio format.
This constructor is typically used by an application to
describe a desired line.
lineClass - the class of the data line described by the info objectformat - desired format
View More Examples of Info(Class> lineClass,AudioFormat format)
1: protected void createLine(AudioFormat format) {
2: DataLine.Info dataLineInfo = new DataLine.Info(TargetDataLine.class, format);
3: try {
4: targetDataLine = (TargetDataLine)AudioSystem.getLine(dataLineInfo);
5: targetDataLine.addLineListener(this);
View Full Code Here
1: AudioFormat format = audioInputStream.getFormat();
2: DataLine.Info info = new DataLine.Info(Clip.class, format);
3: m_clip = (Clip) AudioSystem.getLine(info);
4: m_clip.open(audioInputStream);
5: m_clip.loop(0);
View Full Code Here
1: DataLine.Info info =
2: new DataLine.Info(SourceDataLine.class, format);
3: System.out.println ("got info");
4: line = (SourceDataLine) AudioSystem.getLine (info);
5: System.out.println ("got line");
View Full Code Here
1: DataLine.Info info =
2: new DataLine.Info(SourceDataLine.class, format);
3: line = (SourceDataLine)AudioSystem.getLine(info);
4: line.open(format, bufferSize);
5: }
View Full Code Here
1: AudioFormat format = audioInputStream.getFormat();
2: DataLine.Info info = new DataLine.Info(Clip.class, format);
3:
4: Clip clip = (Clip) AudioSystem.getLine(info);
5: clip.open(audioInputStream);
View Full Code Here
Info
public Info(Class> lineClass,
AudioFormat format,
int bufferSize) Constructs a data line's info object from the specified information,
which includes a single audio format and a desired buffer size.
This constructor is typically used by an application to
describe a desired line.
lineClass - the class of the data line described by the info objectformat - desired formatbufferSize - desired buffer size in bytes
View More Examples of Info(Class> lineClass,AudioFormat format,int bufferSize)
1: LOG.debug("Create Line : " + audioFormat);
2: DataLine.Info info = new DataLine.Info(SourceDataLine.class, audioFormat, AudioSystem.NOT_SPECIFIED);
3: m_line = (SourceDataLine) AudioSystem.getLine(info);
4:
5: if (m_line.isControlSupported(FloatControl.Type.MASTER_GAIN))
View Full Code Here
1:
2: DataLine.Info info = new DataLine.Info(SourceDataLine.class, sourceFormat, LimeWirePlayer.EXTERNAL_BUFFER_SIZE);
3:
4: ...
5:
6: info = new DataLine.Info(SourceDataLine.class, targetFormat, LimeWirePlayer.EXTERNAL_BUFFER_SIZE);
7: return AudioSystem.getAudioInputStream(targetFormat, audioInputStream);
8: }
9: }
View Full Code Here
Info
public Info(Class> lineClass,
AudioFormat[] formats,
int minBufferSize,
int maxBufferSize) Constructs a data line's info object from the specified information,
which includes a set of supported audio formats and a range for the buffer size.
This constructor is typically used by mixer implementations
when returning information about a supported line.
lineClass - the class of the data line described by the info objectformats - set of formats supportedminBufferSize - minimum buffer size supported by the data line, in bytesmaxBufferSize - maximum buffer size supported by the data line, in bytes
getFormats
public AudioFormat[] getFormats()
Obtains a set of audio formats supported by the data line.
Note that
isFormatSupported(AudioFormat) might return
true for certain additional formats that are missing from
the set returned by
getFormats(). The reverse is not
the case:
isFormatSupported(AudioFormat) is guaranteed to return
true for all formats returned by
getFormats().
Some fields in the AudioFormat instances can be set to
NOT_SPECIFIED
if that field does not apply to the format,
or if the format supports a wide range of values for that field.
For example, a multi-channel device supporting up to
64 channels, could set the channel field in the
AudioFormat instances returned by this
method to
NOT_SPECIFIED.
- a set of supported audio formats.
getMaxBufferSize
public int getMaxBufferSize()
Obtains the maximum buffer size supported by the data line.
- maximum buffer size in bytes, or
AudioSystem.NOT_SPECIFIED
getMinBufferSize
public int getMinBufferSize()
Obtains the minimum buffer size supported by the data line.
- minimum buffer size in bytes, or
AudioSystem.NOT_SPECIFIED
isFormatSupported
public boolean isFormatSupported(AudioFormat format)
Indicates whether this data line supports a particular audio format.
The default implementation of this method simply returns true if
the specified format matches any of the supported formats.
format - the audio format for which support is queried.
true if the format is supported, otherwise false
matches
public boolean matches(Line.Info info)
Determines whether the specified info object matches this one.
To match, the superclass match requirements must be met. In
addition, this object's minimum buffer size must be at least as
large as that of the object specified, its maximum buffer size must
be at most as large as that of the object specified, and all of its
formats must match formats supported by the object specified.
- matches in interface Line.Info
true if this object matches the one specified,
otherwise false.