Loading...
Searching...
No Matches
Public Member Functions | List of all members
switchboard::AudioRingBuffer< T > Class Template Reference

Class providing ring buffer functionality specialized for audio (most importantly multichannel functionality). More...

#include <AudioRingBuffer.hpp>

Public Member Functions

 AudioRingBuffer (const uint numberOfFrames, const uint numberOfChannels, bool isInterleaved)
 Creates an AudioRingBuffer instance.
 
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.
 

Detailed Description

template<typename T>
class switchboard::AudioRingBuffer< T >

Class providing ring buffer functionality specialized for audio (most importantly multichannel functionality).

AudioRingBuffer class.

Constructor & Destructor Documentation

◆ AudioRingBuffer()

template<typename T >
switchboard::AudioRingBuffer< T >::AudioRingBuffer ( const uint  numberOfFrames,
const uint  numberOfChannels,
bool  isInterleaved 
)

Creates an AudioRingBuffer instance.

Parameters
numberOfFramesThe number of frames that the audio ring buffer can hold.
numberOfChannelsThe number of channels that the audio ring buffer can hold.
isInterleavedIndicates whether the audio ring buffer should hold interleaved data.

Member Function Documentation

◆ consume()

template<typename T >
void switchboard::AudioRingBuffer< T >::consume ( AudioBuffer< T > &  destinationBuffer,
const uint  numberOfFrames 
)

Reads items from the ring buffer.

Parameters
destinationBuffer[inout] The buffer where the read frames will be copied to.
numberOfFramesThe number of frames that should be consumed.

◆ getAvailableFramesToConsume()

template<typename T >
const uint switchboard::AudioRingBuffer< T >::getAvailableFramesToConsume

Returns the maximum number of items that can be read from the ring buffer.

Returns
The number frames that can be consumed.

◆ getAvailableFramesToProduce()

template<typename T >
const uint switchboard::AudioRingBuffer< T >::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()

template<typename T >
void switchboard::AudioRingBuffer< T >::produce ( const AudioBuffer< T > &  sourceBuffer,
const uint  numberOfFrames 
)

Adds frames to the audio ring buffer.

Parameters
sourceBufferThe buffer where the frames are copied from.
numberOfFramesThe number of frames that should be added to the audio ring buffer.

The documentation for this class was generated from the following files: