Classes

struct  AudioFrame
 

Public Types

enum  AUDIO_FRAME_TYPE { FRAME_TYPE_PCM16 = 0 }
 

Public Member Functions

virtual bool onRecordAudioFrame (AudioFrame &audioFrame)=0
 
virtual bool onPlaybackAudioFrame (AudioFrame &audioFrame)=0
 
virtual bool onMixedAudioFrame (AudioFrame &audioFrame)=0
 
virtual bool onPlaybackAudioFrameBeforeMixing (unsigned int uid, AudioFrame &audioFrame)=0
 
virtual bool isMultipleChannelFrameWanted ()
 
virtual bool onPlaybackAudioFrameBeforeMixingEx (const char *channelId, unsigned int uid, AudioFrame &audioFrame)
 

Detailed Description

Member Enumeration Documentation

◆ AUDIO_FRAME_TYPE

The frame type.

Enumerator
FRAME_TYPE_PCM16 

0: PCM16.

Member Function Documentation

◆ onRecordAudioFrame()

virtual bool agora::media::IAudioFrameObserver::onRecordAudioFrame ( AudioFrame audioFrame)
pure virtual

Retrieves the recorded audio frame.

Parameters
audioFramePointer to AudioFrame.
Returns
  • true: Valid buffer in AudioFrame, and the recorded audio frame is sent out.
  • false: Invalid buffer in AudioFrame, and the recorded audio frame is discarded.

◆ onPlaybackAudioFrame()

virtual bool agora::media::IAudioFrameObserver::onPlaybackAudioFrame ( AudioFrame audioFrame)
pure virtual

Retrieves the audio playback frame for getting the audio.

Parameters
audioFramePointer to AudioFrame.
Returns
  • true: Valid buffer in AudioFrame, and the audio playback frame is sent out.
  • false: Invalid buffer in AudioFrame, and the audio playback frame is discarded.

◆ onMixedAudioFrame()

virtual bool agora::media::IAudioFrameObserver::onMixedAudioFrame ( AudioFrame audioFrame)
pure virtual

Retrieves the mixed recorded and playback audio frame.

Note
This callback only returns the single-channel data.
Parameters
audioFramePointer to AudioFrame.
Returns
  • true: Valid buffer in AudioFrame and the mixed recorded and playback audio frame is sent out.
  • false: Invalid buffer in AudioFrame and the mixed recorded and playback audio frame is discarded.

◆ onPlaybackAudioFrameBeforeMixing()

virtual bool agora::media::IAudioFrameObserver::onPlaybackAudioFrameBeforeMixing ( unsigned int  uid,
AudioFrame audioFrame 
)
pure virtual

Retrieves the audio frame of a specified user before mixing.

The SDK triggers this callback if isMultipleChannelFrameWanted returns false.

Parameters
uidThe user ID
audioFramePointer to AudioFrame.
Returns
  • true: Valid buffer in AudioFrame, and the mixed recorded and playback audio frame is sent out.
  • false: Invalid buffer in AudioFrame, and the mixed recorded and playback audio frame is discarded.

◆ isMultipleChannelFrameWanted()

virtual bool agora::media::IAudioFrameObserver::isMultipleChannelFrameWanted ( )
inlinevirtual

Determines whether to receive audio data from multiple channels.

Since
v3.0.1

After you register the audio frame observer, the SDK triggers this callback every time it captures an audio frame.

In the multi-channel scenario, if you want to get audio data from multiple channels, set the return value of this callback as true. After that, the SDK triggers the onPlaybackAudioFrameBeforeMixingEx callback to send you the before-mixing audio data from various channels. You can also get the channel ID of each audio frame.

Note
  • Once you set the return value of this callback as true, the SDK triggers only the onPlaybackAudioFrameBeforeMixingEx callback to send the before-mixing audio frame. onPlaybackAudioFrameBeforeMixing is not triggered. In the multi-channel scenario, Agora recommends setting the return value as true.
  • If you set the return value of this callback as false, the SDK triggers only the onPlaybackAudioFrameBeforeMixing callback to send the audio data.
Returns
  • true: Receive audio data from multiple channels.
  • false: Do not receive audio data from multiple channels.

◆ onPlaybackAudioFrameBeforeMixingEx()

virtual bool agora::media::IAudioFrameObserver::onPlaybackAudioFrameBeforeMixingEx ( const char *  channelId,
unsigned int  uid,
AudioFrame audioFrame 
)
inlinevirtual

Gets the before-mixing playback audio frame from multiple channels.

After you successfully register the audio frame observer, if you set the return value of isMultipleChannelFrameWanted as true, the SDK triggers this callback each time it receives a before-mixing audio frame from any of the channel.

Parameters
channelIdThe channel ID of this audio frame.
uidThe ID of the user sending this audio frame.
audioFrameThe pointer to AudioFrame.
Returns
  • true: The data in AudioFrame is valid, and send this audio frame.
  • false: The data in AudioFrame in invalid, and do not send this audio frame.