Edit

Share via


_WAVEFORMATEX structure

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. Note that previous versions of the Windows Media Device Manager recommended using WMDM_WAVE_FORMAT_ALL to indicate support for all formats. However, this is no longer recommended, as different media players will interpret this in different ways, and few devices can truly play any file format. It is now recommended that you use the WMDM_ENUM_PROP_VALID_VALUES_ANY value of the WMDM_ENUM_PROP_VALID_VALUES_FORM enumeration, or better yet specify a range of formats with the WMDM_PROP_VALUES_RANGE structure.

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

Requirement Value
Header
Wmdm.idl

See also

IMDSPDevice::GetFormatSupport

IMDSPStorage::CreateStorage

IMDSPStorage::GetAttributes

IWMDMDevice::GetFormatSupport

IWMDMOperation::GetObjectAttributes

IWMDMOperation::SetObjectAttributes

IWMDMStorage::GetAttributes

Structures