Voice 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

◆ GetEffectsVolume()

override double agora_gaming_rtc.AudioEffectManagerImpl.GetEffectsVolume ( )

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.

◆ PauseAllEffects()

override int agora_gaming_rtc.AudioEffectManagerImpl.PauseAllEffects ( )

Pauses all audio effects.

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

◆ PauseEffect()

override int agora_gaming_rtc.AudioEffectManagerImpl.PauseEffect ( int  soundId )

Pauses a specified audio effect.

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

◆ PlayEffect()

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 
)

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
soundId ID of the specified audio effect. Each audio effect has a unique ID.
filePath Specifies 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.
loopCount Sets 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.
pitch Sets 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.
pan Sets 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.
gain Sets 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.
publish Sets 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.

◆ PreloadEffect()

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

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
soundId ID of the audio effect. Each audio effect has a unique ID.
filePath The absolute path of the audio effect file.
Returns
  • 0: Success.
  • < 0: Failure.

◆ ResumeAllEffects()

override int agora_gaming_rtc.AudioEffectManagerImpl.ResumeAllEffects ( )

Resumes playing all audio effects.

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

◆ ResumeEffect()

override int agora_gaming_rtc.AudioEffectManagerImpl.ResumeEffect ( int  soundId )

Resumes playing a specified audio effect.

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

◆ SetEffectsVolume()

override int agora_gaming_rtc.AudioEffectManagerImpl.SetEffectsVolume ( int  volume )

Sets the volume of the audio effects.

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

◆ SetLocalVoicePitch()

override int agora_gaming_rtc.AudioEffectManagerImpl.SetLocalVoicePitch ( double  pitch )

Changes the voice pitch of the local speaker.

Note
You can call this method either before or after joining a channel.
Parameters
pitch Sets 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.

◆ SetRemoteVoicePosition()

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

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
uid The ID of the remote user.
pan The 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.
gain Gain 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.

◆ SetVoiceOnlyMode()

override int agora_gaming_rtc.AudioEffectManagerImpl.SetVoiceOnlyMode ( bool  enable )

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
enable Whether to enable the voice-only mode.
  • true: Enable.
  • false: Disable.
Returns
  • 0: Success.
  • < 0: Failure.

◆ StopAllEffects()

override int agora_gaming_rtc.AudioEffectManagerImpl.StopAllEffects ( )

Stops playing all audio effects.

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

◆ StopEffect()

override int agora_gaming_rtc.AudioEffectManagerImpl.StopEffect ( int  soundId )

Stops playing a specified audio effect.

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

◆ UnloadEffect()

override int agora_gaming_rtc.AudioEffectManagerImpl.UnloadEffect ( int  soundId )

Releases a specified preloaded audio effect from the memory.

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

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