Mercurial > jmeCapture
annotate src/com/aurellem/capture/IsoTimer.java @ 23:b643413c3aba
going to improve WaveFileWriter
author | Robert McIntyre <rlm@mit.edu> |
---|---|
date | Sun, 30 Oct 2011 04:22:14 -0700 |
parents | edaa7e7806e4 |
children | 6484a820e27d |
rev | line source |
---|---|
rlm@4 | 1 package com.aurellem.capture; |
rlm@4 | 2 |
rlm@4 | 3 import com.jme3.system.Timer; |
rlm@4 | 4 |
rlm@4 | 5 public class IsoTimer extends Timer { |
rlm@4 | 6 |
rlm@4 | 7 private float framerate; |
rlm@4 | 8 private int ticks; |
rlm@4 | 9 |
rlm@4 | 10 public IsoTimer(float framerate){ |
rlm@4 | 11 this.framerate = framerate; |
rlm@4 | 12 this.ticks = 0;} |
rlm@4 | 13 |
rlm@4 | 14 public long getTime() { |
rlm@4 | 15 return (long) (this.ticks / this.framerate);} |
rlm@4 | 16 |
rlm@4 | 17 public long getResolution() { |
rlm@4 | 18 return 1000000000L;} |
rlm@4 | 19 |
rlm@4 | 20 public float getFrameRate() { |
rlm@4 | 21 return this.framerate;} |
rlm@4 | 22 |
rlm@4 | 23 public float getTimePerFrame() { |
rlm@4 | 24 return (float) (1.0f / this.framerate);} |
rlm@4 | 25 |
rlm@4 | 26 public void update() {this.ticks++;} |
rlm@4 | 27 |
rlm@4 | 28 public void reset() {this.ticks = 0;} |
rlm@4 | 29 |
rlm@4 | 30 } |