Microsoft DirectX 8.1 (C++)

WAVEFORMATEX Structure

The WAVEFORMATEX structure defines the format of waveform-audio data.

Note   This structure is fully described in the Microsoft® Platform SDK but is included in the DirectShow documentation for quick reference.

Syntax

typedef struct waveformat_extended_tag {
    WORD  wFormatTag;      
    WORD  nChannels;       
    DWORD nSamplesPerSec;  
    DWORD nAvgBytesPerSec; 
    WORD  nBlockAlign;     
    WORD  wBitsPerSample;  
    WORD  cbSize;          
} WAVEFORMATEX;

Members

wFormatTag

Specifies the audio waveform type. A complete list of format tags can be found in the Mmreg.h header file.

nChannels

Specifies the number of channels in the audio stream.

nSamplesPerSec

Specifies the sample rate in samples/second (Hz). Common values are 8,000; 11,025; 22,050; and 44,100.

nAvgBytesPerSec

Specifies the average data rate, in bytes per second. If wFormatTag is WAVE_FORMAT_PCM, nAvgBytesPerSec must equal the product of nSamplesPerSec and nBlockAlign.

nBlockAlign

Specifies the block alignment, in bytes. The block alignment is the minimum atomic unit of data. This value can be used for buffer alignment. If wFormatTag is WAVE_FORMAT_PCM, nBlockAlign must equal the product of nChannels and wBitsPerSample divided by 8.

wBitsPerSample

Specifies the number of bits per sample. Each channel is assumed to have the same sample resolution. If wFormatTag is WAVE_FORMAT_PCM, then wBitsPerSample should be 8 or 16. For compressed audio, the value might be zero.

cbSize

Specifies the size of the extra information in the format header, in bytes, not including the size of the WAVEFORMATEX structure. If there is no extra information, set the value to zero.  If wFormatTag is WAVE_FORMAT_PCM, this value is ignored.