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

# GetXmaBlockContainingSample

> GetXmaBlockContainingSample

# GetXmaBlockContainingSample

Uses a specified seek table to find the XBOX Media Audio (XMA) block that contains a specified decoded sample. The seek table entries in an XMA file are stored in big-endian form and sometimes need to be converted before this function is called.

## Syntax

```cpp theme={null}
HRESULT GetXmaBlockContainingSample(  
         DWORD nBlockCount,  
         const DWORD* pSeekTable,  
         DWORD nDesiredSample,  
         DWORD* pnBlockContainingSample,  
         DWORD* pnSampleOffsetWithinBlock  
)  
```

### Parameters

*nBlockCount*   \
Type: DWORD

Number of blocks in the file. Same as the number of entries in the seek table.

*pSeekTable*   \_In\_count\_(nBlockCount)\
Type: DWORD\*

Pointer to the seek table data.

*nDesiredSample*   \
Type: DWORD

Decoded sample to locate.

*pnBlockContainingSample*   \_Out\_\
Type: DWORD\*

Index of the block that contains the sample.

*pnSampleOffsetWithinBlock*   \_Out\_\
Type: DWORD\*

Position of the sample in this block.

### Return value

Type: HRESULT

Success `S_OK` or error `E_FAIL` code.

## Remarks

This function uses the `pSeekTable` pointer to find the XMA block that contains a given decoded sample. The seek table entries in an XMA file are stored in big-endian form.

<Note>The seek table entries may need to be converted prior to calling this function.</Note>

For more information about XMA2, see [Overview of XMA2](/build/console-features/audio/overviews/xma2-overview). For an overview of the audio architecture of XBOX One, see **The sound of the future**: [The audio architecture in XBOX One](/build/console-features/audio/overviews/xbox-one-audio-architecture).

## Requirements

**Header:** xma2defs.h

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

## See also

[xma2defs](/reference/audio/xma2defs/xma2defs_members)


## Related topics

- [XMA2Defs](/reference/audio/xma2defs/xma2defs_members.md)
- [GetShapeSrcXmaBlocksToSkip](/reference/audio/shapesrccontext/functions/getshapesrcxmablockstoskip.md)
- [GetXmaDecodePositionForSample](/reference/audio/xma2defs/functions/getxmadecodepositionforsample.md)
- [SetShapeSrcXmaBlocksToSkip](/reference/audio/shapesrccontext/functions/setshapesrcxmablockstoskip.md)
- [GetShapeDmaFloatSamples](/reference/audio/shapedmacontext/functions/getshapedmafloatsamples.md)
