Volume pr. Line basis?

Hi there.

I’m using SourceDataLine’s to play sound, and I’m trying to modify volume for each Line. However, the only controls that the line supports are Master Gain, Balance, Pan, and Mute. (Not Volume). Basically my question is, what the best practice to modify volumes on a line to line basis?

Thanks.

Use Master Gain. This formula will convert volume to gain:


float gain = (float) (Math.log(volume) / Math.log(10.0) * 20.0);

You need to cap the gain to min/max and possibly mute if it is less than min.

I guess my bad. I was under the impression that Master Gain was the “global” volume, affecting all my lines.

Thanks.