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

> SetShapeDmaAudioBuffer function

# SetShapeDmaAudioBuffer function

Sets the DMA audio buffer. This is an overloaded function: one function accepts a virtual pointer, the other a physical address.

## Syntax

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

### Parameters

*context*   \_Inout\_\
Type: [SHAPE\_DMA\_CONTEXT\*](/reference/audio/shapedmacontext/structs/shape_dma_context)

Pointer to a [SHAPE\_DMA\_CONTEXT](/reference/audio/shapedmacontext/structs/shape_dma_context) structure.

*audioBuffer*   \_In\_\
Type: void\*

Pointer to the audio buffer.

### Return value

Type: HRESULT

HRESULT success or error code.

## Remarks

You can prevent blocked Direct Memory Access (DMA) commands by ensuring that your audio buffer is sufficiently large and that data is streamed at regular intervals (related to the buffer size). For example, if you are streaming four hardware frames at a time, ensure that some multiple of those frames (at least double-buffered at eight frames) are in the buffer so the hardware can write ahead of the title's read pointer. Alternatively, you could enforce emptying of the buffer before submitting the next flowgraph (consume, update DMA read pointer, and then submit the flowgraph). For more details, see [Blocked commands](/build/console-features/audio/overviews/shape-overview#ID4EBGAC) in [Overview of SHAPE](/build/console-features/audio/overviews/shape-overview).

## Requirements

**Header:** shapedmacontext.h

**Supported platforms:** XBOX One family consoles and XBOX Series consoles

## See also

[ShapeDmaContext](/reference/audio/shapedmacontext/shapedmacontext_members)


## Related topics

- [ShapeDmaContext](/reference/audio/shapedmacontext/shapedmacontext_members.md)
- [SetShapeDmaAudioBuffer](/reference/audio/shapedmacontext/functions/setshapedmaaudiobuffer_2.md)
- [SetShapeDmaBufferFull](/reference/audio/shapedmacontext/functions/setshapedmabufferfull.md)
- [GetShapeDmaAudioBuffer](/reference/audio/shapedmacontext/functions/getshapedmaaudiobuffer.md)
- [SetShapeDmaChannel](/reference/audio/shapedmacontext/functions/setshapedmachannel.md)
