Java:淡出音乐 [英] Java: Fade out music
本文介绍了Java:淡出音乐的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在做游戏.现在,如果我的播放器升至另一个级别,音乐仍在播放.现在,我想让音乐淡出以开始下一个级别的新音乐.
I'm making a game. Now if my player goes to another level the music is still playing. Now I want to let the music fade out to let start the new music of the next level.
我使用mp3播放.使用以下软件包:jl1.0,mp3spi1.9.4,tritonus_share-0.3.6. 哦耶. FloatControll类不支持音量.
I use mp3 to play. With the packages: jl1.0, mp3spi1.9.4, tritonus_share-0.3.6. Oh yeah. Volume is not supported in the FloatControll class.
推荐答案
我想您正在尝试获取Volume
控件而不是MasterGain
.试试这个:
I suppose you're trying to get Volume
control instead of MasterGain
. Try this:
if (line.isControlSupported(FloatControl.Type.MASTER_GAIN)) {
masterGain = (FloatControl) line.getControl(FloatControl.Type.MASTER_GAIN);
}
这篇关于Java:淡出音乐的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文