StreamingPlayback.java 文件源码

java
阅读 20 收藏 0 点赞 0 评论 0

项目:QwickSound 作者:
/**
 * 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();
    }
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号