#include <audio_device.h>

Data Fields
otc_bool(* init )(const otc_audio_device *audio_device, void *user_data)
otc_bool(* destroy )(const otc_audio_device *audio_device, void *user_data)
otc_bool(* init_capturer )(const otc_audio_device *audio_device, void *user_data)
otc_bool(* destroy_capturer )(const otc_audio_device *audio_device, void *user_data)
otc_bool(* start_capturer )(const otc_audio_device *audio_device, void *user_data)
otc_bool(* stop_capturer )(const otc_audio_device *audio_device, void *user_data)
otc_bool(* is_capturer_initialized )(const otc_audio_device *audio_device, void *user_data)
otc_bool(* is_capturer_started )(const otc_audio_device *audio_device, void *user_data)
int(* get_estimated_capture_delay )(const otc_audio_device *audio_device, void *user_data)
otc_bool(* get_capture_settings )(const otc_audio_device *audio_device, void *user_data, struct otc_audio_device_settings *settings)
otc_bool(* init_renderer )(const otc_audio_device *audio_device, void *user_data)
otc_bool(* destroy_renderer )(const otc_audio_device *audio_device, void *user_data)
otc_bool(* start_renderer )(const otc_audio_device *audio_device, void *user_data)
otc_bool(* stop_renderer )(const otc_audio_device *audio_device, void *user_data)
otc_bool(* is_renderer_initialized )(const otc_audio_device *audio_device, void *user_data)
otc_bool(* is_renderer_started )(const otc_audio_device *audio_device, void *user_data)
int(* get_estimated_render_delay )(const otc_audio_device *audio_device, void *user_data)
otc_bool(* get_render_settings )(const otc_audio_device *audio_device, void *user_data, struct otc_audio_device_settings *settings)
void * user_data
void * reserved

Detailed Description

This structure includes a set of function pointers to callback functions to use with an audio device. The SDK calls these functions when events related to the audio device occur.

All callbacks will not be made on the application or main thread but on an internal thread. The application should return the callback as quickly as possible to avoid blocking the internal thread.

In addition to the callbacks, the struct includes a user_data pointer, which points data you can set related to the audio device.

Field Documentation

destroy

otc_bool(* destroy) (const otc_audio_device *audio_device, void *user_data)

Called when the SDK requests the audio device to be destroyed.

Parameters : | | | | --- | --- | | audio_device | A pointer to the audio device instance. | | user_data | A pointer to the user_data you set for the audio device. |

Returns : Boolean value indicating either error or success.

See also : otc_bool

destroy_capturer

otc_bool(* destroy_capturer) (const otc_audio_device *audio_device, void *user_data)

Called when the SDK is done capturing audio and it is time to destroy the audio capturer for the audio device.

Parameters : | | | | --- | --- | | audio_device | A pointer to the audio device instance. | | user_data | A pointer to the user_data you set for the audio device. |

Returns : Boolean value indicating either error or success.

See also : otc_bool

destroy_renderer

otc_bool(* destroy_renderer) (const otc_audio_device *audio_device, void *user_data)

Called when the SDK is done rendering audio and it is time to destroy the audio renderer for the audio device.

Parameters : | | | | --- | --- | | audio_device | A pointer to the audio device instance. | | user_data | A pointer to the user_data you set for the audio device. |

Returns : Boolean value indicating either error or success.

See also : otc_bool

get_capture_settings

otc_bool(* get_capture_settings) (const otc_audio_device *audio_device, void *user_data, struct otc_audio_device_settings *settings)

Called when the SDK requests the audio capture settings used by the audio device.

Parameters : | | | | --- | --- | | audio_device | A pointer to the audio device instance. | | user_data | A pointer to the user_data you set for the audio device. | | settings | A pointer to a struct holding the settings. |

Returns : Boolean value indicating either error or success.

See also : otc_bool

get_estimated_capture_delay

int(* get_estimated_capture_delay) (const otc_audio_device *audio_device, void *user_data)

Called when the SDK requests the estimated capturing delay for the audio device, in ms.

Parameters : | | | | --- | --- | | audio_device | A pointer to the audio device instance. | | user_data | A pointer to the user_data you set for the audio device. |

Returns : The estimated capturing delay in ms.

get_estimated_render_delay

int(* get_estimated_render_delay) (const otc_audio_device *audio_device, void *user_data)

Called when the SDK requests the estimated rendering delay for the audio device, in ms.

Parameters : | | | | --- | --- | | audio_device | A pointer to the audio device instance. | | user_data | A pointer to the user_data you set for the audio device. |

Returns : The estimated rendering delay in ms.

get_render_settings

otc_bool(* get_render_settings) (const otc_audio_device *audio_device, void *user_data, struct otc_audio_device_settings *settings)

Called when the SDK requests the audio rendering settings used by the device.

Parameters : | | | | --- | --- | | audio_device | A pointer to the audio device instance. | | user_data | A pointer to the user_data you set for the audio device. | | settings | A pointer to a struct holding the settings. |

Returns : Boolean value indicating either error or success.

See also : otc_bool

init

otc_bool(* init) (const otc_audio_device *audio_device, void *user_data)

Called when the SDK requests the audio device to initialize itself.

Parameters : | | | | --- | --- | | audio_device | A pointer to the audio device instance. | | user_data | A pointer to the user_data you set for the audio device. |

Returns : Boolean value indicating either error or success.

See also : otc_bool

init_capturer

otc_bool(* init_capturer) (const otc_audio_device *audio_device, void *user_data)

Called when the SDK requests the audio capturer for the audio device to be initialized.

Parameters : | | | | --- | --- | | audio_device | A pointer to the audio device instance. | | user_data | A pointer to the user_data you set for the audio device. |

Returns : Boolean value indicating either error or success.

See also : otc_bool

init_renderer

otc_bool(* init_renderer) (const otc_audio_device *audio_device, void *user_data)

Called when the SDK requests the audio device to initialize itself for audio rendering.

Parameters : | | | | --- | --- | | audio_device | A pointer to the audio device instance. | | user_data | A pointer to the user_data you set for the audio device. |

Returns : Boolean value indicating either error or success.

See also : otc_bool

is_capturer_initialized

otc_bool(* is_capturer_initialized) (const otc_audio_device *audio_device, void *user_data)

Whether the device has initialized itself for audio sampling.

Parameters : | | | | --- | --- | | audio_device | A pointer to the audio device instance. | | user_data | A pointer to the user_data you set for the audio device. |

Returns : Boolean value indicating whether the device is initialized or not.

See also : otc_bool

is_capturer_started

otc_bool(* is_capturer_started) (const otc_audio_device *audio_device, void *user_data)

Whether the device has started audio sampling.

Parameters : | | | | --- | --- | | audio_device | A pointer to the audio device instance. | | user_data | A pointer to the user_data you set for the audio device. |

Returns : Boolean value indicating whether it is started or not.

See also : otc_bool

is_renderer_initialized

otc_bool(* is_renderer_initialized) (const otc_audio_device *audio_device, void *user_data)

Whether the device has been initialized for audio rendering.

Parameters : | | | | --- | --- | | audio_device | A pointer to the audio device instance. | | user_data | A pointer to the user_data you set for the audio device. |

Returns : Boolean value indicating whether it is initialized or not.

See also : otc_bool

is_renderer_started

otc_bool(* is_renderer_started) (const otc_audio_device *audio_device, void *user_data)

Whether the device started audio rendering.

Parameters : | | | | --- | --- | | audio_device | A pointer to the audio device instance. | | user_data | A pointer to the user_data you set for the audio device. |

Returns : Boolean value indicating whether it is started or not.

See also : otc_bool

reserved

void* reserved

A void pointer to a memory area holding reserved resources used for the internal implementation.

start_capturer

otc_bool(* start_capturer) (const otc_audio_device *audio_device, void *user_data)

Called when the SDK requests the audio device to start capturing audio samples.

Parameters : | | | | --- | --- | | audio_device | A pointer to the audio device instance. | | user_data | A pointer to the user_data you set for the audio device. |

Returns : Boolean value indicating either error or success.

See also : otc_bool

start_renderer

otc_bool(* start_renderer) (const otc_audio_device *audio_device, void *user_data)

Called when the SDK requests the audio device to start rendering audio.

Parameters : | | | | --- | --- | | audio_device | A pointer to the audio device instance. | | user_data | A pointer to the user_data you set for the audio device. |

Returns : Boolean value indicating either error or success.

See also : otc_bool

stop_capturer

otc_bool(* stop_capturer) (const otc_audio_device *audio_device, void *user_data)

Called when the SDK requests the audio capturer for the audio device to stop sampling audio.

Parameters : | | | | --- | --- | | audio_device | A pointer to the audio device instance. | | user_data | A pointer to the user_data you set for the audio device. |

Returns : Boolean value indicating either error or success.

See also : otc_bool

stop_renderer

otc_bool(* stop_renderer) (const otc_audio_device *audio_device, void *user_data)

Called when the SDK requests the audio device to stop rendering audio.

Parameters : | | | | --- | --- | | audio_device | A pointer to the audio device instance. | | user_data | A pointer to the user_data you set for the audio device. |

Returns : Boolean value indicating either error or success.

See also : otc_bool

user_data

void* user_data

A pointer to data you set related to the audio device.