/**
* Constructor that starts off the VNSound tool with a sound at a certain volume. Will not loop.
*
* @param file - the file path and name of the audio to play
* @param volume - volume to play the file at
*/
public VNSound(File file, float volume) {
try {
audio = AudioSystem.getAudioInputStream(file);
clip = AudioSystem.getClip();
clip.open(audio);
volumeControl = (FloatControl) clip.getControl(FloatControl.Type.MASTER_GAIN);
setVolume(volume);
clip.start();
}
catch(UnsupportedAudioFileException uae) {
System.out.println(uae);
}
catch(IOException ioe) {
System.out.println(ioe);
}
catch(LineUnavailableException lua) {
System.out.println(lua);
}
}
VNSound.java 文件源码
java
阅读 21
收藏 0
点赞 0
评论 0
项目:VN-RW
作者:
评论列表
文章目录