Previous | Next |
The _WAVEFORMATEX structure defines the format of waveform-audio data.
Syntax
typedef struct {
WORD wFormatTag;
WORD nChannels;
DWORD nSamplesPerSec;
DWORD nAvgBytesPerSec;
WORD nBlockAlign;
WORD wBitsPerSample;
WORD cbSize;
} _WAVEFORMATEX;
Members
wFormatTag
Must be set to a format or formats supported by the device. This member can be set to WMDM_WAVE_FORMAT_ALL to accept all formats. If the nChannels, nAvgBytesPerSec, and nSamplesPerSec members are all zero, then files of type wFormatTag are copied directly to the device, unchanged; otherwise, files are transcoded appropriately.
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 for the format tag, in bytes per second. This parameter must be equal to the product of nSamplesPerSec and nBlockAlign.
Playback and recording software can estimate buffer sizes by using the nAvgBytesPerSec member.
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).
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).
wBitsPerSample
Bits per sample for the wFormatTag format type. This parameter must be equal to 8 or 16.
cbSize
This member is ignored.
See Also
Previous | Next |