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

Go to the source code of this file.

Macros

#define PV_API   __attribute__((visibility ("default")))
 
#define PV_RECORDER_DEFAULT_DEVICE_INDEX   (-1)
 

Typedefs

typedef struct pv_recorder pv_recorder_t
 

Enumerations

enum  pv_recorder_status_t {
  PV_RECORDER_STATUS_SUCCESS = 0, PV_RECORDER_STATUS_OUT_OF_MEMORY, PV_RECORDER_STATUS_INVALID_ARGUMENT, PV_RECORDER_STATUS_INVALID_STATE,
  PV_RECORDER_STATUS_BACKEND_ERROR, PV_RECORDER_STATUS_DEVICE_ALREADY_INITIALIZED, PV_RECORDER_STATUS_DEVICE_NOT_INITIALIZED, PV_RECORDER_STATUS_IO_ERROR,
  PV_RECORDER_STATUS_RUNTIME_ERROR, PV_RECORDER_STATUS_SUCCESS = 0, PV_RECORDER_STATUS_OUT_OF_MEMORY, PV_RECORDER_STATUS_INVALID_ARGUMENT,
  PV_RECORDER_STATUS_INVALID_STATE, PV_RECORDER_STATUS_BACKEND_ERROR, PV_RECORDER_STATUS_DEVICE_ALREADY_INITIALIZED, PV_RECORDER_STATUS_DEVICE_NOT_INITIALIZED,
  PV_RECORDER_STATUS_IO_ERROR, PV_RECORDER_STATUS_RUNTIME_ERROR, PV_RECORDER_STATUS_SUCCESS = 0, PV_RECORDER_STATUS_OUT_OF_MEMORY,
  PV_RECORDER_STATUS_INVALID_ARGUMENT, PV_RECORDER_STATUS_INVALID_STATE, PV_RECORDER_STATUS_BACKEND_ERROR, PV_RECORDER_STATUS_DEVICE_ALREADY_INITIALIZED,
  PV_RECORDER_STATUS_DEVICE_NOT_INITIALIZED, PV_RECORDER_STATUS_IO_ERROR, PV_RECORDER_STATUS_RUNTIME_ERROR
}
 

Functions

PV_API void pv_recorder_delete (pv_recorder_t *object)
 
PV_API void pv_recorder_free_device_list (int32_t count, char **devices)
 
PV_API pv_recorder_status_t pv_recorder_get_audio_devices (int32_t *count, char ***devices)
 
const PV_API char * pv_recorder_get_selected_device (pv_recorder_t *object)
 
PV_API pv_recorder_status_t pv_recorder_init (int32_t device_index, int32_t frame_length, int32_t buffer_size_msec, bool log_overflow, pv_recorder_t **object)
 
PV_API pv_recorder_status_t pv_recorder_read (pv_recorder_t *object, int16_t *pcm)
 
PV_API pv_recorder_status_t pv_recorder_start (pv_recorder_t *object)
 
const PV_API char * pv_recorder_status_to_string (pv_recorder_status_t status)
 
PV_API pv_recorder_status_t pv_recorder_stop (pv_recorder_t *object)
 
const PV_API char * pv_recorder_version (void)
 

Macro Definition Documentation

◆ PV_API

#define PV_API   __attribute__((visibility ("default")))

Definition at line 18 of file pvrecorder/include/pv_recorder.h.

◆ PV_RECORDER_DEFAULT_DEVICE_INDEX

#define PV_RECORDER_DEFAULT_DEVICE_INDEX   (-1)

Definition at line 20 of file pvrecorder/include/pv_recorder.h.

Typedef Documentation

◆ pv_recorder_t

typedef struct pv_recorder pv_recorder_t

Forward declaration of PV_Recorder object. It contains everything related to recording audio, and audio frame information.

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

Enumeration Type Documentation

◆ pv_recorder_status_t

Status codes.

Enumerator
PV_RECORDER_STATUS_SUCCESS 
PV_RECORDER_STATUS_OUT_OF_MEMORY 
PV_RECORDER_STATUS_INVALID_ARGUMENT 
PV_RECORDER_STATUS_INVALID_STATE 
PV_RECORDER_STATUS_BACKEND_ERROR 
PV_RECORDER_STATUS_DEVICE_ALREADY_INITIALIZED 
PV_RECORDER_STATUS_DEVICE_NOT_INITIALIZED 
PV_RECORDER_STATUS_IO_ERROR 
PV_RECORDER_STATUS_RUNTIME_ERROR 
PV_RECORDER_STATUS_SUCCESS 
PV_RECORDER_STATUS_OUT_OF_MEMORY 
PV_RECORDER_STATUS_INVALID_ARGUMENT 
PV_RECORDER_STATUS_INVALID_STATE 
PV_RECORDER_STATUS_BACKEND_ERROR 
PV_RECORDER_STATUS_DEVICE_ALREADY_INITIALIZED 
PV_RECORDER_STATUS_DEVICE_NOT_INITIALIZED 
PV_RECORDER_STATUS_IO_ERROR 
PV_RECORDER_STATUS_RUNTIME_ERROR 
PV_RECORDER_STATUS_SUCCESS 
PV_RECORDER_STATUS_OUT_OF_MEMORY 
PV_RECORDER_STATUS_INVALID_ARGUMENT 
PV_RECORDER_STATUS_INVALID_STATE 
PV_RECORDER_STATUS_BACKEND_ERROR 
PV_RECORDER_STATUS_DEVICE_ALREADY_INITIALIZED 
PV_RECORDER_STATUS_DEVICE_NOT_INITIALIZED 
PV_RECORDER_STATUS_IO_ERROR 
PV_RECORDER_STATUS_RUNTIME_ERROR 

Definition at line 31 of file pvrecorder/include/pv_recorder.h.

Function Documentation

◆ pv_recorder_delete()

PV_API void pv_recorder_delete ( pv_recorder_t object)

Destructor.

Parameters
objectPV_Recorder object.

Definition at line 162 of file porcupine/demo/c/pvrecorder/src/pv_recorder.c.

◆ pv_recorder_free_device_list()

PV_API void pv_recorder_free_device_list ( int32_t  count,
char **  devices 
)

Frees the device list initialized by pv_recorder_get_audio_devices. The function does not do any checks, providing correct count and pointer is up to the caller.

Parameters
countThe number of audio devices.
devicesThe array containing the list of audio devices.

Definition at line 314 of file porcupine/demo/c/pvrecorder/src/pv_recorder.c.

◆ pv_recorder_get_audio_devices()

PV_API pv_recorder_status_t pv_recorder_get_audio_devices ( int32_t *  count,
char ***  devices 
)

Gets the input audio devices currently available. Each device name has a separate pointer, so the caller must free each item in the output array individually and free the output array itself. The utility function pv_recorder_free_device_list is provided to free the device list.

Parameters
[out]countThe number of audio devices.
[out]devicesThe output array containing the list of audio devices.
Returns
Status Code. Returns PV_RECORDER_STATUS_OUT_OF_MEMORY, PV_RECORDER_STATUS_BACKEND_ERROR or PV_RECORDER_STATUS_INVALID_ARGUMENT on failure.

Definition at line 256 of file porcupine/demo/c/pvrecorder/src/pv_recorder.c.

◆ pv_recorder_get_selected_device()

const PV_API char* pv_recorder_get_selected_device ( pv_recorder_t object)

Getter to get the current selected audio device name.

Parameters
objectPV_Recorder object.
Returns
A string containing the name of the device.

Definition at line 249 of file porcupine/demo/c/pvrecorder/src/pv_recorder.c.

◆ pv_recorder_init()

PV_API pv_recorder_status_t pv_recorder_init ( int32_t  device_index,
int32_t  frame_length,
int32_t  buffer_size_msec,
bool  log_overflow,
pv_recorder_t **  object 
)

Constructor for Picovoice Audio Recorder.

Parameters
device_indexThe index of the audio device to use. A value of (-1) will resort to default device.
frame_lengthThe length of audio frame to get for each read call.
buffer_size_msecTime in milliseconds to store audio frames to a temporary buffer.
log_overflowBoolean variable to enable overflow logs. This will enable warning logs when buffer overflow occurs.
[out]objectAudio Recorder object to initialize.
Returns
Status Code. PV_RECORDER_STATUS_INVALID_ARGUMENT, PV_RECORDER_STATUS_BACKEND_ERROR, PV_RECORDER_STATUS_DEVICE_INITIALIZED or PV_RECORDER_STATUS_OUT_OF_MEMORY on failure.

Definition at line 51 of file porcupine/demo/c/pvrecorder/src/pv_recorder.c.

◆ pv_recorder_read()

PV_API pv_recorder_status_t pv_recorder_read ( pv_recorder_t object,
int16_t *  pcm 
)

Synchronous call to read frames. Copies param ${length} amount of frames to param ${pcm} array provided to input.

Parameters
objectPV_Recorder object.
pcm[out]An array for the frames to be copied to.
Returns
Status Code. Returns PV_RECORDER_STATUS_INVALID_ARGUMENT, PV_RECORDER_INVALID_STATE or PV_RECORDER_IO_ERROR on failure. Returns PV_RECORDER_STATUS_BUFFER_OVERFLOW if audio frames aren't being read fast enough. This means old audio frames are being replaced by new audio frames.

Definition at line 213 of file porcupine/demo/c/pvrecorder/src/pv_recorder.c.

◆ pv_recorder_start()

PV_API pv_recorder_status_t pv_recorder_start ( pv_recorder_t object)

Starts recording audio and processing audio frames.

Parameters
objectPV_Recorder object. @returnStatus Status Code. Returns PV_RECORDER_STATUS_INVALID_ARGUMENT, PV_RECORDER_STATUS_DEVICE_NOT_INITIALIZED or PV_RECORDER_STATUS_INVALID_STATE on failure.

Definition at line 172 of file porcupine/demo/c/pvrecorder/src/pv_recorder.c.

◆ pv_recorder_status_to_string()

const PV_API char* pv_recorder_status_to_string ( pv_recorder_status_t  status)

Provides string representations of status codes.

Parameters
statusStatus code.
Returns
String representation.

Definition at line 323 of file porcupine/demo/c/pvrecorder/src/pv_recorder.c.

◆ pv_recorder_stop()

PV_API pv_recorder_status_t pv_recorder_stop ( pv_recorder_t object)

Stops recording audio.

Parameters
objectPV_Recorder object.
Returns
Status Code. Returns PV_RECORDER_STATUS_INVALID_ARGUMENT, PV_RECORDER_STATUS_DEVICE_NOT_INITIALIZED or PV_RECORDER_STATUS_INVALID_STATE on failure.

Definition at line 192 of file porcupine/demo/c/pvrecorder/src/pv_recorder.c.

◆ pv_recorder_version()

const PV_API char* pv_recorder_version ( void  )

Getter for version.

Returns
Version.

Definition at line 343 of file porcupine/demo/c/pvrecorder/src/pv_recorder.c.



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