XMA2 Reference

Describes the functions, structures and macros that make up the XMA2 API.

Functions

Name Description
GetLastXmaFrameBitPosition Calculates the bit offset of the last complete frame in an XMA block or set of blocks.
GetStandardChannelMaskFromXmaMask Converts between WAVEFORMATEXTENSIBLE channel masks (combinations of the SPEAKER_xxx flags) and XMA channel masks (which are limited to eight possible speaker positions: left, right, center, low frequency, side left, side right, back left and back right).
GetXmaBlockContainingSample Use a given seek table to find the XMA block containing a given decoded sample. Note that the seek table entries in an XMA file are stored in big-endian form and may need to be converted prior to calling this function.
GetXmaChannelMaskFromStandardMask Converts between WAVEFORMATEXTENSIBLE channel masks (combinations of the SPEAKER_xxx flags) and XMA channel masks (which are limited to eight possible speaker positions: left, right, center, low frequency, side left, side right, back left and back right).
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.
GetXmaFrameBitPosition Calculates the bit offset of a given frame within an XMA block or set of blocks.
GetXmaFrameLengthInBits Reads a given frame’s LengthInBits field.
GetXmaPacketFirstFrameOffsetInBits Helper function for the XMA2PACKET structure, returning the first frame offset.
GetXmaPacketFrameCount Helper function for the XMA2PACKET structure, returning the packet frame count.
GetXmaPacketMetadata Helper function for the XMA2PACKET structure.
GetXmaPacketSkipCount Helper function for the XMA2PACKET structure, returning the packets from other streams to skip.
GetXmaSampleRate Obtains the legal XMA sample rate (24, 32, 44.1 or 48Khz) corresponding to a generic sample rate.
LocalizeXma2Format Modifies a XMA2WAVEFORMATEX structure in place to comply with the current platform’s byte-ordering rules (little- or big-endian).

Structures

Name Description
XMA2PACKET XMA packet structure (in big-endian form).
XMA2STREAMFORMAT Structure used in XMA2WAVEFORMAT for per-stream data.
XMA2WAVEFORMATEX The currently recommended way to express format information for XMA2 files is this XMA2WAVEFORMATEX structure. This structure is fully compliant with the WAVEFORMATEX standard and contains all the information needed to parse and manage XMA2 files in a compact way.

Macros

Name Description
XMA2DEFS_INCLUDED Define to include APIs defined in xma2def.h.
WAVE_FORMAT_XMA For use in the WAVEFORMATEX wFormatTag field.
WAVE_FORMAT_XMA2 For use in the WAVEFORMATEX wFormatTag field.
XMA_BITS_IN_FRAME_LENGTH_FIELD Size in bits of a frame’s initial LengthInBits field.
XMA_BITS_PER_PACKET Size of an XMA packet in bits.
XMA_BYTES_PER_PACKET Size of an XMA packet.
XMA_FINAL_FRAME_MARKER Special LengthInBits value that marks an invalid final frame.
XMA_INFINITE_LOOP LoopCount < 255 means finite repetitions. LoopCount=255 means infinite looping.
XMA_MAX_LOOPCOUNT LoopCount < 255 means finite repetitions. LoopCount=255 means infinite looping.
XMA_MAX_SUBFRAMES_TO_DECODE Decode chunk sizes for the XMA_PLAYBACK_INIT.subframesToDecode field.
XMA_MIN_SUBFRAMES_TO_DECODE Decode chunk sizes for the XMA_PLAYBACK_INIT.subframesToDecode field.
XMA_OPTIMAL_SUBFRAMES_TO_DECODE Decode chunk sizes for the XMA_PLAYBACK_INIT.subframesToDecode field.
XMA_OUTPUT_SAMPLE_BITS Size of the PCM samples, in bits, produced by the XMA decoder.
XMA_OUTPUT_SAMPLE_BYTES Size of the PCM samples produced by the XMA decoder.
XMA_PACKET_HEADER_BITS Size of an XMA packet header, in bits.
XMA_PACKET_HEADER_BYTES Size of an XMA packet header.
XMA_READBUFFER_MAX_BYTES Maximum encoded data that can be submitted to the XMA decoder at a time.
XMA_READBUFFER_MAX_PACKETS Maximum encoded data that can be submitted to the XMA decoder at a time, in packets.
XMA_SAMPLES_PER_FRAME Sample blocks in a decoded XMA frame.
XMA_SAMPLES_PER_SUBFRAME Sample blocks in a decoded XMA subframe.
XMA_SPEAKER_CENTER Value used in the ChannelMask fields.
XMA_SPEAKER_LEFT Value used in the ChannelMask fields.
XMA_SPEAKER_LEFT_BACK Value used in the ChannelMask fields.
XMA_SPEAKER_LEFT_SURROUND Value used in the ChannelMask fields.
XMA_SPEAKER_LFE Value used in the ChannelMask fields.
XMA_SPEAKER_RIGHT Value used in the ChannelMask fields.
XMA_SPEAKER_RIGHT_BACK Value used in the ChannelMask fields.
XMA_SPEAKER_RIGHT_SURROUND Value used in the ChannelMask fields.
XMA_WRITEBUFFER_BYTE_ALIGNMENT Required byte alignment of an XMA decoder output buffer.
XMA_WRITEBUFFER_MAX_BYTES Maximum size allowed for an XMA decoder output buffer.
XMA2DEFS_ASSERT A local ASSERT macro.
XMASWAP2BYTES Two byte swap macro.
XMASWAP4BYTES Four byte swap macro.