Microsoft DirectX 8.1 (Visual Basic)

WAVEFORMATEX

The WAVEFORMATEX type describes the format of waveform audio data.

Syntax

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.

lExtra

Not used; set to zero.

lSamplesPerSec

Sample rate, in samples per second (hertz), at which 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.

nBitsPerSample

Bits per sample. If nFormatTag is WAVE_FORMAT_PCM, nBitsPerSample should be 8 or 16.

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).

Data written to and read from a buffer 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. In DirectSound, this member must always be WAVE_FORMAT_PCM.

nSize

Size, in bytes, of extra format information. For WAVE_FORMAT_PCM formats, this member is ignored.