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

# XMA2WAVEFORMATEX

> XMA2WAVEFORMATEX

# XMA2WAVEFORMATEX

The recommended way to express the format information for XMA2 files.

## Syntax

```cpp theme={null}
typedef struct XMA2WAVEFORMATEX {  
    WAVEFORMATEX wfx;  
    WORD NumStreams;  
    DWORD ChannelMask;  
    DWORD SamplesEncoded;  
    DWORD BytesPerBlock;  
    DWORD PlayBegin;  
    DWORD PlayLength;  
    DWORD LoopBegin;  
    DWORD LoopLength;  
    BYTE LoopCount;  
    BYTE EncoderVersion;  
    WORD BlockCount;  
} XMA2WAVEFORMATEX  
```

### Members

*wfx*\
Type: WAVEFORMATEX

A WAVEFORMATEX structure.

*NumStreams*\
Type: WORD

Number of audio streams: 1 or 2 channels each.

*ChannelMask*\
Type: DWORD

Spatial positions of the channels in this file. Refer to the XMA\_SPEAKER\* macros.

*SamplesEncoded*\
Type: DWORD

Total number of PCM samples the file decodes to.

*BytesPerBlock*\
Type: DWORD

XMA block's size. The last block might be shorter.

*PlayBegin*\
Type: DWORD

First valid sample in the decoded audio.

*PlayLength*\
Type: DWORD

Length of the valid part of the decoded audio.

*LoopBegin*\
Type: DWORD

Beginning of the loop in decoded samples.

*LoopLength*\
Type: DWORD

Length of the loop  in decoded samples.

*LoopCount*\
Type: BYTE

Number of loop repetitions; 255 = infinite.

*EncoderVersion*\
Type: BYTE

Version of the XMA encoder that generated the file.

*BlockCount*\
Type: WORD

Number of XMA blocks in a file, which is also the number of entries in its seek table.

## Remarks

This structure is fully compliant with the *WAVEFORMATEX* standard and contains all the information that is needed to parse and manage *XMA2* files in a compact manner.

The XMA2 format is compatible with XBOX 360, and the seek table needs to be ULONG byte–swapped for XBOX One. If the input is a *WAVE* file, then the output can be used without alteration. To byte-swap the seek table, use the following lines of code.

```
        for(UINT32 i = 0;(i < xmaformat->BlockCount);i++)
        {
           rgpXMASeekTable[i] = _byteswap_ulong(rgpXMASeekTable[i]);
        } 
```

Consider adding lines of code to your app, for testing the functionality, then perhaps writing a separate tool for performing the swap so that no pre-processing is required of your app.

## Requirements

**Header:** xma2defs.h

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

## Conceptual documentation

* [XMA2 overview](/build/console-features/audio/overviews/xma2-overview)

## See also

[Overview of XMA2](/build/console-features/audio/overviews/xma2-overview)

[XMA2WAVEFORMAT](/reference/audio/xma2defs/structs/xma2waveformat)

[XMA2WAVEFORMATEX](/reference/audio/xma2defs/structs/xma2waveformatex)

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


## Related topics

- [Overview of XMA2](/build/console-features/audio/overviews/xma2-overview.md)
- [XMA2Defs](/reference/audio/xma2defs/xma2defs_members.md)
- [LocalizeXma2Format](/reference/audio/xma2defs/functions/localizexma2format.md)
- [XAudio2XMAEncoder](/build/console-features/audio/tools/xma2encoder/methods/xaudio2xmaencoder-xmaencoder-xbox-microsoft-m.md)
- [XMA2WAVEFORMAT](/reference/audio/xma2defs/structs/xma2waveformat.md)
