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

Inherits agora_gaming_rtc.IAudioEffectManager.

Public Member Functions

override double GetEffectsVolume ()
 
override int SetEffectsVolume (int volume)
 
override int PlayEffect (int soundId, string filePath, int loopCount, double pitch=1.0D, double pan=0.0D, int gain=100, bool publish=false)
 
override int StopEffect (int soundId)
 
override int StopAllEffects ()
 
override int PreloadEffect (int soundId, string filePath)
 
override int UnloadEffect (int soundId)
 
override int PauseEffect (int soundId)
 
override int PauseAllEffects ()
 
override int ResumeEffect (int soundId)
 
override int ResumeAllEffects ()
 
override int SetVoiceOnlyMode (bool enable)
 
override int SetRemoteVoicePosition (uint uid, double pan, double gain)
 
override int SetLocalVoicePitch (double pitch)
 

Detailed Description

The definition of AudioEffectManagerImpl.

Member Function Documentation

◆ GetInstance()

static AudioEffectManagerImpl agora_gaming_rtc.AudioEffectManagerImpl.GetInstance ( IRtcEngine  rtcEngine)
static

◆ ReleaseInstance()

static void agora_gaming_rtc.AudioEffectManagerImpl.ReleaseInstance ( )
static

◆ SetEngine()

void agora_gaming_rtc.AudioEffectManagerImpl.SetEngine ( IRtcEngine  engine)

◆ GetEffectsVolume()

override double agora_gaming_rtc.AudioEffectManagerImpl.GetEffectsVolume ( )
virtual

Retrieves the volume of the audio effects.

The value ranges between 0.0 and 100.0.

Note
Ensure that this method is called after PlayEffect.
Returns
  • ≥ 0: Volume of the audio effects, if this method call succeeds.
  • < 0: Failure.

Implements agora_gaming_rtc.IAudioEffectManager.

◆ SetEffectsVolume()

override int agora_gaming_rtc.AudioEffectManagerImpl.SetEffectsVolume ( int  volume)
virtual

Sets the volume of the audio effects.

Note
Ensure that this method is called after PlayEffect.
Parameters
volumeSets the volume of the audio effects. The value ranges between 0 and 100 (default).
Returns
  • 0: Success.
  • < 0: Failure.

Implements agora_gaming_rtc.IAudioEffectManager.

◆ PlayEffect() [1/2]

override int agora_gaming_rtc.AudioEffectManagerImpl.PlayEffect ( int  soundId,
string  filePath,
int  loopCount,
double  pitch = 1.0D,
double  pan = 0.0D,
int  gain = 100,
bool  publish = false 
)
virtual

Plays a specified local or online audio effect file.

This method allows you to set the loop count, pitch, pan, and gain of the audio effect file, as well as whether the remote user can hear the audio effect.

To play multiple audio effect files simultaneously, call this method multiple times with different soundIds and filePaths. We recommend playing no more than three audio effect files at the same time.

Note
  • If the audio effect is preloaded into the memory through the PreloadEffect method, the value of soundId must be the same as that in the PreloadEffect method.
  • Playing multiple online audio effect files simultaneously is not supported on macOS and Windows.
  • Ensure that you call this method after joining a channel.
Parameters
soundIdID of the specified audio effect. Each audio effect has a unique ID.
filePathSpecifies the absolute path (including the suffixes of the filename) to the local audio effect file or the URL of the online audio effect file. Supported audio formats: mp3, mp4, m4a, aac, 3gp, mkv and wav.
loopCountSets the number of times the audio effect loops:
  • 0: Play the audio effect once.
  • 1: Play the audio effect twice.
  • -1: Play the audio effect in an indefinite loop until the StopEffect or StopAllEffects method is called.
pitchSets the pitch of the audio effect. The value ranges between 0.5 and 2. The default value is 1 (no change to the pitch). The lower the value, the lower the pitch.
panSets the spatial position of the audio effect. The value ranges between -1.0 and 1.0:
  • 0.0: The audio effect displays ahead.
  • 1.0: The audio effect displays to the right.
  • -1.0: The audio effect displays to the left.
gainSets the volume of the audio effect. The value ranges between 0 and 100 (default). The lower the value, the lower the volume of the audio effect.
publishSets whether or not to publish the specified audio effect to the remote stream:
  • true: The locally played audio effect is published to the Agora Cloud and the remote users can hear it.
  • false: The locally played audio effect is not published to the Agora Cloud and the remote users cannot hear it.
Returns
  • 0: Success.
  • < 0: Failure.

Implements agora_gaming_rtc.IAudioEffectManager.

◆ PlayEffect() [2/2]

override int agora_gaming_rtc.AudioEffectManagerImpl.PlayEffect ( int  soundId,
string  filePath,
int  loopCount,
double  pitch,
double  pan,
int  gain,
bool  publish,
int  startPos 
)
virtual

◆ GetEffectDuration()

override int agora_gaming_rtc.AudioEffectManagerImpl.GetEffectDuration ( string  filePath)
virtual

◆ SetEffectPosition()

override int agora_gaming_rtc.AudioEffectManagerImpl.SetEffectPosition ( int  soundId,
int  pos 
)
virtual

◆ GetEffectCurrentPosition()

override int agora_gaming_rtc.AudioEffectManagerImpl.GetEffectCurrentPosition ( int  soundId)
virtual

◆ StopEffect()

override int agora_gaming_rtc.AudioEffectManagerImpl.StopEffect ( int  soundId)
virtual

Stops playing a specified audio effect.

Parameters
soundIdID of the audio effect to stop playing. Each audio effect has a unique ID.
Returns
  • 0: Success.
  • < 0: Failure.

Implements agora_gaming_rtc.IAudioEffectManager.

◆ StopAllEffects()

override int agora_gaming_rtc.AudioEffectManagerImpl.StopAllEffects ( )
virtual

Stops playing all audio effects.

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

Implements agora_gaming_rtc.IAudioEffectManager.

◆ PreloadEffect()

override int agora_gaming_rtc.AudioEffectManagerImpl.PreloadEffect ( int  soundId,
string  filePath 
)
virtual

Preloads a specified audio effect file into the memory.

To ensure smooth communication, limit the size of the audio effect file. We recommend using this method to preload the audio effect before calling the JoinChannelByKey method.

Supported audio formats: mp3, aac, m4a, 3gp, and wav.

Note
This method does not support online audio effect files.
Parameters
soundIdID of the audio effect. Each audio effect has a unique ID.
filePathThe absolute path of the audio effect file.
Returns
  • 0: Success.
  • < 0: Failure.

Implements agora_gaming_rtc.IAudioEffectManager.

◆ UnloadEffect()

override int agora_gaming_rtc.AudioEffectManagerImpl.UnloadEffect ( int  soundId)
virtual

Releases a specified preloaded audio effect from the memory.

Parameters
soundIdID of the audio effect. Each audio effect has a unique ID.
Returns
  • 0: Success.
  • < 0: Failure.

Implements agora_gaming_rtc.IAudioEffectManager.

◆ PauseEffect()

override int agora_gaming_rtc.AudioEffectManagerImpl.PauseEffect ( int  soundId)
virtual

Pauses a specified audio effect.

Parameters
soundIdID of the audio effect. Each audio effect has a unique ID.
Returns
  • 0: Success.
  • < 0: Failure.

Implements agora_gaming_rtc.IAudioEffectManager.

◆ PauseAllEffects()

override int agora_gaming_rtc.AudioEffectManagerImpl.PauseAllEffects ( )
virtual

Pauses all audio effects.

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

Implements agora_gaming_rtc.IAudioEffectManager.

◆ ResumeEffect()

override int agora_gaming_rtc.AudioEffectManagerImpl.ResumeEffect ( int  soundId)
virtual

Resumes playing a specified audio effect.

Parameters
soundIdID of the audio effect. Each audio effect has a unique ID.
Returns
  • 0: Success.
  • < 0: Failure.

Implements agora_gaming_rtc.IAudioEffectManager.

◆ ResumeAllEffects()

override int agora_gaming_rtc.AudioEffectManagerImpl.ResumeAllEffects ( )
virtual

Resumes playing all audio effects.

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

Implements agora_gaming_rtc.IAudioEffectManager.

◆ SetVoiceOnlyMode()

override int agora_gaming_rtc.AudioEffectManagerImpl.SetVoiceOnlyMode ( bool  enable)
virtual

Sets the voice-only mode (transmit the audio stream only), and the other streams will be ignored; for example the sound of the keyboard strokes.

Parameters
enableWhether to enable the voice-only mode.
  • true: Enable.
  • false: Disable.
Returns
  • 0: Success.
  • < 0: Failure.

Implements agora_gaming_rtc.IAudioEffectManager.

◆ SetRemoteVoicePosition()

override int agora_gaming_rtc.AudioEffectManagerImpl.SetRemoteVoicePosition ( uint  uid,
double  pan,
double  gain 
)
virtual

Sets the sound position and gain of a remote user.

When the local user calls this method to set the sound position of a remote user, the sound difference between the left and right channels allows the local user to track the real-time position of the remote user, creating a real sense of space. This method applies to massively multiplayer online games, such as Battle Royale games.

Note
  • For this method to work, enable stereo panning for remote users by calling the EnableSoundPositionIndication method before joining a channel.
  • This method requires hardware support. For the best sound positioning, we recommend using a wired headset.
  • Ensure that you call this method after joining a channel.
Parameters
uidThe ID of the remote user.
panThe sound position of the remote user. The value ranges from -1.0 to 1.0:
  • 0.0: the remote sound comes from the front.
  • -1.0: the remote sound comes from the left.
  • 1.0: the remote sound comes from the right.
gainGain of the remote user. The value ranges from 0.0 to 100.0. The default value is 100.0 (the original gain of the remote user). The smaller the value, the less the gain.
Returns
  • 0: Success.
  • < 0: Failure.

Implements agora_gaming_rtc.IAudioEffectManager.

◆ SetLocalVoicePitch()

override int agora_gaming_rtc.AudioEffectManagerImpl.SetLocalVoicePitch ( double  pitch)
virtual

Changes the voice pitch of the local speaker.

Note
You can call this method either before or after joining a channel.
Parameters
pitchSets the voice pitch. The value ranges between 0.5 and 2.0. The lower the value, the lower the voice pitch. The default value is 1.0 (no change to the local voice pitch).
Returns
  • 0: Success.
  • < 0: Failure.

Implements agora_gaming_rtc.IAudioEffectManager.


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