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

\[一部の情報は、市販前に大幅に変更される可能性のあるプレリリース製品に関するものです。Microsoft は、ここに記載されている情報に関して、明示または黙示のいかなる保証も行いません。]

指定した `device` ID を持つオーディオ エンドポイントについて、指定したカテゴリのすべてのオーディオ レンダリング ストリームのオーディオ レベルを監視する、[IAudioStateMonitor](/reference/audio/audiostatemonitor/interfaces/iaudiostatemonitor) の新しいインスタンスを作成します。

## 構文

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

### パラメーター

*category*\
型: AUDIO\_STREAM\_CATEGORY

監視するオーディオ レンダリング ストリームのカテゴリを指定する、**AUDIO\_STREAM\_CATEGORY** 列挙型のメンバーです。

*deviceId*\
型: PCWSTR

オーディオ レンダリング ストリームが監視されるオーディオ エンドポイントを指定する `device` ID です。

*audioStateMonitor* \_Out\_\
型: IAudioStateMonitor\*\*

作成された `IAudioStateMonitor` オブジェクトがこの出力パラメーターに設定されます。

### 戻り値

型: HRESULT

メソッドが成功した場合、`S\_OK` が返されます。

## 解説

これは、`AudioStateMonitor` インスタンスを作成して返す関数の 1 つです。

キャプチャ ストリームとレンダー ストリームのそれぞれに 4 つのバリアントがあり、特定のロールに対してプロセスが以下のいずれを実行できるかを決定します。

* あらゆるカテゴリの任意のオーディオをキャプチャまたはレンダリングする
* 特定のカテゴリのオーディオをキャプチャまたはレンダリングする
* 特定のカテゴリのオーディオを特定のエンドポイントに対してキャプチャまたはレンダリングする。エンドポイントは `MMDevice` ID (`IMMDevice::GetId()` を使用して取得) または `SWD` ID (`Windows.Devices.Enumeration` あるいは `Windows.Media.Devices.MediaDevice` を使用して取得) を用いて指定できます。
* 特定のカテゴリのオーディオを既定のエンドポイントに対してキャプチャまたはレンダリングする

## 要件

**ヘッダー:** Audiostatemonitorapi.h

**ライブラリ:** Windows.Media.MediaControl.lib

**サポートされるプラットフォーム:** Windows、XBOX One ファミリ本体および XBOX Series 本体

## 関連項目

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

[WASAPI について](https://learn.microsoft.com/windows/desktop/CoreAudio/wasapi)

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

[オーディオの概要](/build/console-features/audio/overviews/audio)


## Related topics

- [IAudioStateMonitor インターフェイス](/ja-jp/reference/audio/audiostatemonitor/interfaces/iaudiostatemonitor.md)
- [AudioStateMonitor](/ja-jp/reference/audio/audiostatemonitor/audiostatemonitor_members.md)
- [CreateRenderAudioStateMonitorForCategoryAndDeviceRole](/ja-jp/reference/audio/audiostatemonitor/functions/createrenderaudiostatemonitorforcategoryanddevicerole.md)
- [CreateRenderAudioStateMonitorForCategory](/ja-jp/reference/audio/audiostatemonitor/functions/createrenderaudiostatemonitorforcategory.md)
- [CreateCaptureAudioStateMonitorForCategoryAndDeviceId](/ja-jp/reference/audio/audiostatemonitor/functions/createcaptureaudiostatemonitorforcategoryanddeviceid.md)
