> ## Documentation Index
> Fetch the complete documentation index at: https://devdocs.xbox.com/llms.txt
> Use this file to discover all available pages before exploring further.

# AudioStateMonitorCallback

> AudioStateMonitorCallback

# AudioStateMonitorCallback

The callback function, registered by calling  [IAudioStateMonitor::RegisterCallback](/reference/audio/audiostatemonitor/interfaces/iaudiostatemonitor-registercallback), is called by the system when the sound level of the audio streams associated with the  [IAudioStateMonitor](/reference/audio/audiostatemonitor/interfaces/iaudiostatemonitor) changes.

## Syntax

```cpp theme={null}
void CALLBACK AudioStateMonitorCallback(
  IAudioStateMonitor *audioStateMonitor,
  void *context
);
```

### Parameters

*audioStateMonitor* \_Out\_\
Type: IAudioStateMonitor\*

The [IAudioStateMonitor](/reference/audio/audiostatemonitor/interfaces/iaudiostatemonitor) interface with which the callback was registered. Call the interface's [GetSoundLevel](/reference/audio/audiostatemonitor/interfaces/iaudiostatemonitor-getsoundlevel) method to get the new current sound level of the associated audio streams.

*context*\
Type: void\*

An app-defined context object passed into the `RegisterCallback` method.

### Return value

This callback function does not return a value.

## Remarks

For convenience, Audiostatemonitorapi.h defines a pointer type for this callback as **PAudioStateMonitorCallback**.

The following code example shows how to register a new callback with  `AudioStateMonitor`. For convenience, *Audiostatemonitorapi.h* defines a pointer type for this callback as `PAudioStateMonitorCallback`.

```cpp theme={null}
// Registers a new callback with the AudioStateMonitor.

    STDMETHOD(RegisterCallback) (_In_ PAudioStateMonitorCallback callback, _In_opt_ void* context, _Out_ AudioStateMonitorRegistrationHandle* registration) PURE;
```

## Requirements

**Header:** Audiostatemonitorapi.h

**Supported platforms:** Windows, XBOX One family consoles and XBOX Series consoles

## See also

[AUDIO\_STREAM\_CATEGORY](https://learn.microsoft.com/windows/win32/api/audiosessiontypes/ne-audiosessiontypes-audio_stream_category)

[About WASAPI](https://learn.microsoft.com/windows/desktop/CoreAudio/wasapi)

[WASAPI](/build/console-features/audio/overviews/wasapi-overview)


## Related topics

- [IAudioStateMonitor::RegisterCallback method](/reference/audio/audiostatemonitor/interfaces/iaudiostatemonitor-registercallback.md)
- [Método IAudioStateMonitor::RegisterCallback](/es/reference/audio/audiostatemonitor/interfaces/iaudiostatemonitor-registercallback.md)
- [IAudioStateMonitor::RegisterCallback 方法](/zh-CN/reference/audio/audiostatemonitor/interfaces/iaudiostatemonitor-registercallback.md)
- [AudioStateMonitor](/reference/audio/audiostatemonitor/audiostatemonitor_members.md)
- [IAudioStateMonitor::RegisterCallback メソッド](/ja-jp/reference/audio/audiostatemonitor/interfaces/iaudiostatemonitor-registercallback.md)
