Skip to main content

IAudioStateMonitor::RegisterCallback method

Registers a callback function that the system will call when the audio level of the streams that are associated with the IAudioStateMonitor changes.

Syntax

Parameters

callback
Type: AudioStateMonitorCallback*
A pointer to the callback function that is called by the system when there is a change in the audio level of the streams associated with IAudioStateMonitor. context
Type: void*
A pointer to the app-defined context data that will be passed into the function specified in the callback parameter. registration [out]
Type: AudioStateMonitorRegistration*
A 64-bit integer that identifies the callback registration. To unregister the function specified in the callback parameter, pass this value into IAudioStateMonitor::UnregisterCallback.

Return value

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.

Remarks

Consider the following scenario, where a game chooses to play GameMedia audio only when it is known that the audio will not be muted by the OS due to policy. In order to achieve this, the game registers for SoundLevel notifications for the AudioCategory_GameMedia stream category on the default console endpoint. If the SoundLevel for this category is set to ‘Muted’ then the game will stop playback of its GameMedia stream. If the SoundLevel is set to anything else, the game chooses to play its GameMedia stream.

Requirements

Header: Audiostatemonitorapi.h Supported platforms: Windows, XBOX One family consoles and XBOX Series consoles

See also

IAudioStateMonitor About WASAPI
Last modified on August 20, 2026