/**
* Creates a new {@code StreamingPlayback}. StreamingPlayback objects will
* always be created by their associated StreamingAudio object.
*
* @param audio
* The {@code Audio} that created this {@code StreamingPlayback}.
* @param audioInStream
* The {@code AudioInputStream} used by this
* {@code StreamingPlayback}.
* @param instanceID
* The {@code instanceID} of this {@code StreamingPlayback}.
*/
protected StreamingPlayback(Audio audio, AudioInputStream audioInStream,
long instanceID) {
super(audio, instanceID);
this.audioInStream = audioInStream;
AudioFormat audioFormat = audioInStream.getFormat();
DataLine.Info info = new DataLine.Info(SourceDataLine.class,
audioFormat);
try {
line = (SourceDataLine) AudioSystem.getLine(info);
if (line != null) {
line.open(audioFormat);
}
if (line.isControlSupported(FloatControl.Type.MASTER_GAIN)) {
volCtrl = (FloatControl) line
.getControl(FloatControl.Type.MASTER_GAIN);
} else {
logger.warning("Master-Gain control is not supported."
+ " Volume will be fixed at the default level.");
}
} catch (LineUnavailableException ex) {
ex.printStackTrace();
}
}
StreamingPlayback.java 文件源码
java
阅读 20
收藏 0
点赞 0
评论 0
项目:QwickSound
作者:
评论列表
文章目录