Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

IAudioEndpointVolume::SetChannelVolumeLevel method

The SetChannelVolumeLevel method sets the volume level, in decibels, of the specified channel of the audio stream that enters or leaves the audio endpoint device.

Syntax


HRESULT SetChannelVolumeLevel(
  [in]  UINT nChannel,
  [in]  float fLevelDB,
  [in]  LPCGUID pguidEventContext
);

Parameters

nChannel [in]

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.

fLevelDB [in]

The new volume level in decibels. To obtain the range and granularity of the volume levels that can be set by this method, call the IAudioEndpointVolume::GetVolumeRange method.

pguidEventContext [in]

Context value for the IAudioEndpointVolumeCallback::OnNotify method. This parameter points to an event-context GUID. If the SetChannelVolumeLevel call changes the volume level of the endpoint, all clients that have registered IAudioEndpointVolumeCallback interfaces with that endpoint will receive notifications. In its implementation of the OnNotify method, a client can inspect the event-context GUID to discover whether it or another client is the source of the volume-change event. If the caller supplies a NULL pointer for this parameter, the notification routine receives the context GUID value GUID_NULL.

Return value

If the method succeeds and the volume level changes, the method returns S_OK. If the method succeeds and the new volume level is the same as the previous volume level, the method returns S_FALSE. If the method fails, possible return codes include, but are not limited to, the values shown in the following table.

Return codeDescription
E_INVALIDARG

Parameter nChannel is greater than or equal to the number of channels in the stream; or parameter fLevelDB lies outside of the volume range supported by the device.

E_OUTOFMEMORY

Out of memory.

 

Remarks

If volume level fLevelDB falls outside of the volume range reported by the IAudioEndpointVolume::GetVolumeRange method, the SetChannelVolumeLevel call fails and returns error code E_INVALIDARG.

Requirements

Minimum supported client

Windows Vista [desktop apps | Windows Store apps]

Minimum supported server

Windows Server 2008 [desktop apps | Windows Store apps]

Header

Endpointvolume.h

See also

IAudioEndpointVolume Interface
IAudioEndpointVolume::GetChannelCount
IAudioEndpointVolume::GetVolumeRange
IAudioEndpointVolumeCallback Interface
IAudioEndpointVolumeCallback::OnNotify

 

 

Community Additions

Show:
© 2014 Microsoft