WAVEFORMATEX

This structure contains information common to all formats for waveform audio data. For formats requiring additional information, this structure is included as the first member in another structure that defines the additional information.

typedef [restricted] struct WAVEFORMATEX{
  WORD wFormatTag;
  WORD nChannels;
  DWORD nSamplesPerSec;
  DWORD nAvgBytesPerSec;
  WORD nBlockAlign;
  WORD wBitsPerSample;
  WORD cbSize;
} WAVEFORMATEX;

Members

  • wFormatTag
    Waveform audio format type. Format tags are registered with Microsoft Corporation for many compression algorithms. A complete list of format tags is located in the Mmsystem.h header file.

  • 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 should be played or recorded. If wFormatTag is WAVE_FORMAT_PCM, common values for nSamplesPerSec 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.

  • nAvgBytesPerSec
    Required average data transfer rate, in bytes per second, for the format tag. If wFormatTag is WAVE_FORMAT_PCM, nAvgBytesPerSec should be equal to the product of nSamplesPerSec 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 nAvgBytesPerSec member.

  • nBlockAlign
    Block alignment, in bytes. The block alignment is the minimum atomic unit of data for the format type specified by wFormatTag. If wFormatTag is WAVE_FORMAT_PCM, nBlockAlign should be equal to the product of nChannels and wBitsPerSample, 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).

  • wBitsPerSample
    Bits per sample for the format type specified by wFormatTag. If wFormatTag is WAVE_FORMAT_PCM, wBitsPerSample should be equal to 8 or 16. For non-PCM formats, this member must be set according to the manufacturer's specification of the format tag. Since some compression schemes cannot define a value for wBitsPerSample, this member can be set to zero.

  • cbSize
    Size, in bytes, of extra format information appended to the end of the WAVEFORMATEX structure. This information can be used by non-PCM formats to store extra attributes for the format type specified by wFormatTag. If no extra information is required, this member must be set to zero. For WAVE_FORMAT_PCM formats only, this member is ignored.

Requirements

OS Versions: Windows CE .NET 4.1 and later.
Header: Sapi.h, Sapi.idl.

See Also

SAPI Structures

 Last updated on Saturday, April 10, 2004

© 1992-2003 Microsoft Corporation. All rights reserved.