Microsoft SDK for Java

setVolume

This method of the DirectSoundBuffer Class changes the volume of a sound buffer.

Syntax

public void setVolume(int volume);

Parameters

volume New volume requested for this sound buffer. Values range from 0 (0 dB, no volume adjustment) to –10,000 (-100 dB, essentially silent). DirectSound does not currently support amplification.

Remarks

Volume units of are in hundredths of decibels, where 0 is the original volume of the stream.

Positive decibels correspond to amplification and negative decibels correspond to attenuation. The decibel scale corresponds to the logarithmic hearing characteristics of the ear. An attenuation of 10 dB makes a buffer sound half as loud; an attenuation of 20 dB makes a buffer sound one quarter as loud. DirectSound does not currently support amplification.

The pan control is cumulative with the volume control.

See Also

getPan, getVolume, setPan

© 1999 Microsoft Corporation. All rights reserved. Terms of use.