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

# AcpHalAllocateShapeContexts

> AcpHalAllocateShapeContexts

# AcpHalAllocateShapeContexts

為可調整硬體音訊處理引擎 (SHAPE) 和 XBOX Media Audio (XMA) 配置內容陣列。

## 語法

```cpp theme={null}
HRESULT AcpHalAllocateShapeContexts(  
         SHAPE_CONTEXTS* contextArrays  
)  
```

### 參數

*contextArrays*   \_Inout\_\
類型：[SHAPE\_CONTEXTS\*](/zh-TW/reference/audio/acphal/structs/shape_contexts)

輸入時，內容應包含內容陣列的要求大小。如果函式成功，內容會填入已配置的陣列。請參閱 [SHAPE\_DMA\_CONTEXT](/zh-TW/reference/audio/shapedmacontext/structs/shape_dma_context)、[SHAPE\_EQCOMP\_CONTEXT](/zh-TW/reference/audio/shapeeqcompcontext/structs/shape_eqcomp_context)、[SHAPE\_FILTVOL\_CONTEXT](/zh-TW/reference/audio/shapefiltvolcontext/structs/shape_filtvol_context)、[SHAPE\_PCM\_CONTEXT](/zh-TW/reference/audio/shapepcmcontext/structs/shape_pcm_context)、[SHAPE\_SRC\_CONTEXT](/zh-TW/reference/audio/shapesrccontext/structs/shape_src_context) 和 [SHAPE\_XMA\_CONTEXT](/zh-TW/reference/audio/shapexmacontext/structs/shape_xma_context) 結構。

### 傳回值

類型：HRESULT

如果方法成功，會傳回 `S_OK`。如果方法失敗，會傳回下列其中一個代碼 (部分清單)：

| 傳回碼 | 描述 |
| - | - |
| E\_INVALIDARG | 一或多個引數無效。 |
| E\_OUTOFMEMORY | 記憶體配置失敗。 |
| ACP\_E\_ALREADY\_ALLOCATED | 內容陣列已配置。 |

## 備註

請在呼叫 [AcpHalCreate](/zh-TW/reference/audio/acphal/functions/acphalcreate) 之前呼叫此方法，為音訊控制處理器 (ACP) 用戶端配置內容。

除非之後有呼叫 [AcpHalReleaseShapeContexts](/zh-TW/reference/audio/acphal/functions/acphalreleaseshapecontexts)，否則此方法應該只呼叫一次。

取樣率轉換器 (SRC) 內容的數目必須等於脈衝碼調變 (PCM) 內容數目與 XMA 內容數目的總和。

## 需求

**標頭：** acphal.h

**程式庫：** acphal.lib

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

## 另請參閱

[AcpHalReleaseShapeContexts](/zh-TW/reference/audio/acphal/functions/acphalreleaseshapecontexts)\
[AcpHalCreate](/zh-TW/reference/audio/acphal/functions/acphalcreate)\
[AcpHal](/zh-TW/reference/audio/acphal/acphal_members)


## Related topics

- [AcpHalAllocateShapeContexts](/reference/audio/acphal/functions/acphalallocateshapecontexts.md)
- [AcpHal](/reference/audio/acphal/acphal_members.md)
- [SHAPE_CONTEXTS](/reference/audio/acphal/structs/shape_contexts.md)
- [AcpHalReleaseShapeContexts](/es/reference/audio/acphal/functions/acphalreleaseshapecontexts.md)
