27
27
import static io .agora .rtc2 .Constants .ULTRA_HIGH_QUALITY_VOICE ;
28
28
import static io .agora .rtc2 .Constants .VOICE_BEAUTIFIER_OFF ;
29
29
import static io .agora .rtc2 .Constants .VOICE_CHANGER_BASS ;
30
+ import static io .agora .rtc2 .Constants .VOICE_CHANGER_CARTOON ;
31
+ import static io .agora .rtc2 .Constants .VOICE_CHANGER_CHILDLIKE ;
32
+ import static io .agora .rtc2 .Constants .VOICE_CHANGER_CHIPMUNK ;
33
+ import static io .agora .rtc2 .Constants .VOICE_CHANGER_DARTH_VADER ;
30
34
import static io .agora .rtc2 .Constants .VOICE_CHANGER_EFFECT_BOY ;
31
35
import static io .agora .rtc2 .Constants .VOICE_CHANGER_EFFECT_GIRL ;
32
36
import static io .agora .rtc2 .Constants .VOICE_CHANGER_EFFECT_HULK ;
33
37
import static io .agora .rtc2 .Constants .VOICE_CHANGER_EFFECT_OLDMAN ;
34
38
import static io .agora .rtc2 .Constants .VOICE_CHANGER_EFFECT_PIGKING ;
35
39
import static io .agora .rtc2 .Constants .VOICE_CHANGER_EFFECT_SISTER ;
36
40
import static io .agora .rtc2 .Constants .VOICE_CHANGER_EFFECT_UNCLE ;
41
+ import static io .agora .rtc2 .Constants .VOICE_CHANGER_GIRLISH_MAN ;
42
+ import static io .agora .rtc2 .Constants .VOICE_CHANGER_GROOT ;
43
+ import static io .agora .rtc2 .Constants .VOICE_CHANGER_IRON_LADY ;
44
+ import static io .agora .rtc2 .Constants .VOICE_CHANGER_MONSTER ;
37
45
import static io .agora .rtc2 .Constants .VOICE_CHANGER_NEUTRAL ;
46
+ import static io .agora .rtc2 .Constants .VOICE_CHANGER_PHONE_OPERATOR ;
47
+ import static io .agora .rtc2 .Constants .VOICE_CHANGER_SHIN_CHAN ;
38
48
import static io .agora .rtc2 .Constants .VOICE_CHANGER_SOLID ;
39
49
import static io .agora .rtc2 .Constants .VOICE_CHANGER_SWEET ;
50
+ import static io .agora .rtc2 .Constants .VOICE_CHANGER_TRANSFORMERS ;
40
51
import static io .agora .rtc2 .Constants .VOICE_CONVERSION_OFF ;
41
52
42
53
import android .content .Context ;
@@ -97,7 +108,7 @@ public class VoiceEffects extends BaseFragment implements View.OnClickListener,
97
108
chatBeautifier , timbreTransformation , voiceChanger , styleTransformation , roomAcoustics , pitchCorrection , _pitchModeOption , _pitchValueOption , voiceConversion ,
98
109
customBandFreq , customReverbKey ;
99
110
private ViewGroup _voice3DLayout , _pitchModeLayout , _pitchValueLayout ;
100
- private SeekBar _voice3DCircle , customPitch , customBandGain , customReverbValue ;
111
+ private SeekBar _voice3DCircle , customPitch , customBandGain , customReverbValue , customVoiceFormant ;
101
112
102
113
private AudioSeatManager audioSeatManager ;
103
114
@@ -159,10 +170,12 @@ public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceStat
159
170
customBandGain = view .findViewById (R .id .audio_custom_band_gain ); // engine.setLocalVoiceEqualization()
160
171
customReverbKey = view .findViewById (R .id .audio_custom_reverb_key );
161
172
customReverbValue = view .findViewById (R .id .audio_custom_reverb_value ); //engine.setLocalVoiceReverb()
173
+ customVoiceFormant = view .findViewById (R .id .audio_voice_formant_value ); //engine.setLocalVoiceFormant()
162
174
163
175
customPitch .setOnSeekBarChangeListener (this );
164
176
customBandGain .setOnSeekBarChangeListener (this );
165
177
customReverbValue .setOnSeekBarChangeListener (this );
178
+ customVoiceFormant .setOnSeekBarChangeListener (this );
166
179
customBandFreq .setOnItemSelectedListener (this );
167
180
customReverbKey .setOnItemSelectedListener (this );
168
181
@@ -194,6 +207,7 @@ private void resetControlLayoutByJoined() {
194
207
customBandGain .setEnabled (joined );
195
208
customReverbKey .setEnabled (joined );
196
209
customReverbValue .setEnabled (joined );
210
+ customVoiceFormant .setEnabled (joined );
197
211
198
212
199
213
chatBeautifier .setSelection (0 );
@@ -206,6 +220,7 @@ private void resetControlLayoutByJoined() {
206
220
customPitch .setProgress (0 );
207
221
customBandGain .setProgress (0 );
208
222
customReverbValue .setProgress (0 );
223
+ customVoiceFormant .setProgress (50 );
209
224
}
210
225
211
226
@ Override
@@ -407,8 +422,8 @@ private void joinChannel(String channelId) {
407
422
private final IRtcEngineEventHandler iRtcEngineEventHandler = new IRtcEngineEventHandler () {
408
423
/**
409
424
* Error code description can be found at:
410
- * en: https://api-ref.agora.io/en/voice -sdk/android/4.x/API/class_irtcengineeventhandler.html#callback_irtcengineeventhandler_onerror
411
- * cn: https://docs.agora.io/cn/voice -call-4.x/API%20Reference/java_ng/API/class_irtcengineeventhandler.html#callback_irtcengineeventhandler_onerror
425
+ * en: https://api-ref.agora.io/en/video -sdk/android/4.x/API/class_irtcengineeventhandler.html#callback_irtcengineeventhandler_onerror
426
+ * cn: https://docs.agora.io/cn/video -call-4.x/API%20Reference/java_ng/API/class_irtcengineeventhandler.html#callback_irtcengineeventhandler_onerror
412
427
*/
413
428
@ Override
414
429
public void onError (int err ) {
@@ -617,6 +632,28 @@ private int getVoiceConversionValue(String label) {
617
632
return VOICE_CHANGER_SOLID ;
618
633
case "VOICE_CHANGER_BASS" :
619
634
return VOICE_CHANGER_BASS ;
635
+ case "VOICE_CHANGER_CARTOON" :
636
+ return VOICE_CHANGER_CARTOON ;
637
+ case "VOICE_CHANGER_CHILDLIKE" :
638
+ return VOICE_CHANGER_CHILDLIKE ;
639
+ case "VOICE_CHANGER_PHONE_OPERATOR" :
640
+ return VOICE_CHANGER_PHONE_OPERATOR ;
641
+ case "VOICE_CHANGER_MONSTER" :
642
+ return VOICE_CHANGER_MONSTER ;
643
+ case "VOICE_CHANGER_TRANSFORMERS" :
644
+ return VOICE_CHANGER_TRANSFORMERS ;
645
+ case "VOICE_CHANGER_GROOT" :
646
+ return VOICE_CHANGER_GROOT ;
647
+ case "VOICE_CHANGER_DARTH_VADER" :
648
+ return VOICE_CHANGER_DARTH_VADER ;
649
+ case "VOICE_CHANGER_IRON_LADY" :
650
+ return VOICE_CHANGER_IRON_LADY ;
651
+ case "VOICE_CHANGER_SHIN_CHAN" :
652
+ return VOICE_CHANGER_SHIN_CHAN ;
653
+ case "VOICE_CHANGER_GIRLISH_MAN" :
654
+ return VOICE_CHANGER_GIRLISH_MAN ;
655
+ case "VOICE_CHANGER_CHIPMUNK" :
656
+ return VOICE_CHANGER_CHIPMUNK ;
620
657
case "VOICE_CONVERSION_OFF" :
621
658
default :
622
659
return VOICE_CONVERSION_OFF ;
@@ -743,6 +780,9 @@ public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
743
780
744
781
@ Override
745
782
public void onProgressChanged (SeekBar seekBar , int progress , boolean fromUser ) {
783
+ if (!fromUser ) {
784
+ return ;
785
+ }
746
786
if (seekBar == _voice3DCircle ){
747
787
int cicle = (int ) (1 + 59 * progress * 1.0f / seekBar .getMax ());
748
788
// [1,60], 10 default
@@ -771,6 +811,10 @@ public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
771
811
value = (int ) (100 * progress * 1.0f / seekBar .getMax ());
772
812
}
773
813
engine .setLocalVoiceReverb (reverbKey , value );
814
+ } else if (seekBar == customVoiceFormant ) {
815
+ // [-1, 1]
816
+ double value = (progress - 50 ) * 1.0f / 100 ;
817
+ engine .setLocalVoiceFormant (value );
774
818
}
775
819
}
776
820
0 commit comments