XMA2PACKET Structure

XMA packet structure (in big-endian form).

Syntax

typedef struct XMA2PACKET {
    int FrameCount : 6;
    int FrameOffsetInBits : 15;
    int PacketMetaData : 3;
    int PacketSkipCount : 8;
    BYTE XmaData[XMA_BYTES_PER_PACKET - sizeof(DWORD)];
} XMA2PACKET;  

Members

FrameCount
Number of XMA frames that begin in this packet.

FrameOffsetInBits
Bit of XmaData where the first complete frame begins.

PacketMetaData
Metadata stored in the packet (always 1 for XMA2).

PacketSkipCount
How many packets belonging to other streams must be skipped to find the next packet belonging to this one.

XmaData
XMA encoded data.

Remarks

For example, if the first DWORD of a packet is 0x30107902:

      // 001100 000001000001111 001 00000010
      //    |          |         |      |____ Skip 2 packets to find the next one for this stream
      //    |          |         |___________ XMA2 signature (always 001)
      //    |          |_____________________ First frame starts 527 bits into packet
      //    |________________________________ Packet contains 12 frames  

Helper functions to extract the fields above from an XMA packet:

Requirements

Header: Declared in xma2defs.h.

Library: Use xaudio2.lib and acphal.lib.