WAVEFORMATEXTENSIBLE Structure

The WAVEFORMATEXTENSIBLE structure defines the format of waveform-audio data for formats having more than two channels or higher sample resolutions than allowed by WAVEFORMATEX.

Syntax

typedef struct WAVEFORMATEXTENSIBLE {
    WAVEFORMATEX Format;
    union {
        WORD wValidBitsPerSample;
        WORD wSamplesPerBlock;
        WORD wReserved;
    };
    DWORD dwChannelMask;
    GUID SubFormat;
} WAVEFORMATEXTENSIBLE;  

Members

Format
WAVEFORMATEX structure that specifies the basic format. The wFormatTag member must be WAVE_FORMAT_EXTENSIBLE, defined in Mmreg.h. The cbSize member must be at least 22.

wValidBitsPerSample
Number of bits of precision in the signal. Usually equal to WAVEFORMATEX.wBitsPerSample. However, wBitsPerSample is the container size and must be a multiple of 8, whereas wValidBitsPerSample can be any value not exceeding the container size. For example, if the format uses 20-bit samples, wBitsPerSample must be at least 24, but wValidBitsPerSample is 20.

wSamplesPerBlock
Number of samples contained in one compressed block of audio data. This value is used in buffer estimation. This value is used with compressed formats that have a fixed number of samples within each block. This value can be set to zero if a variable number of samples is contained in each block of compressed audio data. In this case, buffer estimation and position information needs to be obtained in other ways.

wReserved
Reserved. Set to zero.

dwChannelMask

Bitmask specifying the assignment of channels in the stream to speaker positions. See XMA2STREAMFORMAT for a table of speaker positions.

SubFormat

A GUID that specifies the format of the audio data. The GUIDs are defined in Ksmedia.h. Third parties can define additional GUIDs. XAudio2 supports the following natively (so little additional decoding is required): KSDATAFORMAT_SUBTYPE_ADPCM, KSDATAFORMAT_SUBTYPE_IEEE_FLOAT and KSDATAFORMAT_SUBTYPE_PCM. XAudio2 also supports KSDATAFORMAT_SUBTYPE_WMA2 and KSDATAFORMAT_SUBTYPE_WMA3 though with more processing than the first three.

Requirements

Header: Declared in mmreg.h.

Library: Use xaudio2.lib.