Add audio effect: loli and uncle

dev
xufuji456 3 years ago
parent 6dd2338a9b
commit 74dca79a8f
  1. 8
      app/src/main/java/com/frank/ffmpeg/activity/EqualizerActivity.kt
  2. 14
      app/src/main/res/layout/activity_equalizer.xml

@ -60,12 +60,16 @@ class EqualizerActivity : BaseActivity(), OnSeeBarListener {
val effectEcho: RadioButton = findViewById(R.id.btn_effect_echo) val effectEcho: RadioButton = findViewById(R.id.btn_effect_echo)
val effectFunny: RadioButton = findViewById(R.id.btn_effect_funny) val effectFunny: RadioButton = findViewById(R.id.btn_effect_funny)
val effectTremolo: RadioButton = findViewById(R.id.btn_effect_tremolo) val effectTremolo: RadioButton = findViewById(R.id.btn_effect_tremolo)
val effectLolita: RadioButton = findViewById(R.id.btn_effect_lolita)
val effectUncle: RadioButton = findViewById(R.id.btn_effect_uncle)
val effectGroup: RadioGroup = findViewById(R.id.group_audio_effect) val effectGroup: RadioGroup = findViewById(R.id.group_audio_effect)
effectGroup.setOnCheckedChangeListener { group, checkedId -> effectGroup.setOnCheckedChangeListener { group, checkedId ->
when (checkedId) { when (checkedId) {
effectEcho.id -> doAudioEffect(0) effectEcho.id -> doAudioEffect(0)
effectFunny.id -> doAudioEffect(1) effectFunny.id -> doAudioEffect(1)
effectTremolo.id -> doAudioEffect(2) effectTremolo.id -> doAudioEffect(2)
effectLolita.id -> doAudioEffect(3)
effectUncle.id -> doAudioEffect(4)
} }
} }
} }
@ -117,6 +121,8 @@ class EqualizerActivity : BaseActivity(), OnSeeBarListener {
0 -> "aecho=0.8:0.8:1000:0.5" 0 -> "aecho=0.8:0.8:1000:0.5"
1 -> "atempo=2" 1 -> "atempo=2"
2 -> "tremolo=5:0.9" 2 -> "tremolo=5:0.9"
3 -> "asetrate=44100*1.4,aresample=44100,atempo=1/1.4"
4 -> "asetrate=44100*0.6,aresample=44100,atempo=1/0.6"
else -> { else -> {
"" ""
} }
@ -126,7 +132,7 @@ class EqualizerActivity : BaseActivity(), OnSeeBarListener {
private fun doAudioEffect(index: Int) { private fun doAudioEffect(index: Int) {
var effect = getAudioEffect(index) var effect = getAudioEffect(index)
if (effect.isEmpty()) return if (effect.isEmpty()) return
val filter = ",superequalizer=6b=4:8b=5:10b=5" val filter = ",superequalizer=8b=5"
effect += filter effect += filter
if (filterThread == null) { if (filterThread == null) {
filterThread = Thread(Runnable { filterThread = Thread(Runnable {

@ -39,6 +39,20 @@
android:text="@string/audio_effect_tremolo" android:text="@string/audio_effect_tremolo"
android:layout_marginStart="5dp"/> android:layout_marginStart="5dp"/>
<RadioButton
android:id="@+id/btn_effect_lolita"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/audio_effect_lolita"
android:layout_marginStart="5dp"/>
<RadioButton
android:id="@+id/btn_effect_uncle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/audio_effect_uncle"
android:layout_marginStart="5dp"/>
</RadioGroup> </RadioGroup>
<TextView <TextView

Loading…
Cancel
Save