Class providing ring buffer functionality specialized for audio (most importantly multichannel functionality).
More...
#include <AudioRingBuffer.hpp>
|
| AudioRingBuffer (const uint numberOfFrames, const uint numberOfChannels, bool isInterleaved) |
| Creates an AudioRingBuffer instance. Allocates underlying buffer, constructor not suitable for real-time use.
|
|
| AudioRingBuffer (const uint numberOfFrames, const uint numberOfChannels, bool isInterleaved, AudioData< T > &buffer) |
| Creates an AudioRingBuffer instance. Does not allocate underlying buffer, suitable for real-time use.
|
|
void | clear () |
| Clears all data in the audio ring buffer.
|
|
const uint | getAvailableFramesToProduce () const |
| Returns the maximum number of frames that can be added to the audio ring buffer.
|
|
void | produce (const AudioBuffer< T > &sourceBuffer, const uint numberOfFrames) |
| Adds frames to the audio ring buffer.
|
|
const uint | getAvailableFramesToConsume () const |
| Returns the maximum number of items that can be read from the ring buffer.
|
|
void | consume (AudioBuffer< T > &destinationBuffer, const uint numberOfFrames) |
| Reads items from the ring buffer.
|
|
void | read (AudioBuffer< T > &destinationBuffer, uint numberOfItems) |
| Reads items from the ring buffer without updating the read pointer.
|
|
void | discard (uint numberOfItems) |
| Discards items from the ring buffer. Steps the read pointer without reading the items.
|
|
template<typename T>
class switchboard::AudioRingBuffer< T >
Class providing ring buffer functionality specialized for audio (most importantly multichannel functionality).
AudioRingBuffer class.
◆ AudioRingBuffer() [1/2]
Creates an AudioRingBuffer instance. Allocates underlying buffer, constructor not suitable for real-time use.
- Parameters
-
numberOfFrames | The number of frames that the audio ring buffer can hold. |
numberOfChannels | The number of channels that the audio ring buffer can hold. |
isInterleaved | Indicates whether the audio ring buffer should hold interleaved data. |
◆ AudioRingBuffer() [2/2]
Creates an AudioRingBuffer instance. Does not allocate underlying buffer, suitable for real-time use.
Does not delete the buffer on destruction. Make sure to handle deletion.
- Parameters
-
numberOfFrames | The number of frames that the audio ring buffer can hold. |
numberOfChannels | The number of channels that the audio ring buffer can hold. |
isInterleaved | Indicates whether the audio ring buffer should hold interleaved data. |
buffer | The underlying buffer(s) the ring buffer is operating on. |
◆ consume()
Reads items from the ring buffer.
- Parameters
-
destinationBuffer | [inout] The buffer where the read frames will be copied to. |
numberOfFrames | The number of frames that should be consumed. |
◆ discard()
Discards items from the ring buffer. Steps the read pointer without reading the items.
- Parameters
-
numberOfItems | The number of items that should be discarded. |
◆ getAvailableFramesToConsume()
Returns the maximum number of items that can be read from the ring buffer.
- Returns
- The number frames that can be consumed.
◆ getAvailableFramesToProduce()
Returns the maximum number of frames that can be added to the audio ring buffer.
- Returns
- The number of frames that can be produced.
◆ produce()
Adds frames to the audio ring buffer.
- Parameters
-
sourceBuffer | The buffer where the frames are copied from. |
numberOfFrames | The number of frames that should be added to the audio ring buffer. |
◆ read()
Reads items from the ring buffer without updating the read pointer.
- Parameters
-
destinationBuffer | [inout] The buffer where the read frames will be copied to. |
numberOfItems | The number of items that should be consumed. |