Typedefs | Enumerations | Functions
pvrecorder/include/pv_circular_buffer.h File Reference
#include <stdbool.h>
#include <stdint.h>
Include dependency graph for pvrecorder/include/pv_circular_buffer.h:

Go to the source code of this file.

Typedefs

typedef struct pv_circular_buffer pv_circular_buffer_t
 

Enumerations

enum  pv_circular_buffer_status_t {
  PV_CIRCULAR_BUFFER_STATUS_SUCCESS = 0, PV_CIRCULAR_BUFFER_STATUS_OUT_OF_MEMORY, PV_CIRCULAR_BUFFER_STATUS_INVALID_ARGUMENT, PV_CIRCULAR_BUFFER_STATUS_WRITE_OVERFLOW,
  PV_CIRCULAR_BUFFER_STATUS_SUCCESS = 0, PV_CIRCULAR_BUFFER_STATUS_OUT_OF_MEMORY, PV_CIRCULAR_BUFFER_STATUS_INVALID_ARGUMENT, PV_CIRCULAR_BUFFER_STATUS_WRITE_OVERFLOW,
  PV_CIRCULAR_BUFFER_STATUS_SUCCESS = 0, PV_CIRCULAR_BUFFER_STATUS_OUT_OF_MEMORY, PV_CIRCULAR_BUFFER_STATUS_INVALID_ARGUMENT, PV_CIRCULAR_BUFFER_STATUS_WRITE_OVERFLOW
}
 

Functions

void pv_circular_buffer_delete (pv_circular_buffer_t *object)
 
pv_circular_buffer_status_t pv_circular_buffer_init (int32_t capacity, int32_t element_size, pv_circular_buffer_t **object)
 
int32_t pv_circular_buffer_read (pv_circular_buffer_t *object, void *buffer, int32_t length)
 
void pv_circular_buffer_reset (pv_circular_buffer_t *object)
 
const char * pv_circular_buffer_status_to_string (pv_circular_buffer_status_t status)
 
pv_circular_buffer_status_t pv_circular_buffer_write (pv_circular_buffer_t *object, const void *buffer, int32_t length)
 

Typedef Documentation

◆ pv_circular_buffer_t

Forward declaration of PV_circular_buffer object. It handles reading and writing to a buffer.

Definition at line 21 of file pvrecorder/include/pv_circular_buffer.h.

Enumeration Type Documentation

◆ pv_circular_buffer_status_t

Status codes.

Enumerator
PV_CIRCULAR_BUFFER_STATUS_SUCCESS 
PV_CIRCULAR_BUFFER_STATUS_OUT_OF_MEMORY 
PV_CIRCULAR_BUFFER_STATUS_INVALID_ARGUMENT 
PV_CIRCULAR_BUFFER_STATUS_WRITE_OVERFLOW 
PV_CIRCULAR_BUFFER_STATUS_SUCCESS 
PV_CIRCULAR_BUFFER_STATUS_OUT_OF_MEMORY 
PV_CIRCULAR_BUFFER_STATUS_INVALID_ARGUMENT 
PV_CIRCULAR_BUFFER_STATUS_WRITE_OVERFLOW 
PV_CIRCULAR_BUFFER_STATUS_SUCCESS 
PV_CIRCULAR_BUFFER_STATUS_OUT_OF_MEMORY 
PV_CIRCULAR_BUFFER_STATUS_INVALID_ARGUMENT 
PV_CIRCULAR_BUFFER_STATUS_WRITE_OVERFLOW 

Definition at line 26 of file pvrecorder/include/pv_circular_buffer.h.

Function Documentation

◆ pv_circular_buffer_delete()

void pv_circular_buffer_delete ( pv_circular_buffer_t object)

Destructor for PV_circular_buffer object.

Parameters
objectCircular buffer object.

Definition at line 61 of file porcupine/demo/c/pvrecorder/src/pv_circular_buffer.c.

◆ pv_circular_buffer_init()

pv_circular_buffer_status_t pv_circular_buffer_init ( int32_t  capacity,
int32_t  element_size,
pv_circular_buffer_t **  object 
)

Constructor for PV_circular_buffer object.

Parameters
capacityCapacity of the buffer to read and write.
element_sizeSize of each element in the buffer.
object[out]Circular buffer object.
Returns
Status Code. Returns PV_CIRCULAR_BUFFER_STATUS_OUT_OF_MEMORY or PV_CIRCULAR_BUFFER_STATUS_INVALID_ARGUMENT on failure.

Definition at line 26 of file porcupine/demo/c/pvrecorder/src/pv_circular_buffer.c.

◆ pv_circular_buffer_read()

int32_t pv_circular_buffer_read ( pv_circular_buffer_t object,
void *  buffer,
int32_t  length 
)

Reads and copies the elements to the provided buffer.

Parameters
objectCircular buffer object.
buffer[out]A pointer to copy the elements into.
lengthThe amount to copy to read from the buffer. is not PV_CIRCULAR_BUFFER_STATUS_SUCCESS.
Returns
Returns the total length of frames copied to buffer.

Definition at line 68 of file porcupine/demo/c/pvrecorder/src/pv_circular_buffer.c.

◆ pv_circular_buffer_reset()

void pv_circular_buffer_reset ( pv_circular_buffer_t object)

Reset the buffer pointers to start.

Parameters
objectCircular buffer object.

Definition at line 152 of file porcupine/demo/c/pvrecorder/src/pv_circular_buffer.c.

◆ pv_circular_buffer_status_to_string()

const char* pv_circular_buffer_status_to_string ( pv_circular_buffer_status_t  status)

Provides string representations of status codes.

Parameters
statusStatus code.
Returns
String representation.

Definition at line 158 of file porcupine/demo/c/pvrecorder/src/pv_circular_buffer.c.

◆ pv_circular_buffer_write()

pv_circular_buffer_status_t pv_circular_buffer_write ( pv_circular_buffer_t object,
const void *  buffer,
int32_t  length 
)

Writes and copies the elements of param ${buffer} to the object's buffer. Overwrites existing frames if the buffer is full and returns PV_CIRCULAR_BUFFER_STATUS_WRITE_OVERFLOW which is not a failure.

Parameters
objectCircular buffer object.
bufferA pointer to copy its elements to the object's buffer.
lengthThe amount of elements to copy.
Returns
Status Code. Returns PV_CIRCULAR_BUFFER_STATUS_INVALID_ARGUMENT on failure.

Definition at line 108 of file porcupine/demo/c/pvrecorder/src/pv_circular_buffer.c.



picovoice_driver
Author(s):
autogenerated on Fri Apr 1 2022 02:15:00