> ## 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.

# CreateRenderAudioStateMonitorForCategoryAndDeviceId

> CreateRenderAudioStateMonitorForCategoryAndDeviceId

# CreateRenderAudioStateMonitorForCategoryAndDeviceId

\[Some information relates to pre-released product which may be substantially modified before it's commercially released. Microsoft makes no warranties, express or implied, with respect to the information provided here.]

Creates a new instance of [IAudioStateMonitor](/reference/audio/audiostatemonitor/interfaces/iaudiostatemonitor) that monitors the audio level of all audio-rendering streams in the specified category for the audio endpoint with the specified `device` ID.

## Syntax

```cpp theme={null}
HRESULT WINAPI CreateRenderAudioStateMonitorForCategoryAndDeviceId(
  AUDIO_STREAM_CATEGORY category,
  PCWSTR deviceId,
  _Out_ IAudioStateMonitor **audioStateMonitor
);
```

### Parameters

*category*\
Type: AUDIO\_STREAM\_CATEGORY

A member of the **AUDIO\_STREAM\_CATEGORY** enumeration that specifies the category of the audio-rendering streams to be monitored.

*deviceId*\
Type: PCWSTR

A `device` ID that specifies the audio endpoint for which audio-rendering streams are monitored.

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

This output parameter is populated with the created `IAudioStateMonitor` object.

### Return value

Type: HRESULT

If the method succeeds, it returns `S\_OK`.

## Remarks

This is one of the functions that create and return an `AudioStateMonitor` instance.

There are four variants each for capture and render streams that determine whether a process can do one of the following for a given role:

* Capture or render any audio of any category
* Capture or render audio of a specific category
* Capture or render audio of a specific category, to a specific endpoint.\
  The endpoint may be specified using the`MMDevice` ID (obtained using `IMMDevice::GetId()`), or by using its `SWD` ID (obtained using `Windows.Devices.Enumeration` or `Windows.Media.Devices.MediaDevice`)
* Capture or render audio of a specific category to the default endpoint

## Requirements

**Header:** Audiostatemonitorapi.h

**Library:** Windows.Media.MediaControl.lib

**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)

[Audio Overview](/build/console-features/audio/overviews/audio)


## Related topics

- [IAudioStateMonitor interface](/reference/audio/audiostatemonitor/interfaces/iaudiostatemonitor.md)
- [AudioStateMonitor](/reference/audio/audiostatemonitor/audiostatemonitor_members.md)
- [CreateRenderAudioStateMonitorForCategory](/reference/audio/audiostatemonitor/functions/createrenderaudiostatemonitorforcategory.md)
- [CreateCaptureAudioStateMonitorForCategoryAndDeviceId](/reference/audio/audiostatemonitor/functions/createcaptureaudiostatemonitorforcategoryanddeviceid.md)
- [CreateRenderAudioStateMonitorForCategoryAndDeviceRole](/reference/audio/audiostatemonitor/functions/createrenderaudiostatemonitorforcategoryanddevicerole.md)
