Public Member Functions

double getEffectsVolume ()
 
int setEffectsVolume (double volume)
 
int setVolumeOfEffect (int soundId, double volume)
 
int playEffect (int soundId, String filePath, int loop, double pitch, double pan, double gain)
 
int playEffect (int soundId, String filePath, int loopCount, double pitch, double pan, double gain, boolean publish)
 
int stopEffect (int soundId)
 
int stopAllEffects ()
 
int preloadEffect (int soundId, String filePath)
 
int unloadEffect (int soundId)
 
int pauseEffect (int soundId)
 
int pauseAllEffects ()
 
int resumeEffect (int soundId)
 
int resumeAllEffects ()
 

Detailed Description

Provides the methods to manage the audio effects.

Member Function Documentation

◆ getEffectsVolume()

double io.agora.rtc.IAudioEffectManager.getEffectsVolume ( )

Gets the volume of the audio effects.

The value ranges between 0.0 and 100.0.

Returns
  • Returns the volume, if the method call is successful.
  • < 0: Failure.

◆ setEffectsVolume()

int io.agora.rtc.IAudioEffectManager.setEffectsVolume ( double  volume)

Sets the volume of the audio effects.

Parameters
volumeVolume of the audio effects. The value ranges between 0.0 and 100.0 (default).
Returns
  • 0: Success.
  • < 0: Failure.

◆ setVolumeOfEffect()

int io.agora.rtc.IAudioEffectManager.setVolumeOfEffect ( int  soundId,
double  volume 
)

Sets the volume of a specified audio effect.

Parameters
soundIdID of the audio effect. Each audio effect has a unique ID.
volumeVolume of the audio effect. The value ranges between 0.0 and 100.0 (default).
Returns
  • 0: Success.
  • < 0: Failure.

◆ playEffect() [1/2]

int io.agora.rtc.IAudioEffectManager.playEffect ( int  soundId,
String  filePath,
int  loop,
double  pitch,
double  pan,
double  gain 
)

Plays a specified audio effect.

Deprecated:
This method is deprecated. Agora recommends using playEffect to play the local audio effect.
Parameters
soundIdID of the specified audio effect. Each audio effect has a unique ID. If the audio effect is preloaded into the memory through preloadEffect, ensure that the soundID value is set to the same value as in preloadEffect.
filePathAbsolute file path of the audio effect file.
loopSet 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 stopEffect or stopAllEffects is called.
pitchPitch 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.
panSpatial 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.
gainVolume of the audio effect. The value ranges betwwen 0.0 and 100,0. The default value is 100.0. The lower the value, the lower the volume of the audio effect.
Returns
  • 0: Success.
  • < 0: Failure.

◆ playEffect() [2/2]

int io.agora.rtc.IAudioEffectManager.playEffect ( int  soundId,
String  filePath,
int  loopCount,
double  pitch,
double  pan,
double  gain,
boolean  publish 
)

Plays a specified audio effect.

When the audio effect file playback is finished, the onAudioEffectFinished callback will be triggered.

Parameters
soundIdID of the specified audio effect. Each audio effect has a unique ID. If you preloaded the audio effect into the memory through preloadEffect, ensure that the soundID value is set to the same value as in preloadEffect.
filePathAbsolute file path of the audio effect file.
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 a loop indefinitely, until stopEffect or stopAllEffects 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 range is [-1.0, 1.0].
  • 0.0: The audio effect shows ahead.
  • 1.0: The audio effect shows on the right.
  • -1.0: The audio effect shows on the left.
gainSets the volume of the audio effect. The range is [0.0, 100,0]. The default value is 100.0. The lower the value, the lower the volume of the audio effect.
publishSet 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.

◆ stopEffect()

int io.agora.rtc.IAudioEffectManager.stopEffect ( int  soundId)

Stops playing a specified audio effect.

Parameters
soundIdID of the specified audio effect. Each audio effect has a unique ID.
Note
If you preloaded the audio effect into the memory through preloadEffect, ensure that the soundID value is set to the same value as in preloadEffect.
Returns
  • 0: Success.
  • < 0: Failure.

◆ stopAllEffects()

int io.agora.rtc.IAudioEffectManager.stopAllEffects ( )

Stops playing all audio effects.

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

◆ preloadEffect()

int io.agora.rtc.IAudioEffectManager.preloadEffect ( int  soundId,
String  filePath 
)

Preloads a specified audio effect file into the memory.

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

Parameters
soundIdID of the audio effect. Each audio effect has a unique ID.
filePathAbsolute path of the audio effect file.
Note
To ensure smooth communication, limit the size of the audio effect file. Agora recommends using this method to preload the audio effect before calling joinChannel.
Returns
  • 0: Success.
  • < 0: Failure.

◆ unloadEffect()

int io.agora.rtc.IAudioEffectManager.unloadEffect ( int  soundId)

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.

◆ pauseEffect()

int io.agora.rtc.IAudioEffectManager.pauseEffect ( int  soundId)

Pauses a specified audio effect.

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

◆ pauseAllEffects()

int io.agora.rtc.IAudioEffectManager.pauseAllEffects ( )

Pauses all audio effects.

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

◆ resumeEffect()

int io.agora.rtc.IAudioEffectManager.resumeEffect ( int  soundId)

Resumes playing a specified audio effect.

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

◆ resumeAllEffects()

int io.agora.rtc.IAudioEffectManager.resumeAllEffects ( )

Resumes playing all audio effects.

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

The documentation for this interface was generated from the following file:
  • src/main/java/io/agora/rtc/IAudioEffectManager.java