mirror of
https://github.com/xdsopl/robot36.git
synced 2026-01-04 07:29:55 +01:00
made the peak mater logarithmic
This commit is contained in:
parent
3f0177cfe2
commit
f921fd1295
|
|
@ -87,9 +87,11 @@ public class MainActivity extends AppCompatActivity {
|
|||
for (float v : recordBuffer)
|
||||
max = Math.max(max, Math.abs(v));
|
||||
int pixels = peakMeterBuffer.height;
|
||||
int peak = Math.min(Math.max(Math.round(max * pixels), 0), pixels);
|
||||
Arrays.fill(peakMeterBuffer.pixels, 0, pixels - peak, thin);
|
||||
Arrays.fill(peakMeterBuffer.pixels, pixels - peak, pixels, tint);
|
||||
int peak = pixels;
|
||||
if (max > 0)
|
||||
peak = (int) Math.round(Math.min(Math.max(-Math.PI*Math.log(max), 0), pixels));
|
||||
Arrays.fill(peakMeterBuffer.pixels, 0, peak, thin);
|
||||
Arrays.fill(peakMeterBuffer.pixels, peak, pixels, tint);
|
||||
peakMeterBitmap.setPixels(peakMeterBuffer.pixels, 0, peakMeterBuffer.width, 0, 0, peakMeterBuffer.width, peakMeterBuffer.height);
|
||||
peakMeterView.invalidate();
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue