문제

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.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top