views:

21

answers:

1

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.

A: 
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.

qmega