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

# SetShapePcmMode

> SetShapePcmMode

# SetShapePcmMode

設定 PCM 模式。

## 語法

```cpp theme={null}
HRESULT SetShapePcmMode(  
         SHAPE_PCM_CONTEXT* context,  
         SHAPE_PCM_MODE mode  
)  
```

### 參數

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

指向 [SHAPE\_PCM\_CONTEXT](/zh-TW/reference/audio/shapepcmcontext/structs/shape_pcm_context) 結構的指標。

*mode*   \
類型：[SHAPE\_PCM\_MODE](/zh-TW/reference/audio/shapepcmcontext/enums/shape_pcm_mode)

[SHAPE\_PCM\_MODE](/zh-TW/reference/audio/shapepcmcontext/enums/shape_pcm_mode) 列舉的其中一個成員。

### 傳回值

類型：HRESULT

HRESULT 成功或錯誤碼。

## 備註

取樣率轉換器 (SRC) 會以單聲道或立體聲模式運作。脈衝碼調變 (PCM) 資料會從記憶體讀取，並轉換成通用的 24 位元定點格式以進行取樣率轉換。輸出會依模式寫入一個或兩個混音緩衝區。立體聲資料在記憶體中儲存為交錯的 16 位元資料串流，左聲道位於每個 32 位元字組的最低有效 16 位元，右聲道位於最高有效 16 位元。在立體聲模式中，PCM 資料會在讀取的同時解除交錯。左聲道資料 (偶數編號樣本) 會經過處理並輸出至一個混音緩衝區，右聲道資料 (奇數編號樣本) 則會寫入第二個混音緩衝區。

## 需求

**標頭：** shapepcmcontext.h

**支援的平台：** XBOX One 系列主機與 XBOX Series 主機

## 另請參閱

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


## Related topics

- [ShapePcmContext](/zh-TW/reference/audio/shapepcmcontext/shapepcmcontext_members.md)
- [SHAPE_PCM_MODE](/zh-TW/reference/audio/shapepcmcontext/enums/shape_pcm_mode.md)
- [GetShapePcmMode](/zh-TW/reference/audio/shapepcmcontext/functions/getshapepcmmode.md)
- [SetShapePcmFormat](/zh-TW/reference/audio/shapepcmcontext/functions/setshapepcmformat.md)
- [SetShapePcmAudioBuffer](/zh-TW/reference/audio/shapepcmcontext/functions/setshapepcmaudiobuffer_2.md)
