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

# SetShapeDmaAudioBuffer

> SetShapeDmaAudioBuffer

# SetShapeDmaAudioBuffer

設定 DMA 音訊緩衝區。這是多載函式: 一個函式接受虛擬指標，另一個則接受實體位址。

## 語法

```cpp theme={null}
HRESULT SetShapeDmaAudioBuffer(  
         SHAPE_DMA_CONTEXT* context,  
         APU_ADDRESS audioBuffer  
)  
```

### 參數

*context*   \_Inout\_\
類型: [SHAPE\_DMA\_CONTEXT\*](/zh-TW/reference/audio/shapedmacontext/structs/shape_dma_context)

[SHAPE\_DMA\_CONTEXT](/zh-TW/reference/audio/shapedmacontext/structs/shape_dma_context) 結構的指標。

*audioBuffer*   \_In\_\
類型: APU\_ADDRESS

緩衝區的實體位址。

### 傳回值

類型: HRESULT

HRESULT 成功或錯誤碼。

## 備註

只要確保您的音訊緩衝區夠大，並以固定間隔 (與緩衝區大小相關) 串流資料，就可以避免直接記憶體存取 (DMA) 命令遭到封鎖。例如，如果您一次串流四個硬體框架，請確保緩衝區中有這些框架的某個倍數 (至少以八個框架進行雙重緩衝)，讓硬體可以在遊戲的讀取指標之前寫入。或者，您也可以在提交下一個流程圖之前強制清空緩衝區 (取用資料、更新 DMA 讀取指標，然後提交流程圖)。如需詳細資訊，請參閱 [SHAPE 概觀](/zh-TW/build/console-features/audio/overviews/shape-overview)中的[封鎖的命令](/zh-TW/build/console-features/audio/overviews/shape-overview#ID4EBGAC)。

## 需求

**標頭:** shapedmacontext.h

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

## 另請參閱

[ShapeDmaContext](/zh-TW/reference/audio/shapedmacontext/shapedmacontext_members)


## Related topics

- [SetShapeDmaAudioBuffer](/ko/reference/audio/shapedmacontext/functions/setshapedmaaudiobuffer_2.md)
- [SetShapeDmaAudioBuffer function](/reference/audio/shapedmacontext/functions/setshapedmaaudiobuffer.md)
- [SetShapeDmaAudioBuffer 関数](/ja-jp/reference/audio/shapedmacontext/functions/setshapedmaaudiobuffer.md)
- [Función SetShapeDmaAudioBuffer](/es/reference/audio/shapedmacontext/functions/setshapedmaaudiobuffer.md)
- [SetShapeDmaAudioBuffer 函数](/zh-CN/reference/audio/shapedmacontext/functions/setshapedmaaudiobuffer.md)
