Share via


_WAVEFORMATEX

banner art

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

Syntax

typedef struct _tWAVEFORMATEX{
  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. 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. 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 playing PCM data in the middle of a sample (that is, on a boundary that is not block aligned).

wBitsPerSample

Bits per sample for the wFormatTag format type.

cbSize

This member is ignored.

Requirements

Header: Defined in wmdm.idl.

Library: mssachlp.lib

See Also