public float ComputePower(short[] buf, ToneDetector td) { double power = 0; for (int i = 0; i < buf.length; i++) { double v = td.GetTone((double) buf[i]); power += v * v; } return (float) Math.sqrt(power / buf.length); }
// 2756.25 public void DrawFilteredWave(Canvas canvas, float x, float y, ToneDetector td, Paint p) { final int scale = 32; int old = 0; int nue; int j = 0; for (int i = 1; i < m_buffer.length; i++) { nue = (int) (td.GetTone(m_buffer[i]) / scale); canvas.drawLine(x + i - 1, y - old, x + i, y - nue, p); old = nue; } }
public void FilterWave(short[] in, short[] out, ToneDetector td) { for (int i = 0; i < in.length; i++) { out[i] = (short) (td.GetTone(in[i])); } }