PvRecorder
C API
API Reference for the PvRecorder C SDK.
pv_recorder_t
Struct representing the PvRecorder object.
pv_recorder_init()
Creates a PvRecorder instance. When finished with the instance, resources should be cleaned up using the pv_recorder_delete()
function.
Parameters
frame_length
int32_t : The length of audio frame to get for each read call.device_index
int32_t : The index of the audio device to use. A value of (-1) will resort to default device.buffered_frames_count
int32_t : The number of audio frames buffered internally for reading - i.e. internal circular buffer will be of sizeframe_length
*buffered_frames_count
. If this value is too low, buffer overflows could occur and audio frames could be dropped. A higher value will increase memory usage.object
pv_recorder_t * * : PvRecorder object to be initialized.
Returns
- pv_recorder_status_t : Returned status code.
pv_recorder_delete()
Releases resources acquired by PvRecorder.
Parameters
object
pv_recorder_t * : PvRecorder object.
pv_recorder_start()
Starts recording and buffering audio frames.
Parameters
object
pv_recorder_t * : PvRecorder object.
Returns
- pv_recorder_status_t : Returned status code.
pv_recorder_stop()
Stops recording audio.
Parameters
object
pv_recorder_t * : PvRecorder object.
Returns
- pv_recorder_status_t : Returned status code.
pv_recorder_read()
Synchronous call to read frames. Copies amount of frames to frame
array provided to input. Array size must match the frame_length
value that was given to pv_recorder_init()
.
Parameters
object
pv_recorder_t * : PvRecorder object.frame
int16_t * : An array for the audio frame to be copied to.
Returns
- pv_recorder_status_t : Returned status code.
pv_recorder_set_debug_logging()
Enable or disable debug logging for PvRecorder. Debug logs will indicate when there are overflows in the internal frame buffer and when an audio source is generating frames of silence.
Parameters
object
pv_recorder_t * : PvRecorder object.is_debug_logging_enabled
bool : Boolean indicating whether the debug logging is enabled or disabled.
pv_recorder_get_is_recording()
Gets whether the given instance of pv_recorder_t
is currently capturing audio or not.
Parameters
object
pv_recorder_t * : PvRecorder object.
Returns
- bool : A boolean indicating whether the object is recording or not.
pv_recorder_get_selected_device()
Gets the audio device that the given pv_recorder_t
instance is using.
Parameters
object
pv_recorder_t * : PvRecorder object.
Returns
- const char * : A string containing the name of the device.
pv_recorder_get_available_devices()
Gets the list of available audio devices that can be used for recording. Free the returned device_list
array using pv_recorder_free_available_devices()
.
Parameters
device_list_length
int32_t * : The number of available audio devices.device_list
char * * * : The output array containing the list of available audio devices.
Returns
- pv_recorder_status_t : Returned status code.
pv_recorder_free_available_devices()
Frees the device list initialized by pv_recorder_get_available_devices()
.
Parameters
device_list_length
int32_t : The number of audio devices.device_list
char * * : The array containing the list of audio devices.
pv_recorder_status_to_string()
Provides string representations of the given status code.
Parameters
status
pv_recorder_status_t : Status code.
Returns
- const char * : String representation of the status code.
pv_recorder_sample_rate()
Gets the audio sample rate used by PvRecorder.
Returns
- int32_t : Sample rate.
pv_recorder_version()
Getter for the PvRecorder version.
Returns
- const char * : Version string.
pv_recorder_status_t
Status code enum.