Controlling volume of a Clip when using Java Sound (javax,sound.sampled)
문제
I'm using Java sound to play back a number of sound samples with the Clip.start() method.
Given this, what is the best way to control the playback volume?
In particular, I'm very keen that the solution will work reliably across platforms.
해결책
FloatControl volume = (FloatControl) clip.getControl(FloatControl.Type.MASTER_GAIN);
volume.setValue(gainAmount);
Just replace gainAmount
with a float representing the gain in decibels. Can be positive or negative.
제휴하지 않습니다 StackOverflow