#include <stdbool.h>
#include <stdint.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 |
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) |
#define PV_API __attribute__((visibility ("default"))) |
Definition at line 18 of file pvrecorder/include/pv_recorder.h.
#define PV_RECORDER_DEFAULT_DEVICE_INDEX (-1) |
Definition at line 20 of file pvrecorder/include/pv_recorder.h.
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.
enum pv_recorder_status_t |
Status codes.
Definition at line 31 of file pvrecorder/include/pv_recorder.h.
PV_API void pv_recorder_delete | ( | pv_recorder_t * | object | ) |
Destructor.
object | PV_Recorder object. |
Definition at line 162 of file porcupine/demo/c/pvrecorder/src/pv_recorder.c.
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.
count | The number of audio devices. |
devices | The array containing the list of audio devices. |
Definition at line 314 of file porcupine/demo/c/pvrecorder/src/pv_recorder.c.
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.
[out] | count | The number of audio devices. |
[out] | devices | The output array containing the list of audio devices. |
Definition at line 256 of file porcupine/demo/c/pvrecorder/src/pv_recorder.c.
const PV_API char* pv_recorder_get_selected_device | ( | pv_recorder_t * | object | ) |
Getter to get the current selected audio device name.
object | PV_Recorder object. |
Definition at line 249 of file porcupine/demo/c/pvrecorder/src/pv_recorder.c.
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.
device_index | The index of the audio device to use. A value of (-1) will resort to default device. | |
frame_length | The length of audio frame to get for each read call. | |
buffer_size_msec | Time in milliseconds to store audio frames to a temporary buffer. | |
log_overflow | Boolean variable to enable overflow logs. This will enable warning logs when buffer overflow occurs. | |
[out] | object | Audio Recorder object to initialize. |
Definition at line 51 of file porcupine/demo/c/pvrecorder/src/pv_recorder.c.
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.
object | PV_Recorder object. |
pcm[out] | An array for the frames to be copied to. |
Definition at line 213 of file porcupine/demo/c/pvrecorder/src/pv_recorder.c.
PV_API pv_recorder_status_t pv_recorder_start | ( | pv_recorder_t * | object | ) |
Starts recording audio and processing audio frames.
object | PV_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.
const PV_API char* pv_recorder_status_to_string | ( | pv_recorder_status_t | status | ) |
Provides string representations of status codes.
status | Status code. |
Definition at line 323 of file porcupine/demo/c/pvrecorder/src/pv_recorder.c.
PV_API pv_recorder_status_t pv_recorder_stop | ( | pv_recorder_t * | object | ) |
Stops recording audio.
object | PV_Recorder object. |
Definition at line 192 of file porcupine/demo/c/pvrecorder/src/pv_recorder.c.
const PV_API char* pv_recorder_version | ( | void | ) |
Getter for version.
Definition at line 343 of file porcupine/demo/c/pvrecorder/src/pv_recorder.c.