# HG changeset patch # User Robert McIntyre # Date 1326625837 25200 # Node ID df4a2d12ea1321531a8ac3f66cc41817bedb8c99 # Parent f5e52169f056c9bba5153c45cc63772e110c6982 added new timer for debugging purposes diff -r f5e52169f056 -r df4a2d12ea13 src/com/aurellem/capture/RatchetTimer.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/com/aurellem/capture/RatchetTimer.java Sun Jan 15 04:10:37 2012 -0700 @@ -0,0 +1,56 @@ +package com.aurellem.capture; + +import com.jme3.system.Timer; + +/** + * RatchetTimer is the same as IsoTimer, except that it will ensure + * that the simulation does not proceed any faster than it would had + * NanoTimer been used. + * + * @author normenhansen, Robert McIntyre + */ + +public class RatchetTimer extends Timer{ + private float framerate; + private int ticks; + private long lastTime = 0; + + public RatchetTimer(float framerate) { + this.framerate = framerate; + this.ticks = 0; + } + + public long getTime() { + return (long) (this.ticks * (1.0f / this.framerate) * 1000f); + } + + public long getResolution() { + return 1000000000L; + } + + public float getFrameRate() { + return this.framerate; + } + + public float getTimePerFrame() { + return (float) (1.0f / this.framerate); + } + + public void update() { + long time = System.currentTimeMillis(); + long difference = time - lastTime; + lastTime = time; + if (difference < (1.0f / this.framerate) * 1000.0f) { + try { + Thread.sleep(difference); + } catch (InterruptedException ex) { + } + } + this.ticks++; + } + + public void reset() { + this.ticks = 0; + } +} + diff -r f5e52169f056 -r df4a2d12ea13 transcoding.txt --- a/transcoding.txt Wed Dec 14 17:43:52 2011 -0700 +++ b/transcoding.txt Sun Jan 15 04:10:37 2012 -0700 @@ -1,4 +1,4 @@ -ffmpeg -r 60 -b 5000k -i out/%07d.png out.ogg +ffmpeg -r 60 -b 9000k -i out/%07d.png out.ogg