Package io.agora.rtc2
Interface IAudioEffectManager
public interface IAudioEffectManager
Provides the methods to manage the audio effects.
-
Method Summary
Modifier and TypeMethodDescriptiondoubleGets the volume of the audio effects.intPauses playing all audio effects.intpauseEffect(int soundId) Pauses playing the specified audio effect.intplayEffect(int soundId, String filePath, int loop, double pitch, double pan, double gain) Plays a specified audio effect.intplayEffect(int soundId, String filePath, int loopCount, double pitch, double pan, double gain, boolean publish) Plays a specified audio effect.intplayEffect(int soundId, String filePath, int loopCount, double pitch, double pan, double gain, boolean publish, int startPos) Plays a specified audio effect.intplayEffectEx(RtcConnection connection, int soundId, String filePath, int loopCount, double pitch, double pan, double gain, boolean publish) Plays a specified audio effect to a specified channel.intplayEffectEx(RtcConnection connection, int soundId, String filePath, int loopCount, double pitch, double pan, double gain, boolean publish, int startPos) Plays a specified audio effect to a specified channel.intpreloadEffect(int soundId, String filePath) Preloads a specified audio effect.intpreloadEffect(int soundId, String filePath, int startPos) Preloads a specified audio effect.intpreloadEffectEx(RtcConnection connection, int soundId, String filePath) Preloads a specified audio effect to a specified channel.intpreloadEffectEx(RtcConnection connection, int soundId, String filePath, int startPos) Preloads a specified audio effect to a specified channel.intResumes playing all audio effects.intresumeEffect(int soundId) Resumes playing the specific audio effect.intsetEffectsVolume(double volume) Sets the volume of audio effects.intsetVolumeOfEffect(int soundId, double volume) Sets the volume of the specified audio effect.intStops playing all audio effects.intstopEffect(int soundId) Stops playing the specific audio effect.intunloadEffect(int soundId) Releases the specific preloaded audio effect from the memory.
-
Method Details
-
getEffectsVolume
double getEffectsVolume()Gets the volume of the audio effects.- Returns:
- - Returns the volume of audio effects, if the method call is successful. The value ranges between 0.0 and 100.0 (original volume). - < 0: Failure.
-
setEffectsVolume
int setEffectsVolume(double volume) Sets the volume of audio effects.- Parameters:
volume- The volume of audio effects. The value ranges between 0.0 and 100.0 (default).- Returns:
- 0: Success.
- <0: Failure.
-
setVolumeOfEffect
int setVolumeOfEffect(int soundId, double volume) Sets the volume of the specified audio effect.- Parameters:
soundId- The ID of the audio effect.volume- The volume of the specified audio effect. The value ranges between 0.0 and 100.0 (default).- Returns:
- 0: Success.
- <0: Failure.
-
playEffect
Plays a specified audio effect. After calling {@link IAudioEffectManager#preloadEffect preloadEffect}, you can call this method to play the specified audio effect for all users in the channel. This method plays only one specified audio effect each time it is called. To play multiple audio effects, call this method multiple times.- Parameters:
soundId- The ID of the audio effect.filePath- The absolute path of 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.loop- The number of times the audio effect loops: - `-1`: Play the audio effect in an indefinite loop until you call {@link IAudioEffectManager#stopEffect stopEffect} or {@link IAudioEffectManager#stopAllEffects stopAllEffects}. - `0`: Play the audio effect once. - `1`: Play the audio effect twice.pitch- The pitch of the audio effect. The value ranges between 0.5 and 2.0. The default value is `1.0` (original pitch). The lower the value, the lower the pitch.pan- The spatial position of the audio effect. The value ranges between -1.0 and 1.0: - `-1.0`: The audio effect shows on the left. - `0.0`: The audio effect shows ahead. - `1.0`: The audio effect shows on the right.gain- The volume of the audio effect. The value ranges between 0.0 and 100.0. The default value is `100` (original volume).The lower the value, the lower the volume of the audio effect.- Returns:
- - 0: Success. - < 0: Failure.
-
playEffect
int playEffect(int soundId, String filePath, int loopCount, double pitch, double pan, double gain, boolean publish) Plays a specified audio effect. After calling {@link IAudioEffectManager#preloadEffect preloadEffect}, you can call this method to play the specified audio effect for all users in the channel. This method plays only one specified audio effect each time it is called. To play multiple audio effects, call this method multiple times.- Parameters:
soundId- The ID of the audio effect..filePath- The absolute path of 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- The number of times the audio effect loops: - `-1`: Play the audio effect in an indefinite loop until you call {@link IAudioEffectManager#stopEffect stopEffect} or {@link IAudioEffectManager#stopAllEffects stopAllEffects}. - `0`: Play the audio effect once. - `1`: Play the audio effect twice.pitch- The pitch of the audio effect. The value ranges between 0.5 and 2.0. The default value is `1.0` (original pitch). The lower the value, the lower the pitch.pan- The spatial position of the audio effect. The value ranges between -1.0 and 1.0: - `-1.0`: The audio effect shows on the left. - `0.0`: The audio effect shows ahead. - `1.0`: The audio effect shows on the right.gain- The volume of the audio effect. The value ranges between 0.0 and 100.0. The default value is `100` (original volume).The lower the value, the lower the volume of the audio effect.publish- Sets whether to publish the specified audio effect in a channel: - True: Publish the audio effect in the channel so that remote user can hear it. - False: Do not publish the audio effect in the channel.- Returns:
- - 0: Success. - < 0: Failure.
-
playEffect
int playEffect(int soundId, String filePath, int loopCount, double pitch, double pan, double gain, boolean publish, int startPos) Plays a specified audio effect. After calling {@link IAudioEffectManager##preloadEffect() preloadEffect}, you can call this method to play the specified audio effect for all users in the channel. This method plays only one specified audio effect each time it is called. To play multiple audio effects, call this method multiple times.- Parameters:
soundId- The ID of the audio effect.filePath- The absolute path of 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- The number of times the audio effect loops: - `-1`: Play the audio effect in an indefinite loop until you call {@link IAudioEffectManager##stopEffect() stopEffect} orstopAllEffects. - `0`: Play the audio effect once. - `1`: Play the audio effect twice.pitch- The pitch of the audio effect. The value ranges between 0.5 and 2.0. The default value is 1.0 (original pitch). The lower the value, the lower the pitch.pan- The spatial position of the audio effect. The value ranges between -1.0 and 1.0: - `-1.0`: The audio effect shows on the left. - `0.0`: The audio effect shows ahead. - `1.0`: The audio effect shows on the right.gain- The volume of the audio effect. The value ranges between 0.0 and 100.0. The default value is 100 (original volume). The lower the value, the lower the volume of the audio effect.publish- Sets whether to publish the specified audio effect in a channel: - True: Publish the audio effect in the channel so that remote user can hear it. - False: Do not publish the audio effect in the channel.startPos- The playback position (ms) of the audio effect file.- Returns:
- - 0: Success. - < 0: Failure.
-
playEffectEx
int playEffectEx(RtcConnection connection, int soundId, String filePath, int loopCount, double pitch, double pan, double gain, boolean publish) Plays a specified audio effect to a specified channel. After calling {@link IAudioEffectManager#preloadEffect preloadEffect}, you can call this method to play the specified audio effect for all users in the channel. This method plays only one specified audio effect each time it is called. To play multiple audio effects, call this method multiple times.- Parameters:
connection- The RtcConnection object.soundId- The ID of the audio effect..filePath- The absolute path of 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- The number of times the audio effect loops: - `-1`: Play the audio effect in an indefinite loop until you call {@link IAudioEffectManager#stopEffect stopEffect} or {@link IAudioEffectManager#stopAllEffects stopAllEffects}. - `0`: Play the audio effect once. - `1`: Play the audio effect twice.pitch- The pitch of the audio effect. The value ranges between 0.5 and 2.0. The default value is `1.0` (original pitch). The lower the value, the lower the pitch.pan- The spatial position of the audio effect. The value ranges between -1.0 and 1.0: - `-1.0`: The audio effect shows on the left. - `0.0`: The audio effect shows ahead. - `1.0`: The audio effect shows on the right.gain- The volume of the audio effect. The value ranges between 0.0 and 100.0. The default value is `100` (original volume).The lower the value, the lower the volume of the audio effect.publish- Sets whether to publish the specified audio effect in a channel: - True: Publish the audio effect in the channel so that remote user can hear it. - False: Do not publish the audio effect in the channel.- Returns:
- - 0: Success. - < 0: Failure.
-
playEffectEx
int playEffectEx(RtcConnection connection, int soundId, String filePath, int loopCount, double pitch, double pan, double gain, boolean publish, int startPos) Plays a specified audio effect to a specified channel. After calling {@link IAudioEffectManager##preloadEffect() preloadEffect}, you can call this method to play the specified audio effect for all users in the channel. This method plays only one specified audio effect each time it is called. To play multiple audio effects, call this method multiple times.- Parameters:
connection- The RtcConnection object.soundId- The ID of the audio effect.filePath- The absolute path of 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- The number of times the audio effect loops: - `-1`: Play the audio effect in an indefinite loop until you call {@link IAudioEffectManager##stopEffect() stopEffect} orstopAllEffects. - `0`: Play the audio effect once. - `1`: Play the audio effect twice.pitch- The pitch of the audio effect. The value ranges between 0.5 and 2.0. The default value is 1.0 (original pitch). The lower the value, the lower the pitch.pan- The spatial position of the audio effect. The value ranges between -1.0 and 1.0: - `-1.0`: The audio effect shows on the left. - `0.0`: The audio effect shows ahead. - `1.0`: The audio effect shows on the right.gain- The volume of the audio effect. The value ranges between 0.0 and 100.0. The default value is 100 (original volume). The lower the value, the lower the volume of the audio effect.publish- Sets whether to publish the specified audio effect in a channel: - True: Publish the audio effect in the channel so that remote user can hear it. - False: Do not publish the audio effect in the channel.startPos- The playback position (ms) of the audio effect file.- Returns:
- - 0: Success. - < 0: Failure.
-
preloadEffectEx
Preloads a specified audio effect to a specified channel. This method preloads only one specified audio effect into the memory each time it is called. To preload multiple audio effects, call this method multiple times. After preloading, you can call {@link IAudioEffectManager#playEffect playEffect} to play the preloaded audio effect.- Parameters:
connection- The RtcConnection object.soundId- The ID of the audio effect.filePath- The absolute path of 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.- Returns:
- - 0: Success. - < 0: Failure.
-
preloadEffectEx
Preloads a specified audio effect to a specified channel. This method preloads only one specified audio effect into the memory each time it is called. To preload multiple audio effects, call this method multiple times. After preloading, you can call {@link IAudioEffectManager##playEffect() playEffect} to play the preloaded audio effect or call {@link IAudioEffectManager##playAllEffects() playAllEffects} to play all the preloaded audio effects.- Parameters:
connection- The RtcConnection object.soundId- The ID of the audio effect.filePath- The absolute path of the local audio effect file or the URLstartPos- The playback position (ms) of the audio effect file.- Returns:
- - 0: Success. - < 0: Failure.
-
stopEffect
int stopEffect(int soundId) Stops playing the specific audio effect.- Parameters:
soundId- The ID of the audio effect.- Returns:
- - 0: Success. - < 0: Failure.
-
stopAllEffects
int stopAllEffects()Stops playing all audio effects.- Returns:
- - 0: Success. - < 0: Failure.
-
preloadEffect
Preloads a specified audio effect. This method preloads only one specified audio effect into the memory each time it is called. To preload multiple audio effects, call this method multiple times. After preloading, you can call {@link IAudioEffectManager#playEffect playEffect} to play the preloaded audio effect.- Parameters:
soundId- The ID of the audio effect.filePath- The absolute path of 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.- Returns:
- - 0: Success. - < 0: Failure.
-
preloadEffect
Preloads a specified audio effect. This method preloads only one specified audio effect into the memory each time it is called. To preload multiple audio effects, call this method multiple times. After preloading, you can call {@link IAudioEffectManager##playEffect() playEffect} to play the preloaded audio effect or call {@link IAudioEffectManager##playAllEffects() playAllEffects} to play all the preloaded audio effects.- Parameters:
soundId- The ID of the audio effect.filePath- The absolute path of the local audio effect file or the URLstartPos- The playback position (ms) of the audio effect file.- Returns:
- - 0: Success. - < 0: Failure.
-
unloadEffect
int unloadEffect(int soundId) Releases the specific preloaded audio effect from the memory.- Parameters:
soundId- The ID of the audio effect.- Returns:
- - 0: Success. - < 0: Failure.
-
pauseEffect
int pauseEffect(int soundId) Pauses playing the specified audio effect.- Parameters:
soundId- The ID of the audio effect.- Returns:
- - 0: Success. - < 0: Failure.
-
pauseAllEffects
int pauseAllEffects()Pauses playing all audio effects.- Returns:
- - 0: Success. - < 0: Failure.
-
resumeEffect
int resumeEffect(int soundId) Resumes playing the specific audio effect.- Parameters:
soundId- The ID of the audio effect.- Returns:
- - 0: Success. - < 0: Failure.
-
resumeAllEffects
int resumeAllEffects()Resumes playing all audio effects.- Returns:
- - 0: Success. - < 0: Failure.
-