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

# SetShapePcmReadPointer

> SetShapePcmReadPointer

# SetShapePcmReadPointer

Sets the read pointer.

## Syntax

```cpp theme={null}
HRESULT SetShapePcmReadPointer(  
         SHAPE_PCM_CONTEXT* context,  
         UINT32 readPointerInSamples  
)  
```

### Parameters

*context*   \_Inout\_\
Type: [SHAPE\_PCM\_CONTEXT\*](/reference/audio/shapepcmcontext/structs/shape_pcm_context)

Pointer to a [SHAPE\_PCM\_CONTEXT](/reference/audio/shapepcmcontext/structs/shape_pcm_context) structure.

*readPointerInSamples*   \
Type: UINT32

Read pointer in samples. This pointer treats two 16-bit stereo samples as a single 32-bit sample.

### 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 some multiple of those frames (at least double-buffered at eight) 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).

Start the voice using the `SHAPE_SRC_COMMAND_TYPE_START` constant for the SRC. Keep streaming data, updating the PCM context write pointer, until you want to stop. Use the `SHAPE_SRC_COMMAND_TYPE_STOP_END` constant to let the SRC play to the current PCM write pointer `loopStartWritePointer`, or `SHAPE_SRC_COMMAND_TYPE_STOP_IMMEDIATE` to stop immediately. For more information, see the [SHAPE\_SRC\_COMMAND\_TYPE](/reference/audio/shapesrccontext/enums/shape_src_command_type) enumeration.

## Requirements

**Header:** shapepcmcontext.h

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

## See also

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


## Related topics

- [ShapePcmContext](/reference/audio/shapepcmcontext/shapepcmcontext_members.md)
- [GetShapePcmReadPointer](/reference/audio/shapepcmcontext/functions/getshapepcmreadpointer.md)
- [SetShapePcmLoopStartOrWritePointer](/reference/audio/shapepcmcontext/functions/setshapepcmloopstartorwritepointer.md)
- [SetShapeDmaReadPointer](/reference/audio/shapedmacontext/functions/setshapedmareadpointer.md)
- [SHAPE_PCM_CONTEXT](/reference/audio/shapepcmcontext/structs/shape_pcm_context.md)
