artisynth.core.util
Class TimeBase

java.lang.Object
  extended by artisynth.core.util.TimeBase

public class TimeBase
extends java.lang.Object

Converts between basic Artisynth time units (ticks) and seconds, milliseconds, microseconds, and frequency. The basic time tick is a sub-nanosecond quantity chosen to allow the time intervals associated with standard audio frequencies (i.e., 48kHz, 44.1khz, 32khz, etc.), as well as those which are multiples of 1 microsecond, to be represented as long integers.


Field Summary
static double PRECISION
          Reciprocal of the smallest time unit used by round(double).
 
Constructor Summary
TimeBase()
           
 
Method Summary
static int compare(double t0, double t1)
          Compares t0 and t1 within the tolerance specified by the reciprocal of PRECISION.
static boolean equals(double t0, double t1)
          Returns true if t0 and t1 are equal within the tolerance specified by PRECISION.
static void main(java.lang.String[] args)
           
static double modulo(double t0, double t1)
          Returns t0 modulo t1, within the tolerance specified by PRECISION.
static double round(double t)
          Rounds t to the nearst PRECISION seconds.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PRECISION

public static final double PRECISION
Reciprocal of the smallest time unit used by round(double).

See Also:
Constant Field Values
Constructor Detail

TimeBase

public TimeBase()
Method Detail

round

public static double round(double t)
Rounds t to the nearst PRECISION seconds.

Returns:
rounded value of t.

equals

public static boolean equals(double t0,
                             double t1)
Returns true if t0 and t1 are equal within the tolerance specified by PRECISION.

Returns:
true if t0 and t1 are equal within tolerance

modulo

public static double modulo(double t0,
                            double t1)
Returns t0 modulo t1, within the tolerance specified by PRECISION.

Returns:
t0 % t1 within PRECISION.

compare

public static int compare(double t0,
                          double t1)
Compares t0 and t1 within the tolerance specified by the reciprocal of PRECISION. Returns an integer which is less than, equal, or greater than 0 if t0 is less than, equal, or greater than t1.

Returns:
integer comparing t0 and t1

main

public static void main(java.lang.String[] args)