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

# GetXmaChannelMaskFromStandardMask

> GetXmaChannelMaskFromStandardMask

# GetXmaChannelMaskFromStandardMask

在 `WAVEFORMATEXTENSIBLE` 聲道遮罩 (由 *audiodef.h* 檔案中定義的 `SPEAKER_xxx` 旗標組合而成) 與 XBOX Media Audio (XMA) 聲道遮罩之間進行轉換，且限制為八個可能的喇叭位置。

## 語法

```cpp theme={null}
BYTE GetXmaChannelMaskFromStandardMask(  
         DWORD dwStandardMask  
)  
```

### 參數

*dwStandardMask*   \
類型：DWORD

標準遮罩。

### 傳回值

類型：BYTE

位元組遮罩。

## 備註

此函式會在 `WAVEFORMATEXTENSIBLE` 聲道遮罩 (由 *audiodefs.h* 檔案中定義的 `SPEAKER_xxx` 旗標組合而成) 與 XMA 聲道遮罩之間進行轉換，且限制為八個可能的喇叭位置。

如下列程式碼範例所示，這些喇叭位置包括左、右、中央、低頻、左側、右側、左後與右後。

```cpp theme={null}
__inline BYTE GetXmaChannelMaskFromStandardMask(DWORD dwStandardMask)
{
    BYTE bXmaMask = 0;

    if (dwStandardMask & SPEAKER_FRONT_LEFT)    bXmaMask |= XMA_SPEAKER_LEFT;
    if (dwStandardMask & SPEAKER_FRONT_RIGHT)   bXmaMask |= XMA_SPEAKER_RIGHT;
    if (dwStandardMask & SPEAKER_FRONT_CENTER)  bXmaMask |= XMA_SPEAKER_CENTER;
    if (dwStandardMask & SPEAKER_LOW_FREQUENCY) bXmaMask |= XMA_SPEAKER_LFE;
    if (dwStandardMask & SPEAKER_SIDE_LEFT)     bXmaMask |= XMA_SPEAKER_LEFT_SURROUND;
    if (dwStandardMask & SPEAKER_SIDE_RIGHT)    bXmaMask |= XMA_SPEAKER_RIGHT_SURROUND;
    if (dwStandardMask & SPEAKER_BACK_LEFT)     bXmaMask |= XMA_SPEAKER_LEFT_BACK;
    if (dwStandardMask & SPEAKER_BACK_RIGHT)    bXmaMask |= XMA_SPEAKER_RIGHT_BACK;

    return bXmaMask;
}
```

如需 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 主機

## 另請參閱

[GetStandardChannelMaskFromXmaMask](/zh-TW/reference/audio/xma2defs/functions/getstandardchannelmaskfromxmamask)\
[xma2defs](/zh-TW/reference/audio/xma2defs/xma2defs_members)


## Related topics

- [GetXmaChannelMaskFromStandardMask](/reference/audio/xma2defs/functions/getxmachannelmaskfromstandardmask.md)
- [GetStandardChannelMaskFromXmaMask](/reference/audio/xma2defs/functions/getstandardchannelmaskfromxmamask.md)
