Created
November 16, 2009 16:35
-
-
Save ddribin/236116 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class CARingBuffer { | |
public: | |
typedef SInt64 SampleTime; | |
CARingBuffer(); | |
~CARingBuffer(); | |
void Allocate(int nChannels, UInt32 bytesPerFrame, UInt32 capacityFrames); | |
// capacityFrames will be rounded up to a power of 2 | |
void Deallocate(); | |
CARingBufferError Store(const AudioBufferList *abl, UInt32 nFrames, SampleTime c); | |
// Copy nFrames of data into the ring buffer at the specified sample time. | |
// The sample time should normally increase sequentially, though gaps | |
// are filled with zeroes. A sufficiently large gap effectively empties | |
// the buffer before storing the new data. | |
// If frameNumber is less than the previous frame number, the behavior is undefined. | |
// Return false for failure (buffer not large enough). | |
CARingBufferError Fetch(AudioBufferList *abl, UInt32 nFrames, SampleTime frameNumber); | |
// will alter mNumDataBytes of the buffers | |
CARingBufferError GetTimeBounds(SampleTime &startTime, SampleTime &endTime); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment