Circular buffer object for storing and retrieving samples in a first-in/first-out (FIFO) manner using a minimal amount of memory
Public Functions
cbufferf | cbufferf_create( |
cbufferf | cbufferf_create_max( |
cbufferf | cbufferf_copy( |
int | cbufferf_destroy( |
int | cbufferf_print( |
int | cbufferf_reset( |
unsigned int | cbufferf_size( |
unsigned int | cbufferf_max_size( |
unsigned int | cbufferf_max_read( |
unsigned int | cbufferf_space_available( |
int | cbufferf_is_empty( |
int | cbufferf_is_full( |
int | cbufferf_push( |
int | cbufferf_write( |
int | cbufferf_pop( |
int | cbufferf_read( |
int | cbufferf_release( |
Interfaces
cbufferf cbufferf_create(
Create circular buffer object of a particular maximum storage length
- _max_size : maximum buffer size, 0 < _max_size
cbufferf cbufferf_create_max(
Create circular buffer object of a particular maximum storage size and specify the maximum number of elements that can be read at any any given time
- _max_size : maximum buffer size, 0 < _max_size
- _max_read : maximum size that will be read from buffer
cbufferf cbufferf_copy(
Copy object including all internal objects and state
int cbufferf_destroy(
Destroy cbuffer object, freeing all internal memory
int cbufferf_print(
Print cbuffer object properties to stdout
int cbufferf_reset(
Clear internal buffer
unsigned int cbufferf_size(
Get the number of elements currently in the buffer
unsigned int cbufferf_max_size(
Get the maximum number of elements the buffer can hold
unsigned int cbufferf_max_read(
Get the maximum number of elements you may read at once
unsigned int cbufferf_space_available(
Get the number of available slots (max_size - size)
int cbufferf_is_empty(
Return flag indicating if the buffer is empty or not
int cbufferf_is_full(
Return flag indicating if the buffer is full or not
int cbufferf_push(
Write a single sample into the buffer
- _q : circular buffer object
- _v : input sample
int cbufferf_write(
Write a block of samples to the buffer
- _q : circular buffer object
- _v : array of samples to write to buffer
- _n : number of samples to write
int cbufferf_pop(
Remove and return a single element from the buffer by setting the value of the output sample pointed to by _v
- _q : circular buffer object
- _v : pointer to sample output
int cbufferf_read(
Read buffer contents by returning a pointer to the linearized array; note that the returned pointer is only valid until another operation is performed on the circular buffer object
- _q : circular buffer object
- _num_requested : number of elements requested
- _v : output pointer
- _num_read : number of elements referenced by _v
int cbufferf_release(
Release _n samples from the buffer
- _q : circular buffer object
- _n : number of elements to release