> ## Documentation Index
> Fetch the complete documentation index at: https://docs.xbox.com/llms.txt
> Use this file to discover all available pages before exploring further.

# SetShapeXmaSampleRate(SHAPE_XMA_CONTEXT*, UINT32)

> SetShapeXmaSampleRate(SHAPE_XMA_CONTEXT*, UINT32)

Sets the sample rate.

## Syntax

```cpp theme={null}
HRESULT SetShapeXmaSampleRate(  
         SHAPE_XMA_CONTEXT* context,  
         UINT32 sampleRate  
)  
```

### Parameters

*context*   \_Inout\_\
Type: [SHAPE\_XMA\_CONTEXT](https://docs.xbox.com/reference/audio/shapexmacontext/structs/shape_xma_context.md)\*

Pointer to a [SHAPE\_XMA\_CONTEXT](https://docs.xbox.com/reference/audio/shapexmacontext/structs/shape_xma_context.md) object.

*sampleRate*   \
Type: UINT32

The sample rate, in hertz.

### Return value

Type: HRESULT

HRESULT success or error code.

## Remarks

The *sampleRate* parameter is converted to a member of the [SHAPE\_XMA\_SAMPLE\_RATE](https://docs.xbox.com/reference/audio/shapexmacontext/enums/shape_xma_sample_rate.md) enumeration, as shown in the following table.

| Value | Member |
| - | - |
| \<= 24000 | SHAPE\_XMA\_SAMPLE\_RATE\_24K |
| 24001-32000 | SHAPE\_XMA\_SAMPLE\_RATE\_32K |
| 32001-44100 | SHAPE\_XMA\_SAMPLE\_RATE\_44\_1K |
| >= 44101 | SHAPE\_XMA\_SAMPLE\_RATE\_48K |

To set the sample rate by using a member of the [SHAPE\_XMA\_SAMPLE\_RATE](https://docs.xbox.com/reference/audio/shapexmacontext/enums/shape_xma_sample_rate.md) enumeration instead of an integer, use [SetShapeXmaSampleRate(SHAPE\_XMA\_CONTEXT\*, SHAPE\_XMA\_SAMPLE\_RATE)](https://docs.xbox.com/reference/audio/shapexmacontext/functions/setshapexmasamplerate.md).

To get the current sample rate, use [GetShapeXmaSampleRate](https://docs.xbox.com/reference/audio/shapexmacontext/functions/getshapexmasamplerate.md).

For more information, see the [XMA](https://docs.xbox.com/build/console-features/audio/overviews/shape-overview.md#ID4EYD) section of [Overview of SHAPE](https://docs.xbox.com/build/console-features/audio/overviews/shape-overview.md).

## Requirements

**Header:** shapexmacontext.h

**Supported platforms:** XBOX One family consoles and XBOX Series consoles

## See also

[ShapeXmaContext](https://docs.xbox.com/reference/audio/shapexmacontext/shapexmacontext_members.md)


## Related topics

- [SetShapeXmaSampleRate(SHAPE_XMA_CONTEXT*, SHAPE_XMA_SAMPLE_RATE)](https://docs.xbox.com/reference/audio/shapexmacontext/functions/setshapexmasamplerate.md)
- [SHAPE_XMA_SAMPLE_RATE](https://docs.xbox.com/reference/audio/shapexmacontext/enums/shape_xma_sample_rate.md)
- [GetShapeXmaSampleRate](https://docs.xbox.com/reference/audio/shapexmacontext/functions/getshapexmasamplerate.md)
- [ShapeXmaContext](https://docs.xbox.com/reference/audio/shapexmacontext/shapexmacontext_members.md)
- [SetShapeXmaOutputBuffer(SHAPE_XMA_CONTEXT*, void*)](https://docs.xbox.com/reference/audio/shapexmacontext/functions/setshapexmaoutputbuffer.md)
