GetXmaDecodePositionForSample

Obtains the information needed to make the decoder generate audio starting at a given sample position relative to the beginning of the given XMA block: the bit offset of the appropriate frame, and the right subframe within that frame. This data can be passed directly to the XMAPlaybackSetDecodePosition function.

Syntax

HRESULT GetXmaDecodePositionForSample(
         const BYTE *pXmaData,
         DWORD nXmaDataBytes,
         DWORD nStreamIndex,
         DWORD nDesiredSample,
         DWORD *pnBitOffset,
         DWORD *pnSubFrame
)  

Parameters

pXmaData
Type: BYTE *

Pointer to XMA blocks.

nXmaDataBytes
Type: DWORD 

Size of pXmaData in bytes.

nStreamIndex
Type: DWORD 

Stream within which to seek.

nDesiredSample
Type: DWORD 

Sample sought.

pnBitOffset
Type: DWORD *

[out] Returns the bit offset within pXmaData of the frame containing the sample sought.

pnSubFrame
Type: DWORD *

[out] Returns the subframe containing the sample.

Return value

Type: HRESULT 

Success (S_OK) or error (E_FAIL) code.

Remarks

This is an inline function, refer to the xma2defs.h file for the source code.

Requirements

Header: Declared in xma2defs.h.

Library: Use xaudio2.lib and acphal.lib.