set equalizer to enabled only if it is disabled
This commit is contained in:
parent
c5fc06280b
commit
985e03f828
2 changed files with 7 additions and 2 deletions
|
@ -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) {
|
||||
}
|
||||
|
||||
|
|
|
@ -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 {
|
||||
|
|
Loading…
Reference in a new issue