|
Agora C++ API Reference for All Platforms
|
#include <AgoraMediaBase.h>
Inherited by agora::media::IAudioFrameObserver.
Classes | |
| struct | AudioFrame |
| struct | AudioParams |
Public Types | |
| enum | AUDIO_FRAME_TYPE { FRAME_TYPE_PCM16 = 0 } |
| enum | { MAX_HANDLE_TIME_CNT = 10 } |
| enum | AUDIO_FRAME_POSITION { AUDIO_FRAME_POSITION_NONE = 0x0000 , AUDIO_FRAME_POSITION_PLAYBACK = 0x0001 , AUDIO_FRAME_POSITION_RECORD = 0x0002 , AUDIO_FRAME_POSITION_MIXED = 0x0004 , AUDIO_FRAME_POSITION_BEFORE_MIXING = 0x0008 , AUDIO_FRAME_POSITION_EAR_MONITORING = 0x0010 } |
Public Member Functions | |
| virtual | ~IAudioFrameObserverBase () |
| virtual bool | onRecordAudioFrame (const char *channelId, AudioFrame &audioFrame)=0 |
| virtual bool | onPlaybackAudioFrame (const char *channelId, AudioFrame &audioFrame)=0 |
| virtual bool | onMixedAudioFrame (const char *channelId, AudioFrame &audioFrame)=0 |
| virtual bool | onEarMonitoringAudioFrame (AudioFrame &audioFrame)=0 |
| virtual bool | onPlaybackAudioFrameBeforeMixing (const char *channelId, base::user_id_t userId, AudioFrame &audioFrame) |
| virtual int | getObservedAudioFramePosition ()=0 |
| virtual AudioParams | getPlaybackAudioParams ()=0 |
| virtual AudioParams | getRecordAudioParams ()=0 |
| virtual AudioParams | getMixedAudioParams ()=0 |
| virtual AudioParams | getEarMonitoringAudioParams ()=0 |
The IAudioFrameObserverBase class.
|
inlinevirtual |
|
pure virtual |
Gets the captured audio frame.
To ensure that the format of the cpatured audio frame is as expected, you can choose one of the following two methods to set the audio data format:
setRecordingAudioFrameParameters to set the audio data format and registerAudioFrameObserver to register the audio frame observer object, the SDK calculates the sampling interval according to the parameters set in the methods, and triggers the onRecordAudioFrame callback according to the sampling interval.registerAudioFrameObserver to register the audio frame observer object, set the audio data format in the return value of the getObservedAudioFramePosition callback. The SDK then calculates the sampling interval according to the return value of the getRecordAudioParams callback, and triggers the onRecordAudioFrame callback according to the sampling interval.| audioFrame | The raw audio data. See AudioFrame. |
| channelId | The channel ID. |
|
pure virtual |
Gets the raw audio frame for playback.
To ensure that the data format of audio frame for playback is as expected, Agora recommends that you choose one of the following two methods to set the audio data format:
setPlaybackAudioFrameParameters to set the audio data format and registerAudioFrameObserver to register the audio frame observer object, the SDK calculates the sampling interval according to the parameters set in the methods, and triggers the onPlaybackAudioFrame callback according to the sampling interval.registerAudioFrameObserver to register the audio frame observer object, set the audio data format in the return value of the getObservedAudioFramePosition callback. The SDK then calculates the sampling interval according to the return value of the getPlaybackAudioParams callback, and triggers the onPlaybackAudioFrame callback according to the sampling interval.| audioFrame | The raw audio data. See AudioFrame. |
| channelId | The channel ID. |
Implemented in agora::rtc::IMediaRecorderEx.
|
pure virtual |
Retrieves the mixed captured and playback audio frame.
To ensure that the data format of mixed captured and playback audio frame meets the expectations, Agora recommends that you choose one of the following two ways to set the data format:
setMixedAudioFrameParameters to set the audio data format and registerAudioFrameObserver to register the audio frame observer object, the SDK calculates the sampling interval according to the parameters set in the methods, and triggers the onMixedAudioFrame callback according to the sampling interval.registerAudioFrameObserver to register the audio frame observer object, set the audio data format in the return value of the getObservedAudioFramePosition callback. The SDK then calculates the sampling interval according to the return value of the getMixedAudioParams callback, and triggers the onMixedAudioFrame callback according to the sampling interval.| audioFrame | The raw audio data. See AudioFrame. |
| channelId | The channel ID. |
Implemented in agora::rtc::IMediaRecorderEx.
|
pure virtual |
Gets the in-ear monitoring audio frame.
In order to ensure that the obtained in-ear audio data meets the expectations, Agora recommends that you choose one of the following two methods to set the in-ear monitoring-ear audio data format:
setEarMonitoringAudioFrameParameters to set the audio data format and registerAudioFrameObserver to register the audio frame observer object, the SDK calculates the sampling interval according to the parameters set in the methods, and triggers the onEarMonitoringAudioFrame callback according to the sampling interval.registerAudioFrameObserver to register the audio frame observer object, set the audio data format in the return value of the getObservedAudioFramePosition callback. The SDK then calculates the sampling interval according to the return value of the getEarMonitoringAudioParams callback, and triggers the onEarMonitoringAudioFrame callback according to the sampling interval.| audioFrame | The raw audio data. See AudioFrame. |
Implemented in agora::rtc::IMediaRecorderEx.
|
inlinevirtual |
Occurs when the before-mixing playback audio frame is received.
| channelId | The channel name |
| userId | ID of the remote user. |
| audioFrame | The reference to the audio frame: AudioFrame. |
Reimplemented in agora::media::IAudioFrameObserver.
|
pure virtual |
Sets the frame position for the video observer.
After successfully registering the audio data observer, the SDK uses this callback for each specific audio frame processing node to determine whether to trigger the following callbacks:
onRecordAudioFrameonPlaybackAudioFrameonPlaybackAudioFrameBeforeMixingonMixedAudioFrameonEarMonitoringAudioFrame You can set one or more positions you need to observe by modifying the return value of getObservedAudioFramePosition based on your scenario requirements: When the annotation observes multiple locations, the | (or operator) is required. To conserve system resources, you can reduce the number of frame positions that you want to observe.onPlaybackAudioFrame callback.onRecordAudioFrame callback.onMixedAudioFrame callback.onPlaybackAudioFrameBeforeMixing callback.onEarMonitoringAudioFrame callback.
|
pure virtual |
Sets the audio format for the onPlaybackAudioFrame callback.
You need to register the callback when calling the registerAudioFrameObserver method. After you successfully register the audio observer, the SDK triggers this callback, and you can set the audio format in the return value of this callback.
onPlaybackAudioFrame callback with the AudioParams calculated sampling interval you set in the return value. The calculation formula is Sample interval (sec) = samplePerCall /( sampleRate × channel ). Ensure that the sample interval ≥ 0.01 (s).AudioParams. Implemented in agora::rtc::IMediaRecorderEx.
|
pure virtual |
Sets the audio format for the onRecordAudioFrame callback.
You need to register the callback when calling the registerAudioFrameObserver method. After you successfully register the audio observer, the SDK triggers this callback, and you can set the audio format in the return value of this callback.
onRecordAudioFrame callback with the AudioParams calculated sampling interval you set in the return value. The calculation formula is Sample interval (sec) = samplePerCall /( sampleRate × channel ). Ensure that the sample interval ≥ 0.01 (s).AudioParams. Implemented in agora::rtc::IMediaRecorderEx.
|
pure virtual |
Sets the audio format for the onMixedAudioFrame callback.
You need to register the callback when calling the registerAudioFrameObserver method. After you successfully register the audio observer, the SDK triggers this callback, and you can set the audio format in the return value of this callback.
onMixedAudioFrame callback with the AudioParams calculated sampling interval you set in the return value. The calculation formula is Sample interval (sec) = samplePerCall /( sampleRate × channel ). Ensure that the sample interval ≥ 0.01 (s).AudioParams. Implemented in agora::rtc::IMediaRecorderEx.
|
pure virtual |
Sets the audio format for the onEarMonitoringAudioFrame callback.
You need to register the callback when calling the registerAudioFrameObserver method. After you successfully register the audio observer, the SDK triggers this callback, and you can set the audio format in the return value of this callback.
onEarMonitoringAudioFrame callback with the AudioParams calculated sampling interval you set in the return value. The calculation formula is Sample interval ( sec ) = samplePerCall /( sampleRate × channel ). Ensure that the sample interval ≥ 0.01 (s).AudioParams. Implemented in agora::rtc::IMediaRecorderEx.