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

Activate XDSP stream by acquiring a free processing resource from the pool. Each XDSP client is limited to 256 stream activations.

## Syntax

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

### Parameters

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

A valid XDSP client handle obtained from the call to XDspConnect.

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

Pointer to an [XDspActivationParameters](/reference/audio/xdspaudio/structs/xdspactivationparameters) structure.

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

Pointer to an [XDspStatus](/reference/audio/xdspaudio/structs/xdspstatus) structure. See the **Remarks** section for additional details.

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

Valid [XDspStreamHandle](/reference/audio/xdspaudio/handles/xdspstreamhandle), if the call succeeds.  See the **Remarks** section for additional details.

### Return value

Type: HRESULT

If the method succeeds, it returns S\_OK. If the method fails, it returns one of the following codes (partial list):

| Return code                                 | Description                                                                                                                                                                                                                                                          |
| ------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| E\_POINTER                                  | Pointer that is not valid.                                                                                                                                                                                                                                           |
| E\_INVALIDARG                               | One or more of the arguments are invalid.                                                                                                                                                                                                                            |
| XDSP\_E\_NO\_DEVICE\_RESOURCES              | No XDSP device resources are available to service your request.                                                                                                                                                                                                      |
| XDSP\_E\_INVALID\_IMPULSE\_RESPONSE\_LENGTH | The impulse response length provided is invalid. This error may occur if an [impulseResponseLengthInFloats](/reference/audio/xdspaudio/structs/xdspactivationparameters) of less than  (`9 * blockSize * 2`) or more than 16 seconds (`16 * 48000 * 2`) is provided. |

## Remarks

This call is quick as it acquires resources from the pool instead of allocating them.

The caller must specify an [XDspProcessType](/reference/audio/xdspaudio/enums/xdspprocesstype) for the XDSP stream to perform. An instance of XDSP stream can work with one processing type only during its lifetime. To perform two or more different processing types, two or more XDSP stream instances must be instantiated.

Inside the [XDspActivationParameters](/reference/audio/xdspaudio/structs/xdspactivationparameters) structure, the caller must specify the following:

* Activation options.
* Number of frames that will be processed in each command, i.e. the input and output number of frames.
* Number of channels of the stream. Only mono and stereo input streams are supported.
* For [XDspProcessType::Convolution](/reference/audio/xdspaudio/enums/xdspprocesstype) processing type, the length of the impulse response in floats.
* For [XDspProcessType::Convolution](/reference/audio/xdspaudio/enums/xdspprocesstype) processing type, the impulse response as frequency domain values.

If the call succeeds, a valid [XDspStreamHandle](/reference/audio/xdspaudio/handles/xdspstreamhandle) will be returned to be used with other calls ([XDspSubmitCommand](/reference/audio/xdspaudio/functions/xdspsubmitcommand), [XDspSubmitCommandWithEnvelope](/reference/audio/xdspaudio/functions/xdspsubmitcommandwithenvelope), [XDspDeactivate](/reference/audio/xdspaudio/functions/xdspdeactivate)) for this stream. Also, if this call succeeds it will return a pointer to [XDspStatus](/reference/audio/xdspaudio/structs/xdspstatus) that can be used to check the status of the submitted commands.

This should be used to determine the latest command that has been processed and whether the results from the submitted commands are ready to be consumed.
[XDspStatus](/reference/audio/xdspaudio/structs/xdspstatus) also has the sequence number of the last command that was submitted to the hardware and the sequence number of the first failed command for the XDSP stream that it represents. In case of convolution processing, the caller may free the impulse response memory after this call returns.

## Requirements

**Header:** XDspAudio.h

**Library:** Chad.lib

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

## Conceptual documentation

* [Overview of a single stream Convolution with Envelope using the XDSP API](/build/console-features/audio/overviews/xdsp-overview-single-stream-convolution-with-envelope)
* [Overview of a single stream Convolution using the XDSP API](/build/console-features/audio/overviews/xdsp-overview-single-stream-convolution)
* [XDSP overview](/build/console-features/audio/overviews/xdsp-overview)

## See also

[XDSP](/reference/audio/xdspaudio/xdspaudio_members)\
[XDSP Errors](/reference/audio/xdspaudio/enums/xdsperrors)\
[Overview of a single stream Convolution using the XDSP API](/build/console-features/audio/overviews/xdsp-overview-single-stream-convolution)\
[Overview of a single stream FFT/IFFT using the XDSP API](/build/console-features/audio/overviews/xdsp-overview-single-stream-fft-ifft)\
[Overview of a single stream Convolution with Envelope using the XDSP API](/build/console-features/audio/overviews/xdsp-overview-single-stream-convolution-with-envelope)


## Related topics

- [XDspDeactivate](/reference/audio/xdspaudio/functions/xdspdeactivate.md)
- [XDSP audio](/reference/audio/xdspaudio/xdspaudio_members.md)
- [XDspConnectWithMaximumStreamLimit](/reference/audio/xdspaudio/functions/xdspconnectwithmaximumstreamlimit.md)
- [XDspConnect](/reference/audio/xdspaudio/functions/xdspconnect.md)
- [XDSP overview](/build/console-features/audio/overviews/xdsp-overview.md)
