Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

how to set height of bar #21

Open
h4h13 opened this issue Jan 24, 2016 · 1 comment
Open

how to set height of bar #21

h4h13 opened this issue Jan 24, 2016 · 1 comment

Comments

@h4h13
Copy link

h4h13 commented Jan 24, 2016

i know it will change the height of the bars by sound inc but i want change little bit height how i can i change

@khavnu
Copy link

khavnu commented May 10, 2016

Hi @h4h13, this is my trick:
If you use BarGraphRenderer, you can change height of bars(in my case increase 5 times for bottom bar):

` @OverRide
public void onRender(Canvas canvas, FFTData data, Rect rect)
{
for (int i = 0; i < data.bytes.length / mDivisions; i++) {
mFFTPoints[i * 4] = i * 4 * mDivisions;
mFFTPoints[i * 4 + 2] = i * 4 * mDivisions;
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));

  if(mTop)
  {
    mFFTPoints[i * 4 + 1] = 0;
    mFFTPoints[i * 4 + 3] = (dbValue * 2 - 10);
  }
  else
  {
     //PhamVanKha increase bar height 5 times
    mFFTPoints[i * 4 + 1] = rect.height();
    mFFTPoints[i * 4 + 3] = rect.height() - (dbValue * 2 - 10) * 5;
  }
}

canvas.drawLines(mFFTPoints, mPaint);

}`

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants