|
| 1 | +package com.herewhite.rtc.demo; |
| 2 | + |
| 3 | +import android.util.Log; |
| 4 | + |
| 5 | +import com.herewhite.sdk.AudioEffectBridge; |
| 6 | + |
| 7 | +import io.agora.rtc.IAudioEffectManager; |
| 8 | +import io.agora.rtc.RtcEngine; |
| 9 | + |
| 10 | +public class AgoraAudioEffectBridge implements AudioEffectBridge { |
| 11 | + private String TAG = "AgoraAudioEffectBridge"; |
| 12 | + |
| 13 | + private final IAudioEffectManager audioEffectManager; |
| 14 | + |
| 15 | + public AgoraAudioEffectBridge(RtcEngine rtcEngine) { |
| 16 | + this.audioEffectManager = rtcEngine.getAudioEffectManager(); |
| 17 | + } |
| 18 | + |
| 19 | + @Override |
| 20 | + public double getEffectsVolume() { |
| 21 | + return audioEffectManager.getEffectsVolume(); |
| 22 | + } |
| 23 | + |
| 24 | + @Override |
| 25 | + public int setEffectsVolume(double volume) { |
| 26 | + Log.i(TAG, "setEffectsVolume: " + volume); |
| 27 | + return audioEffectManager.setEffectsVolume(volume); |
| 28 | + } |
| 29 | + |
| 30 | + @Override |
| 31 | + public int setVolumeOfEffect(int soundId, double volume) { |
| 32 | + Log.i(TAG, "setVolumeOfEffect: " + soundId + " " + volume); |
| 33 | + return audioEffectManager.setVolumeOfEffect(soundId, volume); |
| 34 | + } |
| 35 | + |
| 36 | + @Override |
| 37 | + public int playEffect(int soundId, String filePath, int loopCount, double pitch, double pan, double gain, boolean publish, int startPos) { |
| 38 | + Log.i(TAG, "playEffect: " + soundId + " " + filePath + " " + loopCount + " " + pitch + " " + pan + " " + gain + " " + publish + " " + startPos); |
| 39 | + return audioEffectManager.playEffect(soundId, filePath, loopCount, pitch, pan, gain, publish, startPos); |
| 40 | + } |
| 41 | + |
| 42 | + @Override |
| 43 | + public int stopEffect(int soundId) { |
| 44 | + Log.i(TAG, "stopEffect: " + soundId); |
| 45 | + return audioEffectManager.stopEffect(soundId); |
| 46 | + } |
| 47 | + |
| 48 | + @Override |
| 49 | + public int stopAllEffects() { |
| 50 | + Log.i(TAG, "stopAllEffects: "); |
| 51 | + return audioEffectManager.stopAllEffects(); |
| 52 | + } |
| 53 | + |
| 54 | + @Override |
| 55 | + public int preloadEffect(int soundId, String filePath, int startPos) { |
| 56 | + Log.i(TAG, "preloadEffect: " + soundId + " " + filePath + " " + startPos); |
| 57 | + return audioEffectManager.preloadEffect(soundId, filePath); |
| 58 | + } |
| 59 | + |
| 60 | + @Override |
| 61 | + public int unloadEffect(int soundId) { |
| 62 | + Log.i(TAG, "unloadEffect: " + soundId); |
| 63 | + return audioEffectManager.unloadEffect(soundId); |
| 64 | + } |
| 65 | + |
| 66 | + @Override |
| 67 | + public int pauseEffect(int soundId) { |
| 68 | + Log.i(TAG, "pauseEffect: " + soundId); |
| 69 | + return audioEffectManager.pauseEffect(soundId); |
| 70 | + } |
| 71 | + |
| 72 | + @Override |
| 73 | + public int pauseAllEffects() { |
| 74 | + Log.i(TAG, "pauseAllEffects: "); |
| 75 | + return audioEffectManager.pauseAllEffects(); |
| 76 | + } |
| 77 | + |
| 78 | + @Override |
| 79 | + public int resumeEffect(int soundId) { |
| 80 | + Log.i(TAG, "resumeEffect: " + soundId); |
| 81 | + return audioEffectManager.resumeEffect(soundId); |
| 82 | + } |
| 83 | + |
| 84 | + @Override |
| 85 | + public int resumeAllEffects() { |
| 86 | + Log.i(TAG, "resumeAllEffects: "); |
| 87 | + return audioEffectManager.resumeAllEffects(); |
| 88 | + } |
| 89 | + |
| 90 | + @Override |
| 91 | + public int getEffectDuration(String filePath) { |
| 92 | + Log.i(TAG, "getEffectDuration: " + filePath); |
| 93 | + return audioEffectManager.getEffectDuration(filePath); |
| 94 | + } |
| 95 | + |
| 96 | + @Override |
| 97 | + public int setEffectPosition(int soundId, int pos) { |
| 98 | + Log.i(TAG, "setEffectPosition: " + soundId + " " + pos); |
| 99 | + return audioEffectManager.setEffectPosition(soundId, pos); |
| 100 | + } |
| 101 | + |
| 102 | + @Override |
| 103 | + public int getEffectCurrentPosition(int soundId) { |
| 104 | + // Log.i(TAG, "getEffectCurrentPosition: " + soundId); |
| 105 | + return audioEffectManager.getEffectCurrentPosition(soundId); |
| 106 | + } |
| 107 | +} |
0 commit comments