Skip to content

Commit

Permalink
fix: Fixed EQ band out-of-range crash
Browse files Browse the repository at this point in the history
  • Loading branch information
timschneeb committed Aug 1, 2023
1 parent b33784a commit 2eccc97
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
1 change: 1 addition & 0 deletions .idea/gradle.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import androidx.core.content.withStyledAttributes
import androidx.core.os.bundleOf
import me.timschneeberger.rootlessjamesdsp.utils.extensions.CompatExtensions.getParcelableAs
import me.timschneeberger.rootlessjamesdsp.utils.extensions.prettyNumberFormat
import timber.log.Timber
import java.util.Locale
import kotlin.math.abs
import kotlin.math.exp
Expand Down Expand Up @@ -231,6 +232,11 @@ abstract class BaseEqualizerSurface(
}

fun setBand(i: Int, value: Double) {
if(i < 0 || i >= bandsNum) {
Timber.e("setBand($i): $i is out of range")
return
}

mLevels[i] = value
postInvalidate()
}
Expand Down

0 comments on commit 2eccc97

Please sign in to comment.