Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

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. It can also be used to define any format that can be defined by WAVEFORMATEX.

Syntax


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

Members

Format

WAVEFORMATEX structure that specifies the basic format. The wFormatTag member must be WAVE_FORMAT_EXTENSIBLE. The cbSize member must be at least 22.

Samples
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 0 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 for internal use by operating system. Set to 0.

dwChannelMask

Bitmask specifying the assignment of channels in the stream to speaker positions.

SubFormat

Subformat of the data, such as KSDATAFORMAT_SUBTYPE_PCM. The subformat information is similar to that provided by the tag in the WAVEFORMATEX structure's wFormatTag member.

Remarks

WAVEFORMATEXTENSIBLE can describe any format that can be described by WAVEFORMATEX, but provides additional support for more than two channels, for greater precision in the number of bits per sample, and for new compression schemes.

WAVEFORMATEXTENSIBLE can safely be cast to WAVEFORMATEX, because it simply configures the extra bytes specified by WAVEFORMATEX.cbSize.

The dwChannelMask member specifies which channels are present in the multichannel stream. The least significant bit corresponds with the front left speaker, the next least significant bit corresponds to the front right speaker, and so on. The bits, in order of significance, are defined as follows.

Speaker position Flag bit
SPEAKER_FRONT_LEFT0x1
SPEAKER_FRONT_RIGHT0x2
SPEAKER_FRONT_CENTER0x4
SPEAKER_LOW_FREQUENCY0x8
SPEAKER_BACK_LEFT0x10
SPEAKER_BACK_RIGHT0x20
SPEAKER_FRONT_LEFT_OF_CENTER0x40
SPEAKER_FRONT_RIGHT_OF_CENTER0x80
SPEAKER_BACK_CENTER0x100
SPEAKER_SIDE_LEFT0x200
SPEAKER_SIDE_RIGHT0x400
SPEAKER_TOP_CENTER0x800
SPEAKER_TOP_FRONT_LEFT0x1000
SPEAKER_TOP_FRONT_CENTER0x2000
SPEAKER_TOP_FRONT_RIGHT0x4000
SPEAKER_TOP_BACK_LEFT0x8000
SPEAKER_TOP_BACK_CENTER0x10000
SPEAKER_TOP_BACK_RIGHT0x20000

 

The channels specified in dwChannelMask must be present in the prescribed order (from least significant bit up). For example, if only SPEAKER_FRONT_LEFT and SPEAKER_FRONT_RIGHT are specified, then the samples for the front left speaker must come first in the interleaved stream. The number of bits set in dwChannelMask should be the same as the number of channels specified in WAVEFORMATEX.nChannels.

For backward compatibility, any wave format that can be specified by a stand-alone WAVEFORMATEX structure can also be defined by a WAVEFORMATEXTENSIBLE structure. Thus, every wave-format tag in mmreg.h has a corresponding SubFormat GUID. The following table shows some typical wave-format tags and their corresponding SubFormat GUIDs. These GUIDs are defined in Ksmedia.h.

Wave-Format Tag SubFormat GUID
WAVE_FORMAT_PCMKSDATAFORMAT_SUBTYPE_PCM
WAVE_FORMAT_IEEE_FLOATKSDATAFORMAT_SUBTYPE_IEEE_FLOAT
WAVE_FORMAT_DRMKSDATAFORMAT_SUBTYPE_DRM
WAVE_FORMAT_ALAWKSDATAFORMAT_SUBTYPE_ALAW
WAVE_FORMAT_MULAWKSDATAFORMAT_SUBTYPE_MULAW
WAVE_FORMAT_ADPCMKSDATAFORMAT_SUBTYPE_ADPCM

 

Because WAVEFORMATEXTENSIBLE is an extended version of WAVEFORMATEX, it can describe additional formats that cannot be described by WAVEFORMATEX alone. Vendors are free to define their own SubFormat GUIDs to identify proprietary formats for which no wave-format tags exist.

The following structures, for particular extended formats, are defined as WAVEFORMATEXTENSIBLE.

Definition Value of SubFormat
WAVEFORMATIEEEFLOATEXKSDATAFORMAT_SUBTYPE_IEEE_FLOAT
WAVEFORMATPCMEXKSDATAFORMAT_SUBTYPE_PCM

 

Requirements

Minimum supported client

Windows XP [desktop apps only]

Minimum supported server

Windows Server 2003 [desktop apps only]

Header

Mmreg.h

See also

Waveform Audio
Waveform Structures

 

 

Community Additions

Show:
© 2015 Microsoft