C# Class NAudio.Wave.WaveFormat

Show file Open project: jishi/Jishi.StreamToSonos Class Usage Examples

Protected Properties

Property Type Description
averageBytesPerSecond int
bitsPerSample short
blockAlign short
channels short
extraSize short
sampleRate int
waveFormatTag WaveFormatEncoding

Public Methods

Method Description
ConvertLatencyToByteSize ( int milliseconds ) : int

Gets the size of a wave buffer equivalent to the latency in milliseconds.

CreateALawFormat ( int sampleRate, int channels ) : WaveFormat

Creates an A-law wave format

CreateCustomFormat ( WaveFormatEncoding tag, int sampleRate, int channels, int averageBytesPerSecond, int blockAlign, int bitsPerSample ) : WaveFormat

Creates a WaveFormat with custom members

CreateIeeeFloatWaveFormat ( int sampleRate, int channels ) : WaveFormat

Creates a new 32 bit IEEE floating point wave format

CreateMuLawFormat ( int sampleRate, int channels ) : WaveFormat

Creates a Mu-law wave format

Equals ( object obj ) : bool

Compares with another WaveFormat object

FromFormatChunk ( BinaryReader br, int formatChunkLength ) : WaveFormat

Reads in a WaveFormat (with extra data) from a fmt chunk (chunk identifier and length should already have been read)

GetHashCode ( ) : int

Provides a Hashcode for this WaveFormat

MarshalFromPtr ( IntPtr pointer ) : WaveFormat

Helper function to retrieve a WaveFormat structure from a pointer

MarshalToPtr ( WaveFormat format ) : IntPtr

Helper function to marshal WaveFormat to an IntPtr

Serialize ( BinaryWriter writer ) : void

Writes this WaveFormat object to a stream

ToString ( ) : string

Reports this WaveFormat as a string

WaveFormat ( ) : System

Creates a new PCM 44.1Khz stereo 16 bit format

WaveFormat ( BinaryReader br ) : System

Reads a new WaveFormat object from a stream

WaveFormat ( int sampleRate, int channels ) : System

Creates a new 16 bit wave format with the specified sample rate and channel count

WaveFormat ( int rate, int bits, int channels ) : System

Creates a new PCM format with the specified sample rate, bit depth and channels

Private Methods

Method Description
ReadWaveFormat ( BinaryReader br, int formatChunkLength ) : void

Method Details

ConvertLatencyToByteSize() public method

Gets the size of a wave buffer equivalent to the latency in milliseconds.
public ConvertLatencyToByteSize ( int milliseconds ) : int
milliseconds int The milliseconds.
return int

CreateALawFormat() public static method

Creates an A-law wave format
public static CreateALawFormat ( int sampleRate, int channels ) : WaveFormat
sampleRate int Sample Rate
channels int Number of Channels
return WaveFormat

CreateCustomFormat() public static method

Creates a WaveFormat with custom members
public static CreateCustomFormat ( WaveFormatEncoding tag, int sampleRate, int channels, int averageBytesPerSecond, int blockAlign, int bitsPerSample ) : WaveFormat
tag WaveFormatEncoding The encoding
sampleRate int Sample Rate
channels int Number of channels
averageBytesPerSecond int Average Bytes Per Second
blockAlign int Block Align
bitsPerSample int Bits Per Sample
return WaveFormat

CreateIeeeFloatWaveFormat() public static method

Creates a new 32 bit IEEE floating point wave format
public static CreateIeeeFloatWaveFormat ( int sampleRate, int channels ) : WaveFormat
sampleRate int sample rate
channels int number of channels
return WaveFormat

CreateMuLawFormat() public static method

Creates a Mu-law wave format
public static CreateMuLawFormat ( int sampleRate, int channels ) : WaveFormat
sampleRate int Sample Rate
channels int Number of Channels
return WaveFormat

Equals() public method

Compares with another WaveFormat object
public Equals ( object obj ) : bool
obj object Object to compare to
return bool

FromFormatChunk() public static method

Reads in a WaveFormat (with extra data) from a fmt chunk (chunk identifier and length should already have been read)
public static FromFormatChunk ( BinaryReader br, int formatChunkLength ) : WaveFormat
br System.IO.BinaryReader Binary reader
formatChunkLength int Format chunk length
return WaveFormat

GetHashCode() public method

Provides a Hashcode for this WaveFormat
public GetHashCode ( ) : int
return int

MarshalFromPtr() public static method

Helper function to retrieve a WaveFormat structure from a pointer
public static MarshalFromPtr ( IntPtr pointer ) : WaveFormat
pointer System.IntPtr WaveFormat structure
return WaveFormat

MarshalToPtr() public static method

Helper function to marshal WaveFormat to an IntPtr
public static MarshalToPtr ( WaveFormat format ) : IntPtr
format WaveFormat WaveFormat
return System.IntPtr

Serialize() public method

Writes this WaveFormat object to a stream
public Serialize ( BinaryWriter writer ) : void
writer System.IO.BinaryWriter the output stream
return void

ToString() public method

Reports this WaveFormat as a string
public ToString ( ) : string
return string

WaveFormat() public method

Creates a new PCM 44.1Khz stereo 16 bit format
public WaveFormat ( ) : System
return System

WaveFormat() public method

Reads a new WaveFormat object from a stream
public WaveFormat ( BinaryReader br ) : System
br System.IO.BinaryReader A binary reader that wraps the stream
return System

WaveFormat() public method

Creates a new 16 bit wave format with the specified sample rate and channel count
public WaveFormat ( int sampleRate, int channels ) : System
sampleRate int Sample Rate
channels int Number of channels
return System

WaveFormat() public method

Creates a new PCM format with the specified sample rate, bit depth and channels
public WaveFormat ( int rate, int bits, int channels ) : System
rate int
bits int
channels int
return System

Property Details

averageBytesPerSecond protected property

for buffer estimation
protected int averageBytesPerSecond
return int

bitsPerSample protected property

number of bits per sample of mono data
protected short bitsPerSample
return short

blockAlign protected property

block size of data
protected short blockAlign
return short

channels protected property

number of channels
protected short channels
return short

extraSize protected property

number of following bytes
protected short extraSize
return short

sampleRate protected property

sample rate
protected int sampleRate
return int

waveFormatTag protected property

format type
protected WaveFormatEncoding waveFormatTag
return WaveFormatEncoding