Waveformatex
The waveformatex structure specifies the data format of A wave audio stream.
Waveformatex is the data structure of the waveform audio stream format
Typedef struct
{
Word wformattag;
Word nchannels;
DWORD nsamplespersec;
DWORD navgbytespersec;
Word nblockalign;
Word wbitspersample;
Word cbsize;
} Waveformatex; * pwaveformatex;
Members
-
-
Wformattag
-
-
Specifies the waveform audio format type. For more information, see the following CommentsSection.
-
-
Set the waveform sound format. For more information, seeDescription.
-
-
Nchannels
-
-
Specifies the number of channels of audio data. For monophonic audio, set this member to 1. For stereo, set this member to 2.
-
-
Set the number of channels for audio files. This value is 1 for single-channel sound. For stereo, this value is 2.
-
-
Nsamplespersec
-
-
Specifies the sample frequency at which each channel shocould be played or recorded. If Wformattag= Wave_format_pcm, then common values
NsamplespersecAre 8.0 kHz, 11.025 kHz, 22.05 kHz, and 44.1 kHz. For example, to specify a sample frequency of 11.025 kHz, Set NsamplespersecTo 11025. For non-PCM formats, this member shocould be computed according to the manufacturer's
Specification of the format tag.
-
-
Set the sample frequency for playing and recording each audio channel.
-
-
IfWformattag= Wave_format_pcm, thenNsamplespersecUsually 8.0 kHz, 11.025 kHz, 22.05 kHz and 44.1 kHz. For example, for audio with a sampling rate of 11.025 kHz,NsamplespersecWill be set to 11025. For non-PCM format, calculate according to vendor settings.
-
-
Navgbytespersec
-
-
Specifies the required average data transfer rate in bytes per second. This value is useful for estimating buffer size.
-
-
Sets the average data transmission rate of the request, in bytes/s. This value is useful for creating a buffer size.
-
-
Nblockalign
-
-
Specifies the block alignment in bytes. The block alignment is the size of the minimum atomic unit of data for WformattagFormat type. If
Wformattag= Wave_format_pcm, Set NblockalignTo ( Nchannels * wbitspersample)/8, which is the size of a single audio frame. For non-PCM formats, this member shoshould be computed according to the manufacturer's specification
For the format tag.
Playback and record software shocould process a multipleNblockalignBytes of data at a time. Data written to and read from a device shoshould always start at the beginning of a block.
-
-
Set block alignment in bytes. Block alignment refers to the atomic size of the minimum data. IfWformattag= Wave_format_pcm,NblockalignIs (Nchannels * wbitspersample)/8. For non-PCM format, Please calculate according to vendor instructions.
-
-
Wbitspersample
-
-
Specifies the number of bits per sample for the format type specified
Wformattag. If Wformattag= Wave_format_pcm, then
WbitspersampleShocould be set to either 8 or 16. For non-PCM formats, this member shocould be set according to the manufacturer's specification for the format tag. Some compression schemes cannot define a value Wbitspersample. In this
Case, Set WbitspersampleTo zero.
-
-
AccordingWformattagSet the depth of each sample (that is, the size of each sample, in BITs ). IfWformattag= Wave_format_pcm. This value should be set to 8 or 16. For non-PCM format, set according to vendor instructions. This value cannot be set for some compressed architectures.WbitspersampleIt should be zero.
-
-
Cbsize
-
-
Specifies the 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 Wformattag. If no extra information is required
By Wformattag, This member must be set to zero. For wave_format_pcm formats, this member is ignored.
-
-
The size of the additional information, in bytes. The additional information is added at the end of the waveformatex structure. This information can be used as a non-PCM formatWformattagAdditional attributes, ifWformattagNo additional information is required. This value must be 0. This value is ignored in PCM format.