C# Class Mp3Sharp.Mp3Stream

Provides a view of the sequence of bytes that are produced during the conversion of an MP3 stream into a 16-bit PCM-encoded ("WAV" format) stream.
Inheritance: Stream
Show file Open project: RHY3756547/FreeSO Class Usage Examples

Public Properties

Property Type Description
FormatRep SoundFormat

Public Methods

Method Description
Close ( ) : void

Closes the source stream and releases any associated resources.

DecodeFrames ( int frameCount ) : int

Decodes the requested number of frames from the MP3 stream and caches their PCM-encoded bytes. These can subsequently be obtained using the Read method. Returns the number of frames that were successfully decoded.

Flush ( ) : void
Mp3Stream ( Stream sourceStream ) : System

Creates a new stream instance using the provided stream as a source, and the default chunk size of 4096 bytes.

Mp3Stream ( Stream sourceStream, int chunkSize ) : System

Creates a new stream instance using the provided stream as a source.

Mp3Stream ( string fileName ) : System

Creates a new stream instance using the provided filename, and the default chunk size of 4096 bytes.

Mp3Stream ( string fileName, int chunkSize ) : System

Creates a new stream instance using the provided filename and chunk size.

Read ( byte buffer, int offset, int count ) : int

Reads the MP3 stream as PCM-encoded bytes. Decodes a portion of the stream if necessary.

ReadByte ( ) : int

Reads a single byte of the PCM-encoded stream.

Seek ( long pos, SeekOrigin origin ) : long

Sets the position of the source stream.

SetLength ( long len ) : void

This method is not valid for an Mp3Stream.

Write ( byte buf, int ofs, int count ) : void

This method is not valid for an Mp3Stream.

Private Methods

Method Description
ReadFrame ( ) : bool

Reads a frame from the MP3 stream. Returns whether the operation was successful. If it wasn't, the source stream is probably at its end.

Method Details

Close() public method

Closes the source stream and releases any associated resources.
public Close ( ) : void
return void

DecodeFrames() public method

Decodes the requested number of frames from the MP3 stream and caches their PCM-encoded bytes. These can subsequently be obtained using the Read method. Returns the number of frames that were successfully decoded.
public DecodeFrames ( int frameCount ) : int
frameCount int
return int

Flush() public method

public Flush ( ) : void
return void

Mp3Stream() public method

Creates a new stream instance using the provided stream as a source, and the default chunk size of 4096 bytes.
public Mp3Stream ( Stream sourceStream ) : System
sourceStream Stream
return System

Mp3Stream() public method

Creates a new stream instance using the provided stream as a source.
public Mp3Stream ( Stream sourceStream, int chunkSize ) : System
sourceStream Stream
chunkSize int
return System

Mp3Stream() public method

Creates a new stream instance using the provided filename, and the default chunk size of 4096 bytes.
public Mp3Stream ( string fileName ) : System
fileName string
return System

Mp3Stream() public method

Creates a new stream instance using the provided filename and chunk size.
public Mp3Stream ( string fileName, int chunkSize ) : System
fileName string
chunkSize int
return System

Read() public method

Reads the MP3 stream as PCM-encoded bytes. Decodes a portion of the stream if necessary.
public Read ( byte buffer, int offset, int count ) : int
buffer byte
offset int
count int
return int

ReadByte() public method

Reads a single byte of the PCM-encoded stream.
public ReadByte ( ) : int
return int

Seek() public method

Sets the position of the source stream.
public Seek ( long pos, SeekOrigin origin ) : long
pos long
origin SeekOrigin
return long

SetLength() public method

This method is not valid for an Mp3Stream.
public SetLength ( long len ) : void
len long
return void

Write() public method

This method is not valid for an Mp3Stream.
public Write ( byte buf, int ofs, int count ) : void
buf byte
ofs int
count int
return void

Property Details

FormatRep public property

public SoundFormat FormatRep
return SoundFormat