Table of Contents

Class WaveFormatExtensible

Namespace
NAudio.Wave
Assembly
NAudio.Core.dll
public class WaveFormatExtensible : WaveFormat
Inheritance
WaveFormatExtensible
Inherited Members
Extension Methods

Constructors

WaveFormatExtensible(int, int, int, bool, int, Speakers)

Creates a new linear PCM or IEEE float WaveFormatExtensible with a strongly typed channel layout. See WaveFormatExtensible(int, int, int, bool, int, int) for details.

public WaveFormatExtensible(int rate, int bits, int channels, bool useIeeeFloat, int validBitsPerSample, Speakers channelMask)

Parameters

rate int

Sample rate

bits int

Container bits per sample (block alignment is derived from this)

channels int

Number of channels

useIeeeFloat bool

True for IEEE float samples, false for integer PCM

validBitsPerSample int

Number of valid bits per sample (may be less than bits)

channelMask Speakers

Speaker positions present in the stream

WaveFormatExtensible(int, int, int, bool, int, int)

Creates a new linear PCM or IEEE float WaveFormatExtensible, choosing the SubFormat from useIeeeFloat. Use this convenience overload when you don't need an arbitrary SubFormat GUID but still want control over valid bits and channel mask — in particular it can create 32-bit integer PCM (useIeeeFloat false), which the bit-depth-based constructor cannot.

public WaveFormatExtensible(int rate, int bits, int channels, bool useIeeeFloat, int validBitsPerSample, int channelMask)

Parameters

rate int

Sample rate

bits int

Container bits per sample (block alignment is derived from this)

channels int

Number of channels

useIeeeFloat bool

True for IEEE float samples, false for integer PCM

validBitsPerSample int

Number of valid bits per sample (may be less than bits)

channelMask int

Channel mask describing the speaker layout, or 0 if unspecified

WaveFormatExtensible(int, int, int, Guid, int, Speakers)

Creates a new WaveFormatExtensible with full control over the SubFormat, valid bits per sample and a strongly typed channel layout. See WaveFormatExtensible(int, int, int, Guid, int, int) for details.

public WaveFormatExtensible(int rate, int bits, int channels, Guid subFormat, int validBitsPerSample, Speakers channelMask)

Parameters

rate int

Sample rate

bits int

Container bits per sample (block alignment is derived from this)

channels int

Number of channels

subFormat Guid

SubFormat GUID (e.g. one of AudioMediaSubtypes)

validBitsPerSample int

Number of valid bits per sample (may be less than bits)

channelMask Speakers

Speaker positions present in the stream

WaveFormatExtensible(int, int, int, Guid, int, int)

Creates a new WaveFormatExtensible with full control over the SubFormat, valid bits per sample and channel mask. Use this overload when the convenience PCM/IEEE constructor's assumptions don't fit — for example to create 32-bit integer PCM (rather than IEEE float), to carry a container size that differs from the valid bit depth (e.g. 24 valid bits in a 32-bit container), or to preserve an explicit channel layout.

public WaveFormatExtensible(int rate, int bits, int channels, Guid subFormat, int validBitsPerSample, int channelMask)

Parameters

rate int

Sample rate

bits int

Container bits per sample (block alignment is derived from this)

channels int

Number of channels

subFormat Guid

SubFormat GUID (e.g. one of AudioMediaSubtypes)

validBitsPerSample int

Number of valid bits per sample (may be less than bits)

channelMask int

Channel mask describing the speaker layout, or 0 if unspecified

WaveFormatExtensible(int, int, int, int)

Creates a new WaveFormatExtensible for PCM or IEEE

public WaveFormatExtensible(int rate, int bits, int channels, int channelMask = 0)

Parameters

rate int
bits int
channels int
channelMask int

Properties

ChannelMask

The channel mask describing which speaker positions are present in the stream. Compare against the Speakers flags. Zero means no explicit layout was specified.

public int ChannelMask { get; }

Property Value

int

SubFormat

SubFormat (may be one of AudioMediaSubtypes)

public Guid SubFormat { get; }

Property Value

Guid

ValidBitsPerSample

The number of valid bits per sample. May be less than BitsPerSample when samples are stored in a larger container (e.g. 24 valid bits packed into a 32-bit container).

public int ValidBitsPerSample { get; }

Property Value

int

Methods

Serialize(BinaryWriter)

Serialize

public override void Serialize(BinaryWriter writer)

Parameters

writer BinaryWriter

ToStandardWaveFormat()

WaveFormatExtensible for PCM or floating point can be awkward to work with This creates a regular WaveFormat structure representing the same audio format Returns the WaveFormat unchanged for non PCM or IEEE float

public WaveFormat ToStandardWaveFormat()

Returns

WaveFormat

ToString()

String representation

public override string ToString()

Returns

string