IAudioSessionEvents::OnSimpleVolumeChanged method (audiopolicy.h)

The OnSimpleVolumeChanged method notifies the client that the volume level or muting state of the audio session has changed.

Syntax

HRESULT OnSimpleVolumeChanged(
  [in] float   NewVolume,
  [in] BOOL    NewMute,
  [in] LPCGUID EventContext
);

Parameters

[in] NewVolume

The new volume level for the audio session. This parameter is a value in the range 0.0 to 1.0, where 0.0 is silence and 1.0 is full volume (no attenuation).

[in] NewMute

The new muting state. If TRUE, muting is enabled. If FALSE, muting is disabled.

[in] EventContext

The event context value. This is the same value that the caller passed to ISimpleAudioVolume::SetMasterVolume or ISimpleAudioVolume::SetMute in the call that changed the volume level or muting state of the session. For more information, see Remarks.

Return value

If the method succeeds, it returns S_OK. If it fails, it returns an error code.

Remarks

The session manager calls this method each time a call to the ISimpleAudioVolume::SetMasterVolume or ISimpleAudioVolume::SetMute method changes the volume level or muting state of the session.

The EventContext parameter provides a means for a client to distinguish between a volume or mute change that it initiated and one that some other client initiated. When calling the ISimpleAudioVolume::SetMasterVolume or ISimpleAudioVolume::SetMute method, a client passes in an EventContext parameter value that its implementation of the OnSimpleVolumeChanged method can recognize.

For a code example that implements the methods in the IAudioSessionEvents interface, see Audio Session Events.

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 audiopolicy.h

See also

IAudioSessionEvents Interface

ISimpleAudioVolume::SetMasterVolume

ISimpleAudioVolume::SetMute