Ring Buffer Binding
The ring buffer binding implements a ring buffer as a binding component, designed to control flow between two domains, for example a hardware interface and a synchronous processing pipeline.
Samples are pushed to the input of the buffer, when the number samples needed by the output is available, it will copy the amount to an output buffer and push that to the downstream component. In the FC implementation, the push happens in an event, allowing the buffer to continously receive data while the downstream nodes are being processed.
Parameters
Input and output token size (AKA blocksize/framesize) is defined by the input and output buffer bound to the buffer.
The internal memory is (by default) limited to MAX_RING_BUFFER_SIZE
and MAX_RING_BUFFER_CHANNELS
set in ring_int.h
/ gap9_fc_ring_int.h
. However, this can be modified via the static parameters
struct on construct:
typedef struct ring_static_parameters
{
int32_t max_nb_channels;
int32_t max_nb_samples_per_channel;
} ring_static_parameters;
Status
The binding implements a number of status flags to query for useful information
- error
Default
gwt_audio_errors
message- is_full
True if buffer is full
- is_empty
True if buffer is empty
- overflow_cnt
Counter that increments in case of overflow (data pushed to buffer, which cannot fit). This indicates data loss.
- underflow_cnt
Currently not implemented - Ring should not be able to push if data is not present
Interface
- Input channels
The ring buffer supports multiple input channels, allowing you to input stereo or multichannel audio streams. TODO: Data is currently expected to be float. Should be able to support int32_t also.
- Output channel
The ring buffer supports multiple output channels. TODO: Data is currently expected to be float. Should be able to support int32_t also.
Implementations
Implementations are available on FC and as a C model.
Tests
nonreg.py
implements a tests for both model and FC implementation.