Voice SDK v3.7.1 API Reference for Unity
Public Member Functions | List of all members
agora_gaming_rtc.AudioRawDataManager Class Reference

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

◆ 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
audioFrame See 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
uid The user ID.
audioFrame See 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
audioFrame See AudioFrame.

◆ 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
audioFrame See AudioFrame.

◆ 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 through this callback. 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
audioBuffer The 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.
type The type of the audio frame. See AUDIO_FRAME_TYPE.
samples The number of samples per channel in the audio frame.
bytesPerSample The number of bytes per audio sample, which is usually 16-bit (2-byte).
channels The number of audio channels.
  • 1: Mono
  • 2: Stereo (the data is interleaved)
samplesPerSec The sample rate.
renderTimeMs The 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_type The reserved parameter.
Returns
  • 0: Success.
  • < 0: Failure.

◆ RegisterAudioRawDataObserver()

override int agora_gaming_rtc.AudioRawDataManager.RegisterAudioRawDataObserver ( )

Registers an audio raw data observer.

Note
Ensure that you call this method before joining a channel.
Returns
  • 0: Success.
  • < 0: Failure.

◆ SetOnMixedAudioFrameCallback()

override int agora_gaming_rtc.AudioRawDataManager.SetOnMixedAudioFrameCallback ( OnMixedAudioFrameHandler  action )

Listens for the OnMixedAudioFrameHandler delegate.

Note
Parameters
action The 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
action The implementation of the OnPlaybackAudioFrameBeforeMixingHandler delegate.
Returns
  • 0: Success.
  • < 0: Failure.

◆ SetOnPlaybackAudioFrameCallback()

override int agora_gaming_rtc.AudioRawDataManager.SetOnPlaybackAudioFrameCallback ( OnPlaybackAudioFrameHandler  action )

Listens for the OnPlaybackAudioFrameHandler delegate.

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

◆ SetOnRecordAudioFrameCallback()

override int agora_gaming_rtc.AudioRawDataManager.SetOnRecordAudioFrameCallback ( OnRecordAudioFrameHandler  action )

Listens for the OnRecordAudioFrameHandler delegate.

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

◆ UnRegisterAudioRawDataObserver()

override int agora_gaming_rtc.AudioRawDataManager.UnRegisterAudioRawDataObserver ( )

UnRegisters the audio raw data observer.

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

The documentation for this class was generated from the following file: