10#include <audio/RingBuffer.hpp>
11#include <buffer/AudioData.hpp>
13#include <switchboard/export.h>
14#include <switchboard_core/AudioBuffer.hpp>
15#include <switchboard_core/SwitchboardCore.hpp>
18namespace switchboard {
45 AudioRingBuffer(uint numberOfFrames, uint numberOfChannels,
bool isInterleaved, buffer::AudioData<T>& buffer);
108 std::vector<std::unique_ptr<audio::RingBuffer<T>>> bufferContainer;
109 uint numberOfChannels;
Provides an abstraction around raw audio buffers stored in memory.
Definition AudioBuffer.hpp:22
void consume(AudioBuffer< T > &destinationBuffer, uint numberOfFrames)
Reads items from the ring buffer.
void produce(const AudioBuffer< T > &sourceBuffer, uint numberOfFrames)
Adds frames to the audio ring buffer.
uint getAvailableFramesToProduce() const
Returns the maximum number of frames that can be added to the audio ring buffer.
void discard(uint numberOfItems)
Discards items from the ring buffer. Steps the read pointer without reading the items.
void clear()
Clears all data in the audio ring buffer.
void read(AudioBuffer< T > &destinationBuffer, uint numberOfItems)
Reads items from the ring buffer without updating the read pointer.
uint getAvailableFramesToConsume() const
Returns the maximum number of items that can be read from the ring buffer.
AudioRingBuffer & operator=(AudioRingBuffer &&)=default
Move assignment operator.
AudioRingBuffer(uint numberOfFrames, uint numberOfChannels, bool isInterleaved)
Creates an AudioRingBuffer instance. Allocates underlying buffer, constructor not suitable for real-t...
AudioRingBuffer(uint numberOfFrames, uint numberOfChannels, bool isInterleaved, buffer::AudioData< T > &buffer)
Creates an AudioRingBuffer instance. Does not allocate underlying buffer, suitable for real-time use.
AudioRingBuffer(AudioRingBuffer &&)=default
Move constructor.