/**
* Obtains a source data line that can be used for playing back
* audio data in the format specified by the
* <code>AudioFormat</code> object. The returned line
* will be provided by the default system mixer, or,
* if not possible, by any other mixer installed in the
* system that supports a matching
* <code>SourceDataLine</code> object.
*
* <p>The returned line should be opened with the
* <code>open(AudioFormat)</code> or
* <code>open(AudioFormat, int)</code> method.
*
* <p>This is a high-level method that uses <code>getMixer</code>
* and <code>getLine</code> internally.
*
* <p>The returned <code>SourceDataLine</code>'s default
* audio format will be initialized with <code>format</code>.
*
* <p>If the system property
* <code>javax.sound.sampled.SourceDataLine</code>
* is defined or it is defined in the file "sound.properties",
* it is used to retrieve the default source data line.
* For details, refer to the {@link AudioSystem class description}.
*
* @param format an <code>AudioFormat</code> object specifying
* the supported audio format of the returned line,
* or <code>null</code> for any audio format
* @return the desired <code>SourceDataLine</code> object
*
* @throws LineUnavailableException if a matching source data line
* is not available due to resource restrictions
* @throws SecurityException if a matching source data line
* is not available due to security restrictions
* @throws IllegalArgumentException if the system does not
* support at least one source data line supporting the
* specified audio format through any installed mixer
*
* @see #getSourceDataLine(AudioFormat, Mixer.Info)
* @since 1.5
*/
public static SourceDataLine getSourceDataLine(AudioFormat format)
throws LineUnavailableException{
DataLine.Info info = new DataLine.Info(SourceDataLine.class, format);
return (SourceDataLine) AudioSystem.getLine(info);
}
AudioSystem.java 文件源码
java
阅读 27
收藏 0
点赞 0
评论 0
项目:TuxGuitar-1.3.1-fork
作者:
评论列表
文章目录