> ## 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*, SHAPE_XMA_SAMPLE_RATE)

> SetShapeXmaSampleRate(SHAPE_XMA_CONTEXT*, SHAPE_XMA_SAMPLE_RATE)

# SetShapeXmaSampleRate(SHAPE\_XMA\_CONTEXT\*, SHAPE\_XMA\_SAMPLE\_RATE)

设置采样率。

<a id="syntaxSection" />

## Syntax

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

<a id="parametersSection" />

### Parameters

*context*   \_Inout\_\
Type: [SHAPE\_XMA\_CONTEXT](/reference/audio/shapexmacontext/structs/shape_xma_context)\*

指向 [SHAPE\_XMA\_CONTEXT](/reference/audio/shapexmacontext/structs/shape_xma_context) 对象的指针。

*sampleRate*   \
Type: [SHAPE\_XMA\_SAMPLE\_RATE](/reference/audio/shapexmacontext/enums/shape_xma_sample_rate)

[SHAPE\_XMA\_SAMPLE\_RATE](/reference/audio/shapexmacontext/enums/shape_xma_sample_rate) 枚举的成员。

<a id="retvalSection" />

### Return value

Type: HRESULT

HRESULT 成功或错误代码。

<a id="remarksSection" />

## Remarks

若要通过指定整数来设置采样率,请使用 [SetShapeXmaSampleRate(SHAPE\_XMA\_CONTEXT\*, UINT32)](/reference/audio/shapexmacontext/functions/setshapexmasamplerate_2)。

若要获取当前采样率,请使用 [GetShapeXmaSampleRate](/reference/audio/shapexmacontext/functions/getshapexmasamplerate)。

有关详细信息,请参阅 [SHAPE 概述](/build/console-features/audio/overviews/shape-overview)的 [XMA](/build/console-features/audio/overviews/shape-overview#ID4EYD) 部分。

<a id="requirementsSection" />

## Requirements

**头文件:** shapexmacontext.h

**支持的平台:** XBOX One 系列主机和 XBOX Series 主机

<a id="seealsoSection" />

## See also

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


## Related topics

- [SHAPE_XMA_SAMPLE_RATE](/zh-CN/reference/audio/shapexmacontext/enums/shape_xma_sample_rate.md)
- [GetShapeXmaSampleRate](/zh-CN/reference/audio/shapexmacontext/functions/getshapexmasamplerate.md)
- [ShapeXmaContext](/zh-CN/reference/audio/shapexmacontext/shapexmacontext_members.md)
- [SHAPE_XMA_CONTEXT](/zh-CN/reference/audio/shapexmacontext/structs/shape_xma_context.md)
- [GetXmaSampleRate](/zh-CN/reference/audio/xma2defs/functions/getxmasamplerate.md)
