Class DataLine.Info
java.lang.Object
javax.sound.sampled.Line.Info
javax.sound.sampled.DataLine.Info
- Enclosing interface:
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
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).- Since:
- 1.3
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionInfo(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[] 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.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. -
Method Summary
Modifier and TypeMethodDescriptionObtains a set of audio formats supported by the data line.intObtains the maximum buffer size supported by the data line.intObtains the minimum buffer size supported by the data line.booleanisFormatSupported(AudioFormat format) Indicates whether this data line supports a particular audio format.booleanDetermines whether the specified info object matches this one.toString()Returns a string representation of the info object.Methods declared in class Line.Info
getLineClassModifier and TypeMethodDescriptionClass<?> Obtains the class of the line that thisLine.Infoobject describes.Methods declared in class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitModifier and TypeMethodDescriptionprotected Objectclone()Answers a new instance of the same class as the receiver, whose slots have been filled in with the values in the slots of the receiver.booleanCompares the argument to the receiver, and answers true if they represent the same object using a class specific comparison.protected voidfinalize()Deprecated, for removal: This API element is subject to removal in a future version.May cause performance issues, deadlocks and hangs.getClass()Answers the unique instance of java.lang.Class which represents the class of the receiver.inthashCode()Answers an integer hash code for the receiver.final voidnotify()Causes one thread which iswaiting on the receiver to be made ready to run.final voidCauses all threads which arewaiting on the receiver to be made ready to run.final voidwait()Causes the thread which sent this message to be made not ready to run pending some change in the receiver (as indicated bynotifyornotifyAll).final voidwait(long time) Causes the thread which sent this message to be made not ready to run either pending some change in the receiver (as indicated bynotifyornotifyAll) or the expiration of the timeout.final voidwait(long time, int frac) Causes the thread which sent this message to be made not ready to run either pending some change in the receiver (as indicated bynotifyornotifyAll) or the expiration of the timeout.
-
Constructor Details
-
Info
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.- Parameters:
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
-
Info
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.- Parameters:
lineClass- the class of the data line described by the info objectformat- desired formatbufferSize- desired buffer size, in bytes
-
Info
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.- Parameters:
lineClass- the class of the data line described by the info objectformat- desired format
-
-
Method Details
-
getFormats
Obtains a set of audio formats supported by the data line. Note thatisFormatSupported(AudioFormat)might returntruefor certain additional formats that are missing from the set returned bygetFormats(). The reverse is not the case:isFormatSupported(AudioFormat)is guaranteed to returntruefor all formats returned bygetFormats().Some fields in the
AudioFormatinstances can be set toNOT_SPECIFIEDif 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 theAudioFormatinstances returned by this method toNOT_SPECIFIED.- Returns:
- a set of supported audio formats
- See Also:
-
isFormatSupported
Indicates whether this data line supports a particular audio format. The default implementation of this method simply returnstrueif the specified format matches any of the supported formats.- Parameters:
format- the audio format for which support is queried- Returns:
trueif the format is supported, otherwisefalse- See Also:
-
getMinBufferSize
public int getMinBufferSize()Obtains the minimum buffer size supported by the data line.- Returns:
- minimum buffer size in bytes, or
AudioSystem.NOT_SPECIFIED
-
getMaxBufferSize
public int getMaxBufferSize()Obtains the maximum buffer size supported by the data line.- Returns:
- maximum buffer size in bytes, or
AudioSystem.NOT_SPECIFIED
-
matches
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. -
toString
-