@Override
public void open() throws AudioException {
try {
this.audioInputStream = Audio.getAudioInputStream(this.resource);
this.clip = AudioSystem.getClip();
this.clip.open(this.audioInputStream);
this.clip.addLineListener(event -> {
if(event.getType().equals(LineEvent.Type.STOP) && this.clip.getMicrosecondPosition() >= this.clip.getMicrosecondLength()) {
this.trigger(AudioEvent.Type.REACHED_END);
}
});
this.controls = AbstractAudio.extractControls(this.clip, this.controls);
this.open = true;
this.trigger(AudioEvent.Type.OPENED);
} catch(Exception exception) {
throw new AudioException(exception);
}
}
BufferedAudio.java 文件源码
java
阅读 21
收藏 0
点赞 0
评论 0
项目:SimpleAudio
作者:
评论列表
文章目录