OpenTok C SDK
|
Audio device. More...
Go to the source code of this file.
Data Structures | |
struct | otc_audio_device_settings |
struct | otc_audio_device_callbacks |
Typedefs | |
typedef struct otc_audio_device | otc_audio_device |
Functions | |
size_t | otc_audio_device_read_render_data (int16_t *buffer, size_t number_of_samples) |
otc_status | otc_audio_device_write_capture_data (const int16_t *buffer, size_t number_of_samples) |
otc_status | otc_set_audio_device (const struct otc_audio_device_callbacks *callbacks) |
otc_status | otc_audio_device_restart_input () |
otc_status | otc_audio_device_restart_output () |
Audio device.
This file includes the type definition for an audio device, along with structures and functions you use with it.
Use an audio device to define a custom audio capturer for all publishers and a custom audio renderer for all publishers and subscribers. If you do not use a custom audio device, the application will use the default audio device using the system microphone and speaker.
A custom audio is used for any publisher and subscriber in any session the client connects to. Once the audio device is set it acts globally. The capturing and rendering bits in the audio device being set are used for rendering and capturing audio for all participants in the session. You cannot set an audio device for a given publisher or subscriber alone.
Instantiate an otc_audio_device_callbacks structure, setting callback functions for events related to the audio device. Then call otc_set_audio_device(const struct otc_audio_device_callbacks callbacks) to associate the callbacks with the audio device to be used. You must call this function before you connect to a session. Additionally, this is a global operation that must persist throughout the lifetime of an application.
Call the otc_audio_device_read_render_data function to retrieve unrendered audio samples.
Call the otc_audio_device_write_capture_data function to write audio samples that will be included in streams you publish.
typedef struct otc_audio_device otc_audio_device |
Audio device type definition.
size_t otc_audio_device_read_render_data | ( | int16_t * | buffer, |
size_t | number_of_samples | ||
) |
Retrieves unrendered audio samples from the session. These samples are mixed from the streams in the session you have subscribed to.
buffer | The buffer containing audio data. |
number_of_samples | The number of samples requested. |
otc_status otc_audio_device_restart_input | ( | ) |
Restarts audio input device. This method must be called whenever a change in input device happens in the custom audio device to let the SDK perform the necessary corrections for the new device. Also this will trigger the following otc_audio_device_callbacks methods in order:
otc_status otc_audio_device_restart_output | ( | ) |
Restarts audio output device. This method must be called whenever a change in output device happens in the custom audio device to let the SDK perform the necessary corrections for the new device. Also this will trigger the following otc_audio_device_callbacks methods in order:
otc_status otc_audio_device_write_capture_data | ( | const int16_t * | buffer, |
size_t | number_of_samples | ||
) |
Passes in audio data from the audio device to transmit to a session. This audio data is used by streams you publish to the session.
buffer | The buffer containing audio data. |
number_of_samples | The number of samples available for copying. |
otc_status otc_set_audio_device | ( | const struct otc_audio_device_callbacks * | callbacks | ) |
Sets the audio device to be used. You must call this function before you connect to a session. Additionally, this is a global operation that must persist throughout the lifetime of a session.
callbacks | A pointer to a audio device function callback struct. |