Package io.agora.rtc2

Interface IAudioEffectManager


public interface IAudioEffectManager
Provides the methods to manage the audio effects.
  • Method Summary

    Modifier and Type
    Method
    Description
    double
    Gets the volume of the audio effects.
    int
    Pauses playing all audio effects.
    int
    pauseEffect(int soundId)
    Pauses playing the specified audio effect.
    int
    playEffect(int soundId, String filePath, int loop, double pitch, double pan, double gain)
    Plays a specified audio effect.
    int
    playEffect(int soundId, String filePath, int loopCount, double pitch, double pan, double gain, boolean publish)
    Plays a specified audio effect.
    int
    playEffect(int soundId, String filePath, int loopCount, double pitch, double pan, double gain, boolean publish, int startPos)
    Plays a specified audio effect.
    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.
    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.
    int
    preloadEffect(int soundId, String filePath)
    Preloads a specified audio effect.
    int
    preloadEffect(int soundId, String filePath, int startPos)
    Preloads a specified audio effect.
    int
    preloadEffectEx(RtcConnection connection, int soundId, String filePath)
    Preloads a specified audio effect to a specified channel.
    int
    preloadEffectEx(RtcConnection connection, int soundId, String filePath, int startPos)
    Preloads a specified audio effect to a specified channel.
    int
    Resumes playing all audio effects.
    int
    resumeEffect(int soundId)
    Resumes playing the specific audio effect.
    int
    setEffectsVolume(double volume)
    Sets the volume of audio effects.
    int
    setVolumeOfEffect(int soundId, double volume)
    Sets the volume of the specified audio effect.
    int
    Stops playing all audio effects.
    int
    stopEffect(int soundId)
    Stops playing the specific audio effect.
    int
    unloadEffect(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

      int playEffect(int soundId, String filePath, int loop, double pitch, double pan, double gain)
      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} or 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.
      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} or 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.
      startPos - The playback position (ms) of the audio effect file.
      Returns:
      - 0: Success. - < 0: Failure.
    • preloadEffectEx

      int preloadEffectEx(RtcConnection connection, int soundId, String filePath)
      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

      int preloadEffectEx(RtcConnection connection, int soundId, String filePath, int startPos)
      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 URL
      startPos - 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

      int preloadEffect(int soundId, String filePath)
      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

      int preloadEffect(int soundId, String filePath, int startPos)
      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 URL
      startPos - 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.