set equalizer to enabled only if it is disabled

This commit is contained in:
tibbi 2021-02-28 20:01:01 +01:00
parent c5fc06280b
commit 985e03f828
2 changed files with 7 additions and 2 deletions

View file

@ -42,7 +42,9 @@ class EqualizerActivity : SimpleActivity() {
val player = MusicService.mPlayer ?: MediaPlayer()
val equalizer = MusicService.mEqualizer ?: Equalizer(0, player.audioSessionId)
try {
equalizer.enabled = true
if (!equalizer.enabled) {
equalizer.enabled = true
}
} catch (e: IllegalStateException) {
}

View file

@ -353,7 +353,10 @@ class MusicService : Service(), MediaPlayer.OnPreparedListener, MediaPlayer.OnEr
try {
val preset = config.equalizerPreset
mEqualizer = Equalizer(0, mPlayer!!.audioSessionId)
mEqualizer!!.enabled = true
if (!mEqualizer!!.enabled) {
mEqualizer!!.enabled = true
}
if (preset != EQUALIZER_PRESET_CUSTOM) {
mEqualizer!!.usePreset(preset.toShort())
} else {