Inherits agora_gaming_rtc.IAudioRawDataManager.

Public Member Functions

delegate void OnRecordAudioFrameHandler (AudioFrame audioFrame)
 
delegate void OnPlaybackAudioFrameHandler (AudioFrame audioFrame)
 
delegate void OnMixedAudioFrameHandler (AudioFrame audioFrame)
 
delegate void OnPlaybackAudioFrameBeforeMixingHandler (uint uid, AudioFrame audioFrame)
 
override int SetOnRecordAudioFrameCallback (OnRecordAudioFrameHandler action)
 
override int SetOnPlaybackAudioFrameCallback (OnPlaybackAudioFrameHandler action)
 
override int SetOnMixedAudioFrameCallback (OnMixedAudioFrameHandler action)
 
override int SetOnPlaybackAudioFrameBeforeMixingCallback (OnPlaybackAudioFrameBeforeMixingHandler action)
 
override int RegisterAudioRawDataObserver ()
 
override int UnRegisterAudioRawDataObserver ()
 
override int PullAudioFrame (IntPtr audioBuffer, int type, int samples, int bytesPerSample, int channels, int samplesPerSec, long renderTimeMs, int avsync_type)
 

Detailed Description

The definition of AudioRawDataManager.

Member Function Documentation

◆ OnRecordAudioFrameHandler()

delegate void agora_gaming_rtc.AudioRawDataManager.OnRecordAudioFrameHandler ( AudioFrame  audioFrame)

Retrieves the recorded audio frame.

The SDK triggers this callback once every 10 ms.

Parameters
audioFrameSee AudioFrame.

◆ OnPlaybackAudioFrameHandler()

delegate void agora_gaming_rtc.AudioRawDataManager.OnPlaybackAudioFrameHandler ( AudioFrame  audioFrame)

Retrieves the audio playback frame.

The SDK triggers this callback once every 10 ms.

Parameters
audioFrameSee AudioFrame.

◆ OnMixedAudioFrameHandler()

delegate void agora_gaming_rtc.AudioRawDataManager.OnMixedAudioFrameHandler ( AudioFrame  audioFrame)

Retrieves the mixed recorded and playback audio frame.

The SDK triggers this callback once every 10 ms.

Parameters
audioFrameSee AudioFrame.

◆ OnPlaybackAudioFrameBeforeMixingHandler()

delegate void agora_gaming_rtc.AudioRawDataManager.OnPlaybackAudioFrameBeforeMixingHandler ( uint  uid,
AudioFrame  audioFrame 
)

Retrieves the audio frame of a specified user before mixing.

The SDK triggers this callback once every 10 ms.

Parameters
uidThe user ID.
audioFrameSee AudioFrame.

◆ SetOnRecordAudioFrameCallback()

override int agora_gaming_rtc.AudioRawDataManager.SetOnRecordAudioFrameCallback ( OnRecordAudioFrameHandler  action)

Listens for the OnRecordAudioFrameHandler delegate.

Note
Parameters
actionThe implementation of the OnRecordAudioFrameHandler delegate.
Returns
  • 0: Success.
  • < 0: Failure.

◆ SetOnPlaybackAudioFrameCallback()

override int agora_gaming_rtc.AudioRawDataManager.SetOnPlaybackAudioFrameCallback ( OnPlaybackAudioFrameHandler  action)

Listens for the OnPlaybackAudioFrameHandler delegate.

Note
Parameters
actionThe implementation of the OnPlaybackAudioFrameHandler delegate.
Returns
  • 0: Success.
  • < 0: Failure.

◆ SetOnMixedAudioFrameCallback()

override int agora_gaming_rtc.AudioRawDataManager.SetOnMixedAudioFrameCallback ( OnMixedAudioFrameHandler  action)

Listens for the OnMixedAudioFrameHandler delegate.

Note
Parameters
actionThe implementation of the OnMixedAudioFrameHandler delegate.
Returns
  • 0: Success.
  • < 0: Failure.

◆ SetOnPlaybackAudioFrameBeforeMixingCallback()

override int agora_gaming_rtc.AudioRawDataManager.SetOnPlaybackAudioFrameBeforeMixingCallback ( OnPlaybackAudioFrameBeforeMixingHandler  action)

Listens for the OnPlaybackAudioFrameBeforeMixingHandler delegate.

Note
Parameters
actionThe implementation of the OnPlaybackAudioFrameBeforeMixingHandler delegate.
Returns
  • 0: Success.
  • < 0: Failure.

◆ RegisterAudioRawDataObserver()

override int agora_gaming_rtc.AudioRawDataManager.RegisterAudioRawDataObserver ( )

Registers an audio raw data observer.

Returns
  • 0: Success.
  • < 0: Failure.

◆ UnRegisterAudioRawDataObserver()

override int agora_gaming_rtc.AudioRawDataManager.UnRegisterAudioRawDataObserver ( )

UnRegisters the audio raw data observer.

Returns
  • 0: Success.
  • < 0: Failure.

◆ PullAudioFrame()

override int agora_gaming_rtc.AudioRawDataManager.PullAudioFrame ( IntPtr  audioBuffer,
int  type,
int  samples,
int  bytesPerSample,
int  channels,
int  samplesPerSec,
long  renderTimeMs,
int  avsync_type 
)

Pulls the remote audio data.

Before calling this method, call the SetExternalAudioSink(enabled: true) method to enable and set the external audio sink.

After a successful method call, the app pulls the decoded and mixed audio data for playback.

Note
  • Once you call the PullAudioFrame method successfully, the app will not retrieve any audio data from the OnPlaybackAudioFrameHandler callback.
  • The difference between the OnPlaybackAudioFrameHandler callback and the PullAudioFrame method is as follows:
    • OnPlaybackAudioFrameHandler: The SDK sends the audio data to the app once every 10 ms. Any delay in processing the audio frames may result in audio jitter.
    • PullAudioFrame: The app pulls the remote audio data. After setting the audio data parameters, the SDK adjusts the frame buffer and avoids problems caused by jitter in the external audio playback.
Parameters
audioBufferThe data buffer of the audio frame. When the audio frame uses a stereo channel, the data buffer is interleaved. The size of the data buffer is as follows: audioBuffer = samples × channels × bytesPerSample.
typeThe type of the audio frame. See AUDIO_FRAME_TYPE.
samplesThe number of samples per channel in the audio frame.
bytesPerSampleThe number of bytes per audio sample, which is usually 16-bit (2-byte).
channelsThe number of audio channels.
  • 1: Mono
  • 2: Stereo (the data is interleaved)
samplesPerSecThe sample rate.
renderTimeMsThe timestamp of the external audio frame. You can use this parameter for the following purposes:
  • Restore the order of the captured audio frame.
  • Synchronize audio and video frames in video-related scenarios, including where external video sources are used.
avsync_typeThe reserved parameter.
Returns
  • 0: Success.
  • < 0: Failure.