Microsoft DirectX 8.1 (C++)

IDirectMusicAudioPath8::SetVolume

The SetVolume method sets the audio volume on the path.

Syntax

HRESULT SetVolume(
  long lVolume,
  DWORD dwDuration
);

Parameters

lVolume

Value that specifies the attenuation, in hundredths of a decibel. This value must be in the range from -9600 to 0. Zero is full volume.

dwDuration

Value that specifies the time, in milliseconds, over which the volume change takes place. A value of 0 ensures maximum efficiency.

Return Values

If the method succeeds, the return value is S_OK.

If it fails, the method can return one of the error values shown in the following table.

Return code
DMUS_E_NOT_INIT
E_INVALIDARG

Remarks

This method works by sending a volume curve message. Any volume events occurring later, such as a band change, override the volume set by this method. IDirectMusicAudioPath8::SetVolume is useful mainly for adjusting currently playing sounds; for example, to fade out before stopping a segment. If you want to make a global change that affects all playback, use one of the following techniques:

Requirements

  Header: Declared in dmusici.h.

See Also