Previous | Next |
The WAVEFORMATEX structure defines the format of waveform-audio data. In the Windows Media Format SDK, the only supported format is WAVE_FORMAT_PCM.
Syntax
typedef struct {
WORD wFormatTag;
WORD nChannels;
DWORD nSamplesPerSec;
DWORD nAvgBytesPerSec;
WORD nBlockAlign;
WORD wBitsPerSample;
WORD cbSize;
} WAVEFORMATEX;
Members
wFormatTag
Must be set to WAVE_FORMAT_PCM.
nChannels
Number of channels in the waveform-audio data. Monaural data uses one channel, and stereo data uses two channels.
nSamplesPerSec
Sample rate, in samples per second (Hertz), at which each channel must be played or recorded. Common values for nSamplesPerSec are 8.0 kilohertz (kHz), 11.025 kHz, 22.05 kHz, and 44.1 kHz.
nAvgBytesPerSec
Required average data-transfer rate, in bytes per second, for the format tag. This parameter must be equal to the product of nSamplesPerSec and nBlockAlign.
nBlockAlign
Block alignment, in bytes. The block alignment is the minimum atomic unit of data for the wFormatTag format type. nBlockAlign must be equal to the product of nChannels and wBitsPerSample divided by 8 (bits per byte).
wBitsPerSample
Bits per sample for the wFormatTag format type. This parameter must be equal to 8 or 16.
cbSize
This member is ignored.
Remarks
Playback and recording software can estimate buffer sizes by using the nAvgBytesPerSec member.
Playback and recording software must process a multiple of nBlockAlign bytes of data at a time. Data written and read from a device must always start at the beginning of a block. For example, it is not possible to correctly start playback of PCM data in the middle of a sample (that is, on a nonblock-aligned boundary).
See Also
Previous | Next |