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

Defines decode or decode-convert activation parameters

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

Specifies the base command parameters to be sent to the hardware for processing. The same XApuCommandId will be set to [XApuResult::id](/reference/audio/xapu/structs/xapuresult).

*channelCount*\
Type: uint32\_t

Specifies the stream channel count. Only 1 and 2 are supported for mono and stereo respectively.

*initializeDataLength*\
Type: uint32\_t

Not used and should be set to zero.

*initializeData*\
Type: void\*

Not used and should be set to NULL.

*startPitch*\
Type: float

Start pitch if converter is active. In the decode only case, this value is ignored.

*processingBufferLength*\
Type: uint32\_t

Length of [XApuDecodeConvertActivateCommand::processingBuffer](/reference/audio/xapu/structs/xapudecodeconvertactivatecommand) in bytes. Must be a multiple of 16 in length.

*processingBuffer*\
Type: void\*

Intermediate buffer to store uncompressed PCM float (32-bit) data for [XApuProcessType::DecodeConvertOpus](/reference/audio/xapu/enums/xapuprocesstype) and [XApuProcessType::ConvertPCM](/reference/audio/xapu/enums/xapuprocesstype) types
The processing buffer is carved out of [XApuConnectOutputParameters::baseData](/reference/audio/xapu/structs/xapuconnectoutputparameters) and passed to XAPU through the [XApuCommandType::Activate](/reference/audio/xapu/enums/xapucommandtype) command using [XApuDecodeConvertActivateCommand::processingBuffer](/reference/audio/xapu/structs/xapudecodeconvertactivatecommand) and [XApuDecodeConvertActivateCommand::processingBufferLength](/reference/audio/xapu/structs/xapudecodeconvertactivatecommand) arguments

The processing buffer is necessary to store the intermediate PCM float (32-bit) data from the decoder that is not converted yet for the [XApuProcessType::DecodeConvertOpus](/reference/audio/xapu/enums/xapuprocesstype) case. For the [XApuProcessType::ConvertPCM](/reference/audio/xapu/enums/xapuprocesstype) case, it will store the PCM float data from the caller that is not converted yet. This buffer must be 16-byte aligned.
Also it stores converted data that is not ready to be out yet for both [XApuProcessType::DecodeConvertOpus](/reference/audio/xapu/enums/xapuprocesstype) and [XApuProcessType::ConvertPCM](/reference/audio/xapu/enums/xapuprocesstype) types.

XAPU internally divides the processing buffer into two segments; an input segment for unconverted input PCM data,
and an output segement for the converted output PCM data.

The length of the input segment should always be twice the length of the Opus packet duration i.e. (2 x 960 x ChannelCount x sizeof(float))

The output segment is used to store the converted data when it is less than 512 [XApuConnectInputParameters::maxFrameCountPerOutput](/reference/audio/xapu/structs/xapuconnectinputparameters)

The output segment will not be used when [XApuCommandOptions::Flush](/reference/audio/xapu/enums/xapucommandoptions) is set since XAPU will output the data even if it is less than [XApuConnectInputParameters::maxFrameCountPerOutput](/reference/audio/xapu/structs/xapuconnectinputparameters) frames.

The length of the output segment is [XApuConnectInputParameters::maxFrameCountPerOutput](/reference/audio/xapu/structs/xapuconnectinputparameters) x ChannelCount x sizeof(float)

[XApuDecodeConvertActivateCommand::processingBufferLength](/reference/audio/xapu/structs/xapudecodeconvertactivatecommand) is a constant number per stream and works for all pitch values from 1/8 to 8/1 and should be set as follows:

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

[XApuConnectInputParameters::maxFrameCountPerOutput](/reference/audio/xapu/structs/xapuconnectinputparameters) = 256, 480, 512, 960 or 1024.

## Remarks

Used by `XApuDecodeConvertActivateCommand` to decode and convert activation parameters. For information about the `XApuCommandId` members, see [XApuCommandId](/reference/audio/xapu/structs/xapucommandid). For information about the `XApuProcessType` constants, see [XApuProcessType](/reference/audio/xapu/enums/xapuprocesstype).

## Requirements

**Header:** xapu.h

**Supported platforms:** XBOX Series X|S

## See also

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


## Related topics

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