C# Class NAudio.Wave.AudioFileReader

AudioFileReader simplifies opening an audio file in NAudio Simply pass in the filename, and it will attempt to open the file and set up a conversion path that turns into PCM IEEE float. ACM codecs will be used for conversion. It provides a volume property and implements both WaveStream and ISampleProvider, making it possibly the only stage in your audio pipeline necessary for simple playback scenarios
Inheritance: WaveStream, ISampleProvider
Show file Open project: jishi/Jishi.StreamToSonos Class Usage Examples

Public Methods

Method Description
AudioFileReader ( string fileName ) : System

Initializes a new instance of AudioFileReader

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

Reads from this wave stream

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

Reads audio from this sample provider

Protected Methods

Method Description
Dispose ( bool disposing ) : void

Disposes this AudioFileReader

Private Methods

Method Description
CreateReaderStream ( string fileName ) : void

Creates the reader stream, supporting all filetypes in the core NAudio library, and ensuring we are in PCM format

DestToSource ( long destBytes ) : long

Helper to convert dest to source bytes

SourceToDest ( long sourceBytes ) : long

Helper to convert source to dest bytes

Method Details

AudioFileReader() public method

Initializes a new instance of AudioFileReader
public AudioFileReader ( string fileName ) : System
fileName string The file to open
return System

Dispose() protected method

Disposes this AudioFileReader
protected Dispose ( bool disposing ) : void
disposing bool True if called from Dispose
return void

Read() public method

Reads from this wave stream
public Read ( byte buffer, int offset, int count ) : int
buffer byte Audio buffer
offset int Offset into buffer
count int Number of bytes required
return int

Read() public method

Reads audio from this sample provider
public Read ( float buffer, int offset, int count ) : int
buffer float Sample buffer
offset int Offset into sample buffer
count int Number of samples required
return int