Buffers¶
rtff::AudioBuffer
- class
AudioBuffer¶a fixed size buffer of raw audio signal data
Public Functions
AudioBuffer(uint32_t frame_count, uint8_t channel_count)¶Constructor.
- Parameters
frame_count: the number of samples of each channelchannel_count: the number of channels
- void
fromInterleaved(const float *data)¶fill the buffer with interleaved data
- Parameters
data: the raw audio data
- void
toInterleaved(float *data) const¶fill interleaved audio data with the content of the buffer
- Parameters
data: the interleaved audio data
- float *
data(uint8_t channel_idx)¶
- Return
- the pointer to deinterleaved audio data
- Parameters
channel_idx: the channel index
- const float *
data(uint8_t channel_idx) const¶
- Return
- the pointer to deinterleaved audio data
- Parameters
channel_idx: the channel index
- uint32_t
frame_count() const¶
- Return
- the number of samples contained in each channel
- uint8_t
channel_count() const¶
- Return
- the number of channels
rtff::Buffer
- template <typename T>
classBuffer¶A multichannel data storage class.
Public Functions
- void
Init(uint32_t frame_count, uint8_t channel_count)¶Initialize and allocate memory.
- Parameters
frame_count: the number of samples of each channelchannel_count: the number of channels
- Vector &
channel(uint8_t channel_idx)¶
- Return
- a reference to the raw data stored in a vector
- Parameters
channel_idx: the channel index
- uint8_t
channel_count() const¶
- Return
- the number of channels
- std::vector<T *>
data_ptr()¶
- Return
- a vector of pointers giving access to raw data
- uint32_t
size() const¶
- Return
- the number of samples contained in each channel
rtff::OverlapRingBuffer
- class
OverlapRingBuffer¶OverlapRingBuffer represents a Ring buffer with an overlap concept at read time.
- Note
- after reading N samples of indexes [1, 2 … N], the read index will be moved by a step size M that may be different to N (the read size) So the next read samples will be [M, M+1, … N, …, N + M]
Public Functions
OverlapRingBuffer(uint32_t read_size, uint32_t step_size)¶Constructor.
- Parameters
read_size: the number of frames read when calling the Read functionstep_size: the number of frames to remove from the buffer after a call to the Read function
- void
InitWithZeros(uint32_t count)¶fill the buffer with count zeros
- Parameters
count: the number of zeros to add into the buffer
- void
Write(const float *data, uint32_t frame_count)¶write data to the buffer
- Parameters
data: pointer to the dataframe_count: the number of samples available in the data array
- bool
Read(float *data)¶read data from the buffer and remove step_size data
- Return
- true is read was successful
- Parameters
data: a pre-allocated array of size read_size
rtff::MultichannelOverlapRingBuffer
- class
MultichannelOverlapRingBuffer¶A multichannel wrapper around the OverlapRingBuffer.
Public Functions
MultichannelOverlapRingBuffer(uint32_t read_size, uint32_t step_size, uint8_t channel_count)¶Constructor.
- Parameters
read_size: the number of frames read when calling the Read functionstep_size: the number of frames to remove from the buffer after a call to the Read functionchannel_count: the number of channels of the original signal
- void
InitWithZeros(uint32_t frame_number)¶fill the buffer with count zeros
- Parameters
frame_number: the number of zeros to add into the buffer
- OverlapRingBuffer &
operator[](uint8_t channel_idx)¶
- Return
- the OverlapRingBuffer at a given channel
- Parameters
channel_idx: the index of the channel to access
- const OverlapRingBuffer &
operator[](uint8_t channel_idx) const¶
- Return
- the OverlapRingBuffer at a given channel
- Parameters
channel_idx: the index of the channel to access
- void
Write(const AudioBuffer &buffer, uint32_t frame_count)¶write data to the buffer
- Parameters
buffer: the AudioBuffer to writeframe_count: the number of samples available in the buffer
- bool
Read(AudioBuffer *buffer)¶read data from the buffer and remove step_size data
- Return
- true is read was successful
- Parameters
buffer: a pre-allocated AudioBuffer of size read_size
- void
Write(const Buffer<float> &buffer, uint32_t frame_count)¶write data to the buffer
- Parameters
buffer: the Buffer<float> to writeframe_count: the number of samples available in the buffer
- bool
Read(Buffer<float> *buffer)¶read data from the buffer and remove step_size data
- Return
- true is read was successful
- Parameters
buffer: a pre-allocated Buffer<float> of size read_size
rtff::RingBuffer
- class
RingBuffer¶RingBuffer represent a circular buffer. It is used to store enough data before starting a process without having to allocate memory dynamically.
Public Functions
RingBuffer(uint32_t container_size)¶Constructor.
- Parameters
container_size: the maximum number of data a user can write without reading
- void
InitWithZeros(uint32_t count)¶fill the buffer with count zeros
- Parameters
count: the number of zeros to add into the buffer
- void
Write(const float *data, uint32_t frame_count)¶write data to the buffer
- Parameters
data: pointer to the dataframe_count: the number of samples available in the data array
- bool
Read(float *data, uint32_t frame_count)¶read data from the buffer and remove frame_count data
- Return
- true is read was successful
- Parameters
data: a pre-allocated array of size frame_countframe_count: the number of frames to read
rtff::MultichannelRingBuffer
- class
MultichannelRingBuffer¶A multichannel wrapper around the RingBuffer.
Public Functions
MultichannelRingBuffer(uint32_t container_size, uint8_t channel_count)¶Constructor.
- Parameters
container_size: the maximum number of data a user can write without readingchannel_count: the number of channel of the original signal
- void
InitWithZeros(uint32_t frame_number)¶fill the buffer with count zeros
- Parameters
frame_number: the number of zeros to add into the buffer
- RingBuffer &
operator[](uint8_t channel_idx)¶
- Return
- the RingBuffer at a given channel
- Parameters
channel_idx: the index of the channel to access
- const RingBuffer &
operator[](uint8_t channel_idx) const¶
- Return
- the RingBuffer at a given channel
- Parameters
channel_idx: the index of the channel to access
- void
Write(const AudioBuffer &buffer, uint32_t frame_count)¶write data to the buffer
- Parameters
buffer: the AudioBuffer to writeframe_count: the number of samples available in the buffer
- bool
Read(AudioBuffer *buffer, uint32_t frame_count)¶read data from the buffer and remove frame_count data
- Return
- true is read was successful
- Parameters
buffer: a pre-allocated AudioBuffer of size frame_countframe_count: the number of frames to read
- void
Write(const Buffer<float> &buffer, uint32_t frame_count)¶write data to the buffer
- Parameters
buffer: the Buffer<float> to writeframe_count: the number of samples available in the buffer
- bool
Read(Buffer<float> *buffer, uint32_t frame_count)¶read data from the buffer and remove frame_count data
- Return
- true is read was successful
- Parameters
buffer: a pre-allocated Buffer<float> of size frame_countframe_count: the number of frames to read