This class can be used to turn variable sized audio buffer stream into a stabilized constant length audio buffer stream. More...
#include <BufferRegulator.hpp>
Public Member Functions | |
BufferRegulator (const uint outputBufferMs, const AudioCallbackFunction audioCallback) | |
Creates a BufferRegulator instance. | |
void | reset () |
Resets the buffer regulator's internal state. | |
bool | process (float **buffers, const uint inputChannels, const uint outputChannels, const uint numberOfFrames, const uint sampleRate, void *userPointer) |
The audio process function. | |
This class can be used to turn variable sized audio buffer stream into a stabilized constant length audio buffer stream.
BufferRegulator class.
The BufferRegulator's process function can receive any number of frames, but the callback function is always called with outputBufferMs long buffers.
switchboard::BufferRegulator::BufferRegulator | ( | const uint | outputBufferMs, |
const AudioCallbackFunction | audioCallback | ||
) |
Creates a BufferRegulator instance.
outputBufferMs | Buffer duration that is received by the callback function. |
audioCallback | The callback function that receives the duration regulated audio buffers. |
bool switchboard::BufferRegulator::process | ( | float ** | buffers, |
const uint | inputChannels, | ||
const uint | outputChannels, | ||
const uint | numberOfFrames, | ||
const uint | sampleRate, | ||
void * | userPointer | ||
) |
The audio process function.
When sample rate changes, the BufferRegulator resets its state and clears its internal buffers.
buffers | [inout] The audio buffer. |
inputChannels | Number of input channels. |
outputChannels | Number of output channels. |
sampleRate | Sample rate of audio data. |
userPointer | Custom pointer that is passed to the callback function. |