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

# SetShapePcmLoopCount

> SetShapePcmLoopCount

# SetShapePcmLoopCount

设置循环计数。

## 语法

```cpp theme={null}
HRESULT SetShapePcmLoopCount(  
         SHAPE_PCM_CONTEXT* context,  
         UINT32 loopCount  
)  
```

### 参数

*context*   \_Inout\_\
类型：[SHAPE\_PCM\_CONTEXT\*](/reference/audio/shapepcmcontext/structs/shape_pcm_context)

指向 [SHAPE\_PCM\_CONTEXT](/reference/audio/shapepcmcontext/structs/shape_pcm_context) 结构体的指针。

*loopCount*   \
类型：UINT32

指定循环计数。

### 返回值

类型：HRESULT

HRESULT 成功或错误代码。

## 备注

| 函数         | 说明                                                                                                                                                                                                                                          |
| ---------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| 非循环线性 PCM  | 使用 `SHAPE_SRC_COMMAND_TYPE_START` 常量为采样率转换器 (SRC) 启动语音。让语音播放到末尾，或者可选地使用 `SHAPE_SRC_COMMAND_TYPE_STOP_IMMEDIATE` 常量在末尾之前停止它。有关更多信息，请参阅 [SHAPE\_SRC\_COMMAND\_TYPE](/reference/audio/shapesrccontext/enums/shape_src_command_type) 枚举。        |
| 无限循环线性 PCM | 将脉冲编码调制 (PCM) 上下文循环计数 *loopCount* 设置为 `SHAPE_PCM_INFINITE_LOOP_COUNT` 常量。使用 `SHAPE_SRC_COMMAND_TYPE_START` 为 SRC 启动语音。让语音一直播放直到你想停止时，或者在循环结束时使用 `SHAPE_SRC_COMMAND_TYPE_STOP_END` 让语音播放完，或者立即使用 `SHAPE_SRC_COMMAND_TYPE_STOP_IMMEDIATE` 停止。 |
| 有限循环线性 PCM | 将 PCM 上下文循环计数 *loopCount* 设置为 \[0, 254]。使用 `SHAPE_SRC_COMMAND_TYPE_START` 为 SRC 启动语音。让语音播放到末尾，或者可选地在循环结束时使用 `SHAPE_SRC_COMMAND_TYPE_STOP_END` 停止并让语音播放完，或者立即使用 `SHAPE_SRC_COMMAND_TYPE_STOP_IMMEDIATE` 停止。                                  |
| 环形 PCM     | 使用 `SHAPE_SRC_COMMAND_TYPE_START` 为 SRC 启动语音。持续流式传输数据并更新 PCM 上下文写入指针，直到你想停止时。使用 `SHAPE_SRC_COMMAND_TYPE_STOP_END` 让 SRC 播放到当前 PCM 写入指针 `loopStartWritePointer`，或者使用 `SHAPE_SRC_COMMAND_TYPE_STOP_IMMEDIATE` 立即停止。                           |

## 要求

**标头：** shapepcmcontext.h

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

## 另请参阅

[ACP 概述](/build/console-features/audio/overviews/acp-overview)\
[Shape 概述](/build/console-features/audio/overviews/shape-overview)\
[shapepcmcontext](/reference/audio/shapepcmcontext/shapepcmcontext_members)


## Related topics

- [ShapePcmContext](/zh-CN/reference/audio/shapepcmcontext/shapepcmcontext_members.md)
- [SetShapePcmLoopEnd](/zh-CN/reference/audio/shapepcmcontext/functions/setshapepcmloopend.md)
- [SetShapePcmLoopStartOrWritePointer](/zh-CN/reference/audio/shapepcmcontext/functions/setshapepcmloopstartorwritepointer.md)
- [GetShapePcmLoopCount](/zh-CN/reference/audio/shapepcmcontext/functions/getshapepcmloopcount.md)
- [SetShapePcmFormat](/zh-CN/reference/audio/shapepcmcontext/functions/setshapepcmformat.md)
