C# Class GAudio.GATAsyncWavWriter

Creates or overwrites a wav file. Writing to the file and finalizing the header is done on a seperate thread. Input is cached in a ring buffer, and written in chunks of size AudioSettings.dspBufferSize. Note: this class is lockless.
Inheritance: IDisposable
Exibir arquivo Open project: gregzo/G-Audio Class Usage Examples

Public Properties

Property Type Description
WriteChunkFrames int

Public Methods

Method Description
Dispose ( ) : void

Releases all resource used by the GATAsyncWavWriter object.

Call Dispose when you are finished using the GATAsyncWavWriter. The Dispose method leaves the GATAsyncWavWriter in an unusable state. After calling Dispose, you must release all references to the GATAsyncWavWriter so the garbage collector can reclaim the memory that the GATAsyncWavWriter was occupying.

GATAsyncWavWriter ( string filePath, int numChannels, bool overwrite ) : System

filePath should be absolute and valid. If the file doesn't exist, it will be immediately created.

PrepareToWrite ( ) : void

You must call PrepareToWrite before the first WriteStreamAsync call. This starts a thread which waits for input and writes to disk when enough data has been received.

StopAndFinalize ( ) : void

Blocks further input, flushes what is left in the ring buffer to disk, and finalizes the header. As these operations are async, the file will not be immediately ready to be opened.

WriteStreamAsync ( float data, int offset, int numFrames ) : void

Hand out data here sequentially. If PrepareToWrite has not been called before, this method will have no effect. Note that numFrames should not exceed WriteChunkFrames.

Protected Methods

Method Description
Dispose ( bool explicitly ) : void

Private Methods

Method Description
AsyncWriteLoop ( ) : void
ConvertAndWriteChunk ( int numFrames ) : void

Method Details

Dispose() public method

Releases all resource used by the GATAsyncWavWriter object.
Call Dispose when you are finished using the GATAsyncWavWriter. The Dispose method leaves the GATAsyncWavWriter in an unusable state. After calling Dispose, you must release all references to the GATAsyncWavWriter so the garbage collector can reclaim the memory that the GATAsyncWavWriter was occupying.
public Dispose ( ) : void
return void

Dispose() protected method

protected Dispose ( bool explicitly ) : void
explicitly bool
return void

GATAsyncWavWriter() public method

filePath should be absolute and valid. If the file doesn't exist, it will be immediately created.
public GATAsyncWavWriter ( string filePath, int numChannels, bool overwrite ) : System
filePath string
numChannels int
overwrite bool
return System

PrepareToWrite() public method

You must call PrepareToWrite before the first WriteStreamAsync call. This starts a thread which waits for input and writes to disk when enough data has been received.
public PrepareToWrite ( ) : void
return void

StopAndFinalize() public method

Blocks further input, flushes what is left in the ring buffer to disk, and finalizes the header. As these operations are async, the file will not be immediately ready to be opened.
public StopAndFinalize ( ) : void
return void

WriteStreamAsync() public method

Hand out data here sequentially. If PrepareToWrite has not been called before, this method will have no effect. Note that numFrames should not exceed WriteChunkFrames.
public WriteStreamAsync ( float data, int offset, int numFrames ) : void
data float
offset int
numFrames int
return void

Property Details

WriteChunkFrames public_oe property

How many frames maximum are written at a time?
public int WriteChunkFrames
return int