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

# SetShapeXmaSampleRate(SHAPE_XMA_CONTEXT*, UINT32)

> 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](/reference/audio/shapexmacontext/structs/shape_xma_context)\*

Pointer to a [SHAPE\_XMA\_CONTEXT](/reference/audio/shapexmacontext/structs/shape_xma_context) 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](/reference/audio/shapexmacontext/enums/shape_xma_sample_rate) 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](/reference/audio/shapexmacontext/enums/shape_xma_sample_rate) enumeration instead of an integer, use [SetShapeXmaSampleRate(SHAPE\_XMA\_CONTEXT\*, SHAPE\_XMA\_SAMPLE\_RATE)](/reference/audio/shapexmacontext/functions/setshapexmasamplerate).

To get the current sample rate, use [GetShapeXmaSampleRate](/reference/audio/shapexmacontext/functions/getshapexmasamplerate).

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

## Requirements

**Header:** shapexmacontext.h

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

## See also

[ShapeXmaContext](/reference/audio/shapexmacontext/shapexmacontext_members)


## Related topics

- [SetShapeXmaSampleRate(SHAPE_XMA_CONTEXT*, SHAPE_XMA_SAMPLE_RATE)](/reference/audio/shapexmacontext/functions/setshapexmasamplerate.md)
- [SHAPE_XMA_SAMPLE_RATE](/reference/audio/shapexmacontext/enums/shape_xma_sample_rate.md)
- [GetShapeXmaSampleRate](/reference/audio/shapexmacontext/functions/getshapexmasamplerate.md)
- [ShapeXmaContext](/reference/audio/shapexmacontext/shapexmacontext_members.md)
- [SHAPE_XMA_CONTEXT](/reference/audio/shapexmacontext/structs/shape_xma_context.md)
