Android Open Source - audio-analyzer-for-android Frames Per Second Counter






From Project

Back to project page audio-analyzer-for-android.

License

The source code is released under:

Apache License

If you think the Android project audio-analyzer-for-android listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package com.google.corp.productivity.specialprojects.android.samples.fft;
/*from w w  w. j a va 2 s.  co m*/
import android.os.SystemClock;
import android.util.Log;

public class FramesPerSecondCounter {
  long frameCount;
  long timeOld, timeUpdateInterval;  // in ms
  double fps;
  String TAG_OUTSIDE;
  
  FramesPerSecondCounter(String TAG) {
    timeUpdateInterval = 2000;
    TAG_OUTSIDE = TAG;
    frameCount = 0;
    timeOld = SystemClock.uptimeMillis();
  }
  
  // call this when number of frames plus one
  public void inc() {
    frameCount++;
    long timeNow = SystemClock.uptimeMillis();
    if (timeOld + timeUpdateInterval <= timeNow) {
      fps = 1000 * (double) frameCount / (timeNow - timeOld);
      Log.i(TAG_OUTSIDE, "FPS: " + Math.round(100*fps)/100.0 +
            " (" + frameCount + "/" + (timeNow - timeOld) + "ms)");
      timeOld = timeNow;
      frameCount = 0;
    }
  }
  
  public double getFPS() {
    return fps;
  }
}




Java Source Code List

com.google.corp.productivity.specialprojects.android.fft.RealDoubleFFT_Mixed.java
com.google.corp.productivity.specialprojects.android.fft.RealDoubleFFT.java
com.google.corp.productivity.specialprojects.android.samples.fft.AnalyzeActivity.java
com.google.corp.productivity.specialprojects.android.samples.fft.AnalyzeView.java
com.google.corp.productivity.specialprojects.android.samples.fft.ColorMapArray.java
com.google.corp.productivity.specialprojects.android.samples.fft.DoubleSineGen.java
com.google.corp.productivity.specialprojects.android.samples.fft.FramesPerSecondCounter.java
com.google.corp.productivity.specialprojects.android.samples.fft.InfoRecActivity.java
com.google.corp.productivity.specialprojects.android.samples.fft.MyPreferences.java
com.google.corp.productivity.specialprojects.android.samples.fft.RecorderMonitor.java
com.google.corp.productivity.specialprojects.android.samples.fft.SBNumFormat.java
com.google.corp.productivity.specialprojects.android.samples.fft.STFT.java
com.google.corp.productivity.specialprojects.android.samples.fft.SelectorText.java
com.google.corp.productivity.specialprojects.android.samples.fft.WavWriter.java