/**
* synchronized methods, suspends the excution
* of other sounds until the first thread is
* done.class
*/
private static synchronized void render(String filename) {
new Thread(new Runnable() {
public void run() {
try {
Clip clip = AudioSystem.getClip();
AudioInputStream inputStream = AudioSystem.getAudioInputStream(
EventSounds.class.getResourceAsStream("resources/sounds/" + filename));
clip.open(inputStream);
clip.start();
Thread.sleep(clip.getMicrosecondLength() / 1000);
} catch (Exception error) {
System.out.println(error.getMessage());
}
}
}).start();
}
EventSounds.java 文件源码
java
阅读 28
收藏 0
点赞 0
评论 0
项目:Traversal
作者:
评论列表
文章目录