IAudioStreamVolume::SetAllVolumes method

The SetAllVolumes method sets the individual volume levels for all the channels in the audio stream.

Syntax

HRESULT SetAllVolumes(
  UINT32      dwCount,
  const float *pfVolumes
);

Parameters

dwCount

The number of elements in the pfVolumes array. This parameter must equal the number of channels in the stream format. To get the number of channels, call the IAudioStreamVolume::GetChannelCount method.

pfVolumes

Pointer to an array of volume levels for the channels in the audio stream. The number of elements in the pfVolumes array is specified by the dwCount parameter. The caller writes the volume level for each channel to the array element whose index matches the channel number. If the stream format has N channels, the channels are numbered from 0 to N– 1. Valid volume levels are in the range 0.0 to 1.0.

Return Value

If the method succeeds, it returns S_OK. If it fails, possible return codes include, but are not limited to, the values shown in the following table.

Return code Description
E_INVALIDARG
Parameter dwCount does not equal the number of channels in the stream, or the value of a pfVolumes array element is not in the range 0.0 to 1.0.
E_POINTER
Parameter pfVolumes is NULL.
AUDCLNT_E_DEVICE_INVALIDATED
The audio endpoint device has been unplugged, or the audio hardware or associated hardware resources have been reconfigured, disabled, removed, or otherwise made unavailable for use.
AUDCLNT_E_SERVICE_NOT_RUNNING
The Windows audio service is not running.

Requirements

   
Minimum supported client Windows Vista [desktop apps only]
Minimum supported server Windows Server 2008 [desktop apps only]
Target Platform Windows
Header audioclient.h

See Also

IAudioStreamVolume Interface

IAudioStreamVolume::GetChannelCount