Classes | Functions
pvrecorder/src/pv_circular_buffer.c File Reference
#include <stdlib.h>
#include <string.h>
#include "pv_circular_buffer.h"
Include dependency graph for pvrecorder/src/pv_circular_buffer.c:

Go to the source code of this file.

Classes

struct  pv_circular_buffer
 

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)
 

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 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 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 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 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 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 pvrecorder/src/pv_circular_buffer.c.



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