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

# AudioStateMonitorCallback

> AudioStateMonitorCallback

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

## Syntax

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

### Parameters

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

The [IAudioStateMonitor](https://docs.xbox.com/reference/audio/audiostatemonitor/interfaces/iaudiostatemonitor.md) interface with which the callback was registered. Call the interface's [GetSoundLevel](https://docs.xbox.com/reference/audio/audiostatemonitor/interfaces/iaudiostatemonitor-getsoundlevel.md) 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](https://docs.xbox.com/build/console-features/audio/overviews/wasapi-overview.md)


## Related topics

- [IAudioStateMonitor::RegisterCallback method](https://docs.xbox.com/reference/audio/audiostatemonitor/interfaces/iaudiostatemonitor-registercallback.md)
- [AudioStateMonitor](https://docs.xbox.com/reference/audio/audiostatemonitor/audiostatemonitor_members.md)
- [IAudioStateMonitor interface](https://docs.xbox.com/reference/audio/audiostatemonitor/interfaces/iaudiostatemonitor.md)
- [IAudioStateMonitor::UnregisterCallback method](https://docs.xbox.com/reference/audio/audiostatemonitor/interfaces/iaudiostatemonitor-unregistercallback.md)
- [AudioStateMonitorRegistrationHandle](https://docs.xbox.com/reference/audio/audiostatemonitor/types/audiostatemonitorregistrationhandle.md)
