The SetChannelVolume method sets the volume level for the specified channel in the audio stream.
public:
HRESULT SetChannelVolume(
UINT32 dwIndex,
const float fLevel
)
dwIndex
Type: UINT32
[in]
The channel number. If the stream format has N channels, the channels are numbered from 0 to N– 1. To get the number of channels, call the IAudioStreamVolume::GetChannelCount method.
fLevel
Type: float
[in]
The volume level for the channel. Valid volume levels are in the range 0.0 to 1.0.
Type: HRESULT
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 dwIndex is set to an invalid channel number, or parameter fLevel is not in the range 0.0 to 1.0. |
| 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. |
Refer to WASAPI error codes.
Header: Declared in audioclient.h.
Library: Use mmdevapi.lib.