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

# GetXmaDecodePositionForSample

> GetXmaDecodePositionForSample

# GetXmaDecodePositionForSample

取得讓解碼器從相對於指定 XBOX Media Audio (XMA) 區塊開頭的指定樣本位置開始產生音訊所需的資料。

## 語法

```cpp theme={null}
HRESULT GetXmaDecodePositionForSample(  
         const BYTE* pXmaData,  
         DWORD nXmaDataBytes,  
         DWORD nStreamIndex,  
         DWORD nDesiredSample,  
         DWORD* pnBitOffset,  
         DWORD* pnSubFrame  
)  
```

### 參數

*pXmaData*   \_In\_bytecount\_(nXmaDataBytes)\
類型：BYTE\*

指向 XMA 區塊的指標。

*nXmaDataBytes*   \
類型：DWORD

pXmaData 的大小 (以位元組為單位)。

*nStreamIndex*   \
類型：DWORD

要在其中搜尋的串流。

*nDesiredSample*   \
類型：DWORD

要搜尋的樣本。

*pnBitOffset*   \_Out\_\
類型：DWORD\*

傳回包含所搜尋樣本之框架在 pXmaData 內的位元位移。

*pnSubFrame*   \_Out\_\
類型：DWORD\*

傳回包含該樣本的子框架。

### 傳回值

類型：HRESULT

成功時為 `S_OK`，錯誤時為 `E_FAIL` 代碼。

## 備註

此函式會取得讓解碼器從相對於指定 XMA 區塊開頭的指定樣本位置開始產生音訊所需的資料。這包括適當框架的位元位移，以及該框架內正確的子框架。這些資料可以直接傳遞給 `XMAPlaybackSetDecodePosition` 函式。如需 XMA2 的詳細資訊，請參閱 [XMA2 概觀](/zh-TW/build/console-features/audio/overviews/xma2-overview)。如需 XBOX One 音訊架構的概觀，請參閱**未來之聲**：[XBOX One 的音訊架構](/zh-TW/build/console-features/audio/overviews/xbox-one-audio-architecture)。

## 需求

**標頭：** xma2defs.h

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

## 另請參閱

[xma2defs](/zh-TW/reference/audio/xma2defs/xma2defs_members)


## Related topics

- [GetXmaDecodePositionForSample](/reference/audio/xma2defs/functions/getxmadecodepositionforsample.md)
- [XMA2Defs](/reference/audio/xma2defs/xma2defs_members.md)
