C# Class GSF.Media.WaveFormatChunk

Represents the format chunk in a WAVE media format file.
Inheritance: RiffChunk, ISupportBinaryImage
Mostrar archivo Open project: GridProtectionAlliance/gsf Class Usage Examples

Public Methods

Method Description
CastSample ( double sample ) : LittleBinaryValue

Casts sample value to its equivalent native type based on defined BitsPerSample and AudioFormat.

Clone ( ) : WaveFormatChunk

Creates a copy of the WaveFormatChunk.

GenerateBinaryImage ( byte buffer, int startIndex ) : int

Generates a binary representation of this WaveFormatChunk and copies it into the given buffer.

GetSampleTypeCode ( ) : TypeCode

Determines sample data type code based on defined BitsPerSample and AudioFormat.

ParseBinaryImage ( byte buffer, int startIndex, int length ) : int

Parses WaveFormatChunk object by parsing the specified buffer containing a binary image.

WaveFormatChunk ( int sampleRate, short bitsPerSample, short channels, ushort audioFormat ) : System

Constructs a new WaveFormatChunk using the specified audio parameters.

Private Methods

Method Description
UpdateBlockAlignment ( ) : void
UpdateByteRate ( ) : void
WaveFormatChunk ( RiffChunk preRead, Stream source ) : System

Method Details

CastSample() public method

Casts sample value to its equivalent native type based on defined BitsPerSample and AudioFormat.
public CastSample ( double sample ) : LittleBinaryValue
sample double Sample value.
return LittleBinaryValue

Clone() public method

Creates a copy of the WaveFormatChunk.
public Clone ( ) : WaveFormatChunk
return WaveFormatChunk

GenerateBinaryImage() public method

Generates a binary representation of this WaveFormatChunk and copies it into the given buffer.
is null. /// or is less than 0 -or- /// and will exceed length. ///
public GenerateBinaryImage ( byte buffer, int startIndex ) : int
buffer byte Buffer used to hold generated binary image of the source object.
startIndex int 0-based starting index in the to start writing.
return int

GetSampleTypeCode() public method

Determines sample data type code based on defined BitsPerSample and AudioFormat.
public GetSampleTypeCode ( ) : TypeCode
return TypeCode

ParseBinaryImage() public method

Parses WaveFormatChunk object by parsing the specified buffer containing a binary image.
WAVE format section too small, wave file corrupted. is null. /// or is less than 0 -or- /// and will exceed length. ///
public ParseBinaryImage ( byte buffer, int startIndex, int length ) : int
buffer byte Buffer containing binary image to parse.
startIndex int 0-based starting index in the to start parsing.
length int Valid number of bytes within from .
return int

WaveFormatChunk() public method

Constructs a new WaveFormatChunk using the specified audio parameters.
Invalid bit rate specified - wave file bit rates must be a multiple of 8.
public WaveFormatChunk ( int sampleRate, short bitsPerSample, short channels, ushort audioFormat ) : System
sampleRate int Sample rate for the .
bitsPerSample short Bits per sample for the .
channels short Audio channels for the .
audioFormat ushort Audio format for the .
return System