WAVEFORMATEX
The WAVEFORMATEX type defines the format of waveform-audio data. Only format information common to all waveform-audio data formats is included in this type. For formats that require additional information, this structure is included as the first member in another structure, along with the additional information.
Type WAVEFORMATEX
lAvgBytesPerSec As Long
lExtra As Long
lSamplesPerSec As Long
nBitsPerSample As Integer
nBlockAlign As Integer
nChannels As Integer
nFormatTag As Integer
nSize As Integer
End Type
Members
- lAvgBytesPerSec
- Required average data-transfer rate, in bytes per second, for the format. If nFormatTag is WAVE_FORMAT_PCM, nAvgBytesPerSec should be equal to the product of lSamplesPerSec and nBlockAlign. For non-PCM formats, this member must be computed according to the manufacturer's specification of the format tag.
Playback and record software can estimate buffer sizes by using the lAvgBytesPerSec member.
- lExtra
- This member is not used and should be set to 0.
- lSamplesPerSec
- Sample rate, in samples per second (hertz), that each channel should be played or recorded. If nFormatTag is WAVE_FORMAT_PCM, then common values for lSamplesPerSec are 8.0 kHz, 11.025 kHz, 22.05 kHz, and 44.1 kHz. For non-PCM formats, this member must be computed according to the manufacturer's specification of the format tag.
- nBitsPerSample
- Bits per sample for the nFormatTag format type. If nFormatTag is WAVE_FORMAT_PCM, then wBitsPerSample should be equal to 8 or 16. The actual values for 8-bit buffered data is 0 to 256 and -32,000 to 32,000 for 16-bit buffered data. For non-PCM formats, this member must be set according to the manufacturer's specification of the format tag. Note that some compression schemes cannot define a value for nBitsPerSample, so this member can be zero.
- nBlockAlign
- Block alignment, in bytes. The block alignment is the minimum atomic unit of data for the nFormatTag format type. If nFormatTag is WAVE_FORMAT_PCM, nBlockAlign should be equal to the product of nChannels and nBitsPerSample divided by 8 (bits per byte). For non-PCM formats, this member must be computed according to the manufacturer's specification of the format tag.
Playback and record 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 illegal to start playback of PCM data in the middle of a sample (that is, on a non-block-aligned boundary).
- nChannels
- Number of channels in the waveform-audio data. Monaural data uses one channel and stereo data uses two channels.
- nFormatTag
- Waveform-audio format type. Format tags are registered with Microsoft Corporation for many compression algorithms. A complete list of format tags can be found in the MMREG.H header file.
- nSize
- Size, in bytes, of extra format information appended to the end of the WAVEFORMATEX type. This information can be used by non-PCM formats to store extra attributes for the nFormatTag. If no extra information is required by the nFormatTag, this member must be set to zero. Note that for WAVE_FORMAT_PCM formats (and only WAVE_FORMAT_PCM formats), this member is ignored.