Commit a621a144 authored by Pawit Pornkitprasan's avatar Pawit Pornkitprasan
Browse files

EqualizerView: don't compute log(0)

Because log(0) is undefined (turns out to be -2147483008.000000)
and that crashses on 480x800 hdpi

Change-Id: I41956944497c83214ee8e8378bc0924171633f21
parent 40030b0a
......@@ -94,7 +94,7 @@ public class EqualizerView extends VisualizerView {
byte rfk = data.bytes[mDivisions * i];
byte ifk = data.bytes[mDivisions * i + 1];
float magnitude = (rfk * rfk + ifk * ifk);
int dbValue = (int) (10 * Math.log10(magnitude));
int dbValue = magnitude > 0 ? (int) (10 * Math.log10(magnitude)) : 0;
mFFTPoints[i * 4 + 1] = rect.height();
mFFTPoints[i * 4 + 3] = rect.height() - (dbValue * mDbFuzzFactor + mDbFuzz);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment