RAVENNAKIT
Loading...
Searching...
No Matches
rav::AudioFifoBuffer< T, F > Class Template Reference

#include <audio_fifo_buffer.hpp>

Public Member Functions

 AudioFifoBuffer ()=default
 AudioFifoBuffer (const size_t num_channels, const size_t num_frames)
 Constructs a queue with a given number of elements.
bool write (const AudioBuffer< T > &src)
 Writes audio data to the buffer.
bool write (const T *const *src, const size_t num_channels, const size_t number_of_frames)
 Writes audio data to the buffer.
bool read (AudioBuffer< T > &dst)
 Reads audio data from the buffer.
bool read (T *const *dst, const size_t num_channels, const size_t number_of_frames)
 Reads audio data from the buffer.
template<class SrcType, class SrcByteOrder, class SrcInterleaving>
bool write_from_data (const SrcType *data, const size_t num_frames)
 Writes audio data into the buffer, converting the source data to the buffer's format.
template<class DstType, class DstByteOrder, class DstInterleaving>
bool read_to_data (DstType *data, const size_t num_frames)
 Reads audio data from the buffer, converting the data to the destination format.
void resize (const size_t num_channels, const size_t num_frames)
 Resizes this buffer, clearing existing data.
size_t num_channels () const
size_t num_frames () const
void reset ()
 Clears the buffer.
size_t size ()

Detailed Description

template<class T, class F = Fifo::Single>
class rav::AudioFifoBuffer< T, F >

Definition at line 37 of file audio_fifo_buffer.hpp.

Constructor & Destructor Documentation

◆ AudioFifoBuffer() [1/2]

template<class T, class F = Fifo::Single>
rav::AudioFifoBuffer< T, F >::AudioFifoBuffer ( )
default

◆ AudioFifoBuffer() [2/2]

template<class T, class F = Fifo::Single>
rav::AudioFifoBuffer< T, F >::AudioFifoBuffer ( const size_t num_channels,
const size_t num_frames )
inlineexplicit

Constructs a queue with a given number of elements.

Parameters
num_channelsThe number of channels in the buffer.
num_framesThe number of frames in the buffer.

Definition at line 46 of file audio_fifo_buffer.hpp.

Member Function Documentation

◆ num_channels()

template<class T, class F = Fifo::Single>
size_t rav::AudioFifoBuffer< T, F >::num_channels ( ) const
inlinenodiscard
Returns
The number of channels.

Definition at line 195 of file audio_fifo_buffer.hpp.

◆ num_frames()

template<class T, class F = Fifo::Single>
size_t rav::AudioFifoBuffer< T, F >::num_frames ( ) const
inlinenodiscard
Returns
The number of frames (samples per channel).

Definition at line 202 of file audio_fifo_buffer.hpp.

◆ read() [1/2]

template<class T, class F = Fifo::Single>
bool rav::AudioFifoBuffer< T, F >::read ( AudioBuffer< T > & dst)
inline

Reads audio data from the buffer.

Parameters
dstDestination buffer.
Returns
True if reading was successful, false if there was not enough data to read.

Definition at line 87 of file audio_fifo_buffer.hpp.

◆ read() [2/2]

template<class T, class F = Fifo::Single>
bool rav::AudioFifoBuffer< T, F >::read ( T *const * dst,
const size_t num_channels,
const size_t number_of_frames )
inline

Reads audio data from the buffer.

Parameters
dstDestination buffers.
num_channelsNumber of channels in the destination buffers.
number_of_framesNumber of frames to read.
Returns
True if reading was successful, false if there was not enough data to read.

Definition at line 98 of file audio_fifo_buffer.hpp.

◆ read_to_data()

template<class T, class F = Fifo::Single>
template<class DstType, class DstByteOrder, class DstInterleaving>
bool rav::AudioFifoBuffer< T, F >::read_to_data ( DstType * data,
const size_t num_frames )
inline

Reads audio data from the buffer, converting the data to the destination format.

Template Parameters
DstTypeThe type of the destination data.
DstByteOrderThe byte order of the destination data.
DstInterleavingThe interleaving of the destination data.
Parameters
dataThe destination buffer.
num_framesThe number of frames to read and write.
Returns
True if reading was successful, false if there was not enough data to read.

Definition at line 158 of file audio_fifo_buffer.hpp.

◆ reset()

template<class T, class F = Fifo::Single>
void rav::AudioFifoBuffer< T, F >::reset ( )
inline

Clears the buffer.

Definition at line 209 of file audio_fifo_buffer.hpp.

◆ resize()

template<class T, class F = Fifo::Single>
void rav::AudioFifoBuffer< T, F >::resize ( const size_t num_channels,
const size_t num_frames )
inline

Resizes this buffer, clearing existing data.

Parameters
num_channelsThe number of channels in the buffer.
num_framesThe number of frames in the buffer.

Definition at line 187 of file audio_fifo_buffer.hpp.

◆ size()

template<class T, class F = Fifo::Single>
size_t rav::AudioFifoBuffer< T, F >::size ( )
inline
Returns
The number of elements in the buffer.

Definition at line 217 of file audio_fifo_buffer.hpp.

◆ write() [1/2]

template<class T, class F = Fifo::Single>
bool rav::AudioFifoBuffer< T, F >::write ( const AudioBuffer< T > & src)
inline

Writes audio data to the buffer.

Parameters
srcSource data.
Returns
True if writing was successful, false if there was not enough space to write all data.

Definition at line 55 of file audio_fifo_buffer.hpp.

◆ write() [2/2]

template<class T, class F = Fifo::Single>
bool rav::AudioFifoBuffer< T, F >::write ( const T *const * src,
const size_t num_channels,
const size_t number_of_frames )
inline

Writes audio data to the buffer.

Parameters
srcSource data.
num_channelsNumber of channels in the source data.
number_of_framesNumber of frames in the source data.
Returns
True if writing was successful, false if there was not enough space to write all data.

Definition at line 66 of file audio_fifo_buffer.hpp.

◆ write_from_data()

template<class T, class F = Fifo::Single>
template<class SrcType, class SrcByteOrder, class SrcInterleaving>
bool rav::AudioFifoBuffer< T, F >::write_from_data ( const SrcType * data,
const size_t num_frames )
inline

Writes audio data into the buffer, converting the source data to the buffer's format.

Template Parameters
SrcTypeThe type of the source data.
SrcByteOrderThe byte order of the source data.
SrcInterleavingThe interleaving of the source data.
Parameters
dataThe destination buffer.
num_framesThe number of frames to read and write.
Returns
True if reading was successful, false if there was not enough data to read.

Definition at line 124 of file audio_fifo_buffer.hpp.


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