IAudioEndpointVolume::GetChannelVolumeLevelScalar method (endpointvolume.h)

The GetChannelVolumeLevelScalar method gets the normalized, audio-tapered volume level of the specified channel of the audio stream that enters or leaves the audio endpoint device.

Syntax

HRESULT GetChannelVolumeLevelScalar(
  [in]  UINT  nChannel,
  [out] float *pfLevel
);

Parameters

[in] nChannel

The channel number. If the audio stream contains n channels, the channels are numbered from 0 to n– 1. To obtain the number of channels, call the IAudioEndpointVolume::GetChannelCount method.

[out] pfLevel

Pointer to a float variable into which the method writes the volume level. The level is expressed as a normalized value in the range from 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 nChannel is greater than or equal to the number of channels in the stream.
E_POINTER
Parameter pfLevel is NULL.

Remarks

The volume level is normalized to the range from 0.0 to 1.0, where 0.0 is the minimum volume level and 1.0 is the maximum level. Within this range, the relationship of the normalized volume level to the attenuation of signal amplitude is described by a nonlinear, audio-tapered curve. Note that the shape of the curve might change in future versions of Windows. For more information about audio-tapered curves, see Audio-Tapered Volume Controls.

The normalized volume levels that are retrieved by this method are suitable to represent the positions of volume controls in application windows and on-screen displays.

Requirements

Requirement Value
Minimum supported client Windows Vista [desktop apps | UWP apps]
Minimum supported server Windows Server 2008 [desktop apps | UWP apps]
Target Platform Windows
Header endpointvolume.h

See also

IAudioEndpointVolume Interface

IAudioEndpointVolume::GetChannelCount