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

# XApuDecodeConvertActivateCommand

> XApuDecodeConvertActivateCommand

# XApuDecodeConvertActivateCommand

定义解码或解码转换的激活参数。

## Syntax

```cpp theme={null}
typedef struct XApuDecodeConvertActivateCommand {  
    XApuCommandId id;  
    uint32_t channelCount;  
    uint32_t initializeDataLength;  
    void* initializeData;  
    float startPitch;  
    uint32_t processingBufferLength;  
    void* processingBuffer;  
} XApuDecodeConvertActivateCommand  
```

### Members

*id*\
Type: [XApuCommandId](/reference/audio/xapu/structs/xapucommandid)

指定要发送到硬件进行处理的基本命令参数。相同的 XApuCommandId 将被设置到 [XApuResult::id](/reference/audio/xapu/structs/xapuresult) 中。

*channelCount*\
Type: uint32\_t

指定流的通道数。仅支持 1 和 2,分别对应单声道和立体声。

*initializeDataLength*\
Type: uint32\_t

未使用,应设置为零。

*initializeData*\
Type: void\*

未使用,应设置为 NULL。

*startPitch*\
Type: float

如果转换器处于活动状态时的起始音高。在仅解码的情况下,此值将被忽略。

*processingBufferLength*\
Type: uint32\_t

[XApuDecodeConvertActivateCommand::processingBuffer](/reference/audio/xapu/structs/xapudecodeconvertactivatecommand) 的长度(以字节为单位)。长度必须是 16 的倍数。

*processingBuffer*\
Type: void\*

用于存储 [XApuProcessType::DecodeConvertOpus](/reference/audio/xapu/enums/xapuprocesstype) 和 [XApuProcessType::ConvertPCM](/reference/audio/xapu/enums/xapuprocesstype) 类型的未压缩 PCM 浮点(32 位)数据的中间缓冲区。
处理缓冲区从 [XApuConnectOutputParameters::baseData](/reference/audio/xapu/structs/xapuconnectoutputparameters) 中划分出来,并通过 [XApuCommandType::Activate](/reference/audio/xapu/enums/xapucommandtype) 命令使用 [XApuDecodeConvertActivateCommand::processingBuffer](/reference/audio/xapu/structs/xapudecodeconvertactivatecommand) 和 [XApuDecodeConvertActivateCommand::processingBufferLength](/reference/audio/xapu/structs/xapudecodeconvertactivatecommand) 参数传递给 XAPU。

对于 [XApuProcessType::DecodeConvertOpus](/reference/audio/xapu/enums/xapuprocesstype) 场景,处理缓冲区用于存储来自解码器但尚未转换的中间 PCM 浮点(32 位)数据是必要的。对于 [XApuProcessType::ConvertPCM](/reference/audio/xapu/enums/xapuprocesstype) 场景,它将存储来自调用方尚未转换的 PCM 浮点数据。此缓冲区必须按 16 字节对齐。
此外,对于 [XApuProcessType::DecodeConvertOpus](/reference/audio/xapu/enums/xapuprocesstype) 和 [XApuProcessType::ConvertPCM](/reference/audio/xapu/enums/xapuprocesstype) 两种类型,它还存储尚未准备好输出的已转换数据。

XAPU 在内部将处理缓冲区分为两个段:一个输入段用于未转换的输入 PCM 数据,以及一个输出段用于已转换的输出 PCM 数据。

输入段的长度应始终为 Opus 数据包时长的两倍,即 (2 x 960 x ChannelCount x sizeof(float))

当已转换的数据少于 [XApuConnectInputParameters::maxFrameCountPerOutput](/reference/audio/xapu/structs/xapuconnectinputparameters) 512 时,使用输出段存储已转换的数据。

当设置了 [XApuCommandOptions::Flush](/reference/audio/xapu/enums/xapucommandoptions) 时,不会使用输出段,因为 XAPU 会输出数据,即便其少于 [XApuConnectInputParameters::maxFrameCountPerOutput](/reference/audio/xapu/structs/xapuconnectinputparameters) 帧。

输出段的长度为 [XApuConnectInputParameters::maxFrameCountPerOutput](/reference/audio/xapu/structs/xapuconnectinputparameters) x ChannelCount x sizeof(float)

[XApuDecodeConvertActivateCommand::processingBufferLength](/reference/audio/xapu/structs/xapudecodeconvertactivatecommand) 是每个流的常量,可用于从 1/8 到 8/1 的所有音高值,并且应按以下方式设置:

ProcessingBufferLength = (2 x 960 x ChannelCount x sizeof(float)) + ([XApuConnectInputParameters::maxFrameCountPerOutput](/reference/audio/xapu/structs/xapuconnectinputparameters) x ChannelCount x sizeof(float))\
ChannelCount = 1 或 2

[XApuConnectInputParameters::maxFrameCountPerOutput](/reference/audio/xapu/structs/xapuconnectinputparameters) = 256、480、512、960 或 1024。

## Remarks

`XApuDecodeConvertActivateCommand` 使用它来解码和转换激活参数。有关 `XApuCommandId` 成员的信息,请参阅 [XApuCommandId](/reference/audio/xapu/structs/xapucommandid)。有关 `XApuProcessType` 常量的信息,请参阅 [XApuProcessType](/reference/audio/xapu/enums/xapuprocesstype)。

## Requirements

**头文件:** xapu.h

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

## See also

[XApuEnqueueCommand](/reference/audio/xapu/functions/xapuenqueuecommand)\
[XAPU](/reference/audio/xapu/xapu_members)


## Related topics

- [XApuCommandId](/zh-CN/reference/audio/xapu/structs/xapucommandid.md)
- [XApuDecodeConvertCommand](/zh-CN/reference/audio/xapu/structs/xapudecodeconvertcommand.md)
- [XAPU](/zh-CN/reference/audio/xapu/xapu_members.md)
- [XApuEnqueueCommand](/zh-CN/reference/audio/xapu/functions/xapuenqueuecommand.md)
- [XApuConnectInputParameters](/zh-CN/reference/audio/xapu/structs/xapuconnectinputparameters.md)
