Allocates memory for multiple AudioBuffer instances. More...
#include <AudioBufferPool.hpp>
Public Member Functions | |
AudioBufferPool (const uint maxNumberOfBuffers, const uint maxNumberOfChannels, const uint maxNumberOfFrames) | |
Creates an AudioBufferPool instance. | |
~AudioBufferPool () | |
AudioBufferPool destructor. | |
uint | getNumberOfAvailableBuffers () const |
Returns the number of available audio buffers in the pool. | |
AudioBuffer< T > & | takeAudioBuffer (const uint numberOfChannels, const uint numberOfFrames) |
Takes an audio buffer from the pool. | |
void | returnAudioBuffer (AudioBuffer< T > &audioBuffer) |
Returns an audio buffer to the pool. | |
Allocates memory for multiple AudioBuffer instances.
AudioBufferPool class.
This class can be used to avoid allocations on the real-time audio thread by pre-allocating enough memory for the audio buffers. Only supports non-interleaved buffers.
switchboard::AudioBufferPool< T >::AudioBufferPool | ( | const uint | maxNumberOfBuffers, |
const uint | maxNumberOfChannels, | ||
const uint | maxNumberOfFrames | ||
) |
Creates an AudioBufferPool instance.
maxNumberOfBuffers | Maximum number of AudioBuffer instances that can be taked from the pool. |
maxNumberOfChannels | Maximum number of channels for each audio buffer. |
maxNumberOfFrames | Maximum number of channels for each audio buffer. |
uint switchboard::AudioBufferPool< T >::getNumberOfAvailableBuffers |
Returns the number of available audio buffers in the pool.
void switchboard::AudioBufferPool< T >::returnAudioBuffer | ( | AudioBuffer< T > & | audioBuffer | ) |
Returns an audio buffer to the pool.
audioBuffer | The returned audio buffer. |
AudioBuffer< T > & switchboard::AudioBufferPool< T >::takeAudioBuffer | ( | const uint | numberOfChannels, |
const uint | numberOfFrames | ||
) |
Takes an audio buffer from the pool.
numberOfChannels | The number of channels for the audio buffer. |
numberOfFrames | The number of frames for the audio buffer. |