cbufferf

Variants: cbuffercf, cbufferf

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(unsigned int _max_size)
cbufferf cbufferf_create_max(unsigned int _max_size, unsigned int _max_read)
cbufferf cbufferf_copy(cbufferf _q)
int cbufferf_destroy(cbufferf _q)
int cbufferf_print(cbufferf _q)
int cbufferf_reset(cbufferf _q)
unsigned int cbufferf_size(cbufferf _q)
unsigned int cbufferf_max_size(cbufferf _q)
unsigned int cbufferf_max_read(cbufferf _q)
unsigned int cbufferf_space_available(cbufferf _q)
int cbufferf_is_empty(cbufferf _q)
int cbufferf_is_full(cbufferf _q)
int cbufferf_push(cbufferf _q, float _v)
int cbufferf_write(cbufferf _q, float * _v, unsigned int _n)
int cbufferf_pop(cbufferf _q, float * _v)
int cbufferf_read(cbufferf _q, unsigned int _num_requested, float ** _v, unsigned int * _num_read)
int cbufferf_release(cbufferf _q, unsigned int _n)

Interfaces

cbufferf cbufferf_create(unsigned int _max_size)

Create circular buffer object of a particular maximum storage length

  • _max_size : maximum buffer size, 0 < _max_size

cbufferf cbufferf_create_max(unsigned int _max_size, unsigned int _max_read)

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(cbufferf _q)

Copy object including all internal objects and state

int cbufferf_destroy(cbufferf _q)

Destroy cbuffer object, freeing all internal memory

int cbufferf_print(cbufferf _q)

Print cbuffer object properties to stdout

int cbufferf_reset(cbufferf _q)

Clear internal buffer

unsigned int cbufferf_size(cbufferf _q)

Get the number of elements currently in the buffer

unsigned int cbufferf_max_size(cbufferf _q)

Get the maximum number of elements the buffer can hold

unsigned int cbufferf_max_read(cbufferf _q)

Get the maximum number of elements you may read at once

unsigned int cbufferf_space_available(cbufferf _q)

Get the number of available slots (max_size - size)

int cbufferf_is_empty(cbufferf _q)

Return flag indicating if the buffer is empty or not

int cbufferf_is_full(cbufferf _q)

Return flag indicating if the buffer is full or not

int cbufferf_push(cbufferf _q, float _v)

Write a single sample into the buffer

  • _q : circular buffer object
  • _v : input sample

int cbufferf_write(cbufferf _q, float * _v, unsigned int _n)

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(cbufferf _q, float * _v)

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(cbufferf _q, unsigned int _num_requested, float ** _v, unsigned int * _num_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(cbufferf _q, unsigned int _n)

Release _n samples from the buffer

  • _q : circular buffer object
  • _n : number of elements to release