Last active
May 27, 2018 03:22
-
-
Save kheldiente/2b7dc2cd46cc5aa7935556f79c210e11 to your computer and use it in GitHub Desktop.
Get Equalizer values
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private var equalizer: Equalizer? = null | |
private fun initEqualizer() { | |
equalizer = Equalizer(0, mediaPlayer?.audioSessionId!!) | |
equalizer?.enabled = eqEnabled | |
} | |
private fun setupEqualizer() { | |
val numberOfBands = equalizer?.numberOfBands | |
val lowestBandLevel = equalizer?.bandLevelRange?.get(0 | |
val highestBandLevel = equalizer?.bandLevelRange?.get(1) | |
var bands = ArrayList<Integer>(0) | |
// Get center frequency for each band | |
(0 until numberOfBands!!) | |
.map { equalizer?.getCenterFreq(it.toShort()) } | |
.mapTo(bands) { Integer(it?.div(1000)!!) } | |
... Other equalizer view stuff | |
} | |
private fun setBandLevel(bandId: Short, level: Short) { | |
equalizer?.setBandLevel(bandId, level) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment