BASS.NET API for the Un4seen BASS Audio Library

WAVEFORMATEX Class

BASS.NET API for the Un4seen BASS Audio Library
The WAVEFORMATEX structure defines the format of waveform-audio data. Only format information common to all waveform-audio data formats is included in this structure. For formats that require additional information, this structure is included as the first member in another structure, along with the additional information. See WAVEFORMATEXT for details.
Inheritance Hierarchy

SystemObject
  Un4seen.BassWAVEFORMATEX

Namespace:  Un4seen.Bass
Assembly:  Bass.Net (in Bass.Net.dll) Version: 2.4.17.5
Syntax

[SerializableAttribute]
[StructLayoutAttribute(LayoutKind.Sequential, Pack = 2, CharSet = CharSet.Ansi)]
public sealed class WAVEFORMATEX

The WAVEFORMATEX type exposes the following members.

Constructors

  NameDescription
Public methodWAVEFORMATEX
Default Constructor.
Public methodWAVEFORMATEX(WAVEFormatTag, Int16, Int32, Int16, Int16)
Creates an instance setting the members to certain values.
Top
Methods

  NameDescription
Public methodToString
Returns a description string for the instance members.
(Overrides ObjectToString.)
Top
Fields

  NameDescription
Public fieldcbSize
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 wFormatTag. If no extra information is required by the wFormatTag, this member must be set to zero. For WAVE_FORMAT_PCM formats (and only WAVE_FORMAT_PCM formats), this member is ignored.

Default = 0

Public fieldnAvgBytesPerSec
In most cases, this member contains the 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. When the Windows Media Audio 9 Codec is in quality-based variable-bit-rate mode, the high-order bytes of this member are set to 0x7fffff and the low-order byte is set to a value from one through 100 which indicates the quality level.

Typical Calculation: nSamplesPerSec * nBlockAlign

Default = 176400

Public fieldnBlockAlign
Block alignment, in bytes. The block alignment is the minimum atomic unit of data for the wFormatTag format type. 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).

Typical Calculation: nChannels * (wBitsPerSample / 8)

Default = 4

Public fieldnChannels
Number of channels in the waveform-audio data. Monaural data uses one channel and stereo data uses two channels.

Default = 2

Public fieldnSamplesPerSec
Sample rate, in samples per second (hertz), that each channel should be played or recorded. If wFormatTag is WAVE_FORMAT_PCM, then 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.

Default = 44100

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

Default = 16

Public fieldwFormatTag
Waveform-audio format type (see WAVEFormatTag). Format tags are registered with Microsoft Corporation for many compression algorithms. A complete list of format tags can be found in the Mmreg.h header file. For one- or two-channel PCM data, this value should be WAVE_FORMAT_PCM.

Default = 1 (WAVE_FORMAT_PCM)

Top
See Also

Reference