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

# XDspActivate

> XDspActivate

# XDspActivate

プールから空き処理リソースを取得することで XDSP ストリームをアクティブ化します。各 XDSP クライアントは 256 個のストリーム アクティブ化に制限されています。

## 構文

```cpp theme={null}
HRESULT XDspActivate(  
         XDspClientHandle clientHandle,  
         XDspActivationParameters* params,  
         XDspStatus** status,  
         XDspStreamHandle* streamHandle  
)  
```

### パラメーター

*clientHandle*   \_In\_\
型: [XDspClientHandle](/reference/audio/xdspaudio/handles/xdspclienthandle)

XDspConnect の呼び出しから取得した有効な XDSP クライアント ハンドル。

*params*   \_In\_\
型: [XDspActivationParameters\*](/reference/audio/xdspaudio/structs/xdspactivationparameters)

[XDspActivationParameters](/reference/audio/xdspaudio/structs/xdspactivationparameters) 構造体へのポインター。

*status*   \_Outptr\_\
型: [XDspStatus\*\*](/reference/audio/xdspaudio/structs/xdspstatus)

[XDspStatus](/reference/audio/xdspaudio/structs/xdspstatus) 構造体へのポインター。詳細については、**解説** セクションを参照してください。

*streamHandle*   \_Outptr\_\
型: [XDspStreamHandle\*](/reference/audio/xdspaudio/handles/xdspstreamhandle)

呼び出しが成功した場合の、有効な [XDspStreamHandle](/reference/audio/xdspaudio/handles/xdspstreamhandle)。詳細については、**解説** セクションを参照してください。

### 戻り値

型: HRESULT

メソッドが成功した場合は S\_OK を返します。失敗した場合は次のコードのいずれかを返します (一部の一覧):

| 戻りコード                                       | 説明                                                                                                                                                                                                     |
| ------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| E\_POINTER                                  | 有効でないポインター。                                                                                                                                                                                            |
| E\_INVALIDARG                               | 1 つ以上の引数が無効です。                                                                                                                                                                                         |
| XDSP\_E\_NO\_DEVICE\_RESOURCES              | 要求を処理するために利用可能な XDSP デバイス リソースがありません。                                                                                                                                                                  |
| XDSP\_E\_INVALID\_IMPULSE\_RESPONSE\_LENGTH | 指定されたインパルス応答長が無効です。このエラーは、(`9 * blockSize * 2`) 未満、または 16 秒 (`16 * 48000 * 2`) を超える [impulseResponseLengthInFloats](/reference/audio/xdspaudio/structs/xdspactivationparameters) が指定された場合に発生することがあります。 |

## 解説

この呼び出しは、リソースを割り当てるのではなくプールから取得するため、高速です。

呼び出し元は、XDSP ストリームが実行する [XDspProcessType](/reference/audio/xdspaudio/enums/xdspprocesstype) を指定する必要があります。XDSP ストリームのインスタンスは、そのライフタイム中に 1 つの処理タイプのみで動作できます。2 つ以上の異なる処理タイプを実行するには、2 つ以上の XDSP ストリーム インスタンスをインスタンス化する必要があります。

[XDspActivationParameters](/reference/audio/xdspaudio/structs/xdspactivationparameters) 構造体内で、呼び出し元は次を指定する必要があります:

* アクティベーション オプション。
* 各コマンドで処理されるフレーム数 (入力および出力のフレーム数)。
* ストリームのチャネル数。モノラルおよびステレオの入力ストリームのみがサポートされます。
* [XDspProcessType::Convolution](/reference/audio/xdspaudio/enums/xdspprocesstype) 処理タイプの場合、float 単位のインパルス応答長。
* [XDspProcessType::Convolution](/reference/audio/xdspaudio/enums/xdspprocesstype) 処理タイプの場合、周波数領域の値としてのインパルス応答。

呼び出しが成功すると、このストリームに対する他の呼び出し ([XDspSubmitCommand](/reference/audio/xdspaudio/functions/xdspsubmitcommand)、[XDspSubmitCommandWithEnvelope](/reference/audio/xdspaudio/functions/xdspsubmitcommandwithenvelope)、[XDspDeactivate](/reference/audio/xdspaudio/functions/xdspdeactivate)) で使用する有効な [XDspStreamHandle](/reference/audio/xdspaudio/handles/xdspstreamhandle) が返されます。また、この呼び出しが成功すると、送信されたコマンドの状態を確認するために使用できる [XDspStatus](/reference/audio/xdspaudio/structs/xdspstatus) へのポインターが返されます。

これは、処理された最新のコマンドと、送信されたコマンドの結果を消費する準備ができているかどうかを判断するために使用する必要があります。
[XDspStatus](/reference/audio/xdspaudio/structs/xdspstatus) には、ハードウェアに送信された最後のコマンドのシーケンス番号と、それが表す XDSP ストリームの最初に失敗したコマンドのシーケンス番号もあります。畳み込み処理の場合、呼び出し元はこの呼び出しが返った後にインパルス応答のメモリを解放できます。

## 要件

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

**ライブラリ:** Chad.lib

**サポートされるプラットフォーム:** XBOX Series X|S

## 概念ドキュメント

* [XDSP API を使用したエンベロープ付き単一ストリーム畳み込みの概要](/build/console-features/audio/overviews/xdsp-overview-single-stream-convolution-with-envelope)
* [XDSP API を使用した単一ストリーム畳み込みの概要](/build/console-features/audio/overviews/xdsp-overview-single-stream-convolution)
* [XDSP の概要](/build/console-features/audio/overviews/xdsp-overview)

## 関連項目

[XDSP](/reference/audio/xdspaudio/xdspaudio_members)\
[XDSP エラー](/reference/audio/xdspaudio/enums/xdsperrors)\
[XDSP API を使用した単一ストリーム畳み込みの概要](/build/console-features/audio/overviews/xdsp-overview-single-stream-convolution)\
[XDSP API を使用した単一ストリーム FFT/IFFT の概要](/build/console-features/audio/overviews/xdsp-overview-single-stream-fft-ifft)\
[XDSP API を使用したエンベロープ付き単一ストリーム畳み込みの概要](/build/console-features/audio/overviews/xdsp-overview-single-stream-convolution-with-envelope)


## Related topics

- [XDspDeactivate](/ja-jp/reference/audio/xdspaudio/functions/xdspdeactivate.md)
- [XDSP の概要](/ja-jp/build/console-features/audio/overviews/xdsp-overview.md)
- [XDSP API を使用したシングル ストリーム コンボリューションの概要](/ja-jp/build/console-features/audio/overviews/xdsp-overview-single-stream-convolution.md)
- [XDSP API を使用したエンベロープ付きシングル ストリーム コンボリューション](/ja-jp/build/console-features/audio/overviews/xdsp-overview-single-stream-convolution-with-envelope.md)
- [XDspConnectWithMaximumStreamLimit](/ja-jp/reference/audio/xdspaudio/functions/xdspconnectwithmaximumstreamlimit.md)
