Documentation

Support

Vivox Core SDK

Vivox Core SDK

Read and alter audio data for each participant

Managing individual participant audio data.
Read time 1 minuteLast updated 20 hours ago

The
pf_on_audio_unit_before_recv_audio_mixed
callback provides a parameter with type
vx_before_recv_audio_mixed_participant_data_t *
called
participants_data
. An example of how to use this pointer to access an array of separate participants’ audio data is shown in the code sample below.
void SDKSampleApp::OnBeforeReceivedAudioMixed(const char *session_group_handle, const char *initial_target_uri, vx_before_recv_audio_mixed_participant_data_t *participants_data, size_t num_participants){ std::string example_uri = “example_uri”; // Iterate over the multiple audio streams for (unsigned int i = 0; i < num_participants; i++) { auto &data = participants_data[i]; int channels_per_frame = data.channels_per_frame; std::string participant_uri = data.participant_uri; if (participant_uri == example_uri) { for (unsigned int f = 0; f < data.pcm_frame_count; f++) { for (unsigned int c = 0; c < channels_per_frame; c++) { // Use / modify the audio data. Here we're simply dividing the samples by 2. data.pcm_frames[(f * channels_per_frame) + c] /= 2; } } } }}