IDirectSoundBuffer::SetVolume

HRESULT SetVolume(LONG lVolume);

Changes the volume of a sound buffer.

·Returns DS_OK if successful, or one of the following error values otherwise:

DSERR_CONTROLUNAVAIL DSERR_GENERIC
DSERR_INVALIDPARAM DSERR_PRIOLEVELNEEDED

lVolume

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.

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.