dasher
Class CFrameRate

java.lang.Object
  extended by dasher.CFrameRate

public class CFrameRate
extends java.lang.Object

Monitors the framerate by taking records every time NewFrame is called; this is used to control performance-specific features such as automatic speed control.


Field Summary
(package private)  double LN2
          Cache of the natural log of 2
private  double m_dFr
          Current frame rate
private  double m_dMaxbitrate
          Maximum rate of entering information
private  double m_dRXmax
          Maximum x movement per frame
private  int m_iFrames
          Number of frames elapsed
private  int m_iSamples
          Number of samples currently stored
private  int m_iSteps
          Not sure! Comments said "see djw thesis"
private  long m_iTime
          Time of the second-to-last frame
private  long m_iTime2
          Time of last frame
 
Constructor Summary
CFrameRate()
          Creates a new framerate monitor; all initial values are currently hard coded in.
 
Method Summary
 double Framerate()
          Gets current frame rate
 void Initialise()
          Resets all our internal values to the same defaults as are chosen in the constructor.
 long MinSize(long t)
          Gets the minimum size of the target viewport
 void NewFrame(long Time)
          Insert a new frame and recompute the frame rate, if enough samples have been gathered.
 void Reset(long Time)
          Clears our frame count
 double Rxmax()
          Gets maximum x movement per frame
 void SetBitrate(double TargetRate)
          Sets the max bitrate
 void SetMaxBitrate(double MaxRate)
          Sets the max bitrate
 int Steps()
          Gets m_iSteps; see its description
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

m_dFr

private double m_dFr
Current frame rate


m_dMaxbitrate

private double m_dMaxbitrate
Maximum rate of entering information


m_dRXmax

private double m_dRXmax
Maximum x movement per frame


m_iFrames

private int m_iFrames
Number of frames elapsed


m_iSamples

private int m_iSamples
Number of samples currently stored


m_iTime

private long m_iTime
Time of the second-to-last frame


m_iTime2

private long m_iTime2
Time of last frame


m_iSteps

private int m_iSteps
Not sure! Comments said "see djw thesis"


LN2

final double LN2
Cache of the natural log of 2

Constructor Detail

CFrameRate

public CFrameRate()
Creates a new framerate monitor; all initial values are currently hard coded in.

We start with a frame rate of 32FPS.

Method Detail

Rxmax

public double Rxmax()
Gets maximum x movement per frame

Returns:
m_dRXmax

MinSize

public long MinSize(long t)
Gets the minimum size of the target viewport

Parameters:
t - Current time
Returns:
Minimum size of target viewport

Steps

public int Steps()
Gets m_iSteps; see its description

Returns:
m_iSteps

Framerate

public double Framerate()
Gets current frame rate

Returns:
Frame rate (FPS)

Initialise

public void Initialise()
Resets all our internal values to the same defaults as are chosen in the constructor.


NewFrame

public void NewFrame(long Time)
Insert a new frame and recompute the frame rate, if enough samples have been gathered.

If this would result in a Steps parameter of 0 it is set to 1.

Parameters:
Time - Time at which the new frame began, as a UNIX timestamp.

Reset

public void Reset(long Time)
Clears our frame count

Parameters:
Time - System time as a UNIX timestamp.

SetBitrate

public void SetBitrate(double TargetRate)
Sets the max bitrate

Parameters:
TargetRate - New bitrate

SetMaxBitrate

public void SetMaxBitrate(double MaxRate)
Sets the max bitrate

Parameters:
MaxRate - New bitrate