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

# XDspSubmitCommand

> XDspSubmitCommand

# XDspSubmitCommand

为给定的 XDSP 流向硬件队列提交一条命令。

## 语法

```cpp theme={null}
HRESULT XDspSubmitCommand(  
         XDspStreamHandle handle,  
         XDspCommand* command,  
         uint32_t* commandSequence  
)  
```

### 参数

*handle*   \_In\_\
类型：[XDspStreamHandle](/reference/audio/xdspaudio/handles/xdspstreamhandle)

有效的 XDSP 流句柄。

*command*   \_In\_\
类型：[XDspCommand\*](/reference/audio/xdspaudio/structs/xdspcommand)

指向 [XDspCommand](/reference/audio/xdspaudio/structs/xdspcommand) 结构的指针。

*commandSequence*   \_Out\_\
类型：uint32\_t\*

指向 `uint32_t` 的指针，用于返回命令序号值。有关其他详细信息，请参阅**备注**部分。

### 返回值

类型：HRESULT

如果方法成功，则返回 S\_OK。如果方法失败，则返回下列代码（部分列表）：

| 返回代码                          | 说明                                                                          |
| ----------------------------- | --------------------------------------------------------------------------- |
| E\_INVALIDARG                 | 一个或多个参数无效。                                                                  |
| XDSP\_E\_QUEUE\_FULL          | 如果流和硬件服务器达到了最大处理容量，此调用将返回 XDSP\_E\_QUEUE\_FULL。请等待硬件处理完成后再提交更多命令。           |
| XDSP\_E\_DEVICE\_FATAL\_ERROR | 如果硬件服务器处于错误状态，**XDspSubmitCommand** 将返回 XDSP\_E\_DEVICE\_FATAL\_ERROR 错误代码。 |

## 备注

此调用速度较快，因为它不会分配资源或处理数据，仅将命令发送到硬件服务器。

此调用还接受一个指向 `uint32_t` 的指针，用于返回命令序号值 *commandSequence*，以便日后跟踪命令结果何时就绪。此数字表示自会话开始以及在调用 [XDspActivate](/reference/audio/xdspaudio/functions/xdspactivate) 之后已成功提交的命令总数。第一条命令的数值为 1，之后每次 [XDspSubmitCommand](/reference/audio/xdspaudio/functions/xdspsubmitcommand) 调用成功时该数值都会加 1。

如果硬件服务器处于错误状态，**XDspSubmitCommand** 将返回 XDSP\_E\_DEVICE\_FATAL\_ERROR 错误代码。此时，无法为处于失败状态的 XDSP 流提交更多命令。该流对应的 [XDspStatus](/reference/audio/xdspaudio/structs/xdspstatus) 也将显示相同的错误。受影响的 XDSP 流应通过检查 [XDspStatus](/reference/audio/xdspaudio/structs/xdspstatus) 等待所有已提交的命令由硬件处理完毕，然后在所有命令处理完成后使用 [XDspDeactivate](/reference/audio/xdspaudio/functions/xdspdeactivate) 将其停用。其他 XDSP 流不会受到影响，硬件将继续处理它们的命令。

## 要求

**头文件：** XDspAudio.h

**库：** Chad.lib

**支持的平台：** XBOX Series X|S

## 概念文档

* [XDSP 包络处理概述](/build/console-features/audio/overviews/xdsp-overview-enveloping)
* [使用 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)\
[XDspSubmitCommandWithEnvelope](/reference/audio/xdspaudio/functions/xdspsubmitcommandwithenvelope)\
[XDSP Errors](/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

- [XDspSubmitCommandWithEnvelope](/zh-CN/reference/audio/xdspaudio/functions/xdspsubmitcommandwithenvelope.md)
- [XDspCommand](/zh-CN/reference/audio/xdspaudio/structs/xdspcommand.md)
- [XDspStatus](/zh-CN/reference/audio/xdspaudio/structs/xdspstatus.md)
- [XDSP 包络概述](/zh-CN/build/console-features/audio/overviews/xdsp-overview-enveloping.md)
- [XDspActivationParameters](/zh-CN/reference/audio/xdspaudio/structs/xdspactivationparameters.md)
