public class TimeStamp
extends java.lang.Object
AudioContext
. Specifically, the TimeStamp stores a time step and an index into a buffer.Modifier and Type | Field and Description |
---|---|
AudioContext |
context
The context.
|
int |
index
The index into the sample frame.
|
long |
timeStep
The time step (AudioContext's count of sample frames).
|
Constructor and Description |
---|
TimeStamp(AudioContext context,
long timeInSamples)
Instantiates a new TimeStamp with the given time step, context and buffer index.
|
TimeStamp(AudioContext context,
long timeStep,
int index)
Instantiates a new TimeStamp with the given time step, context and buffer index.
|
Modifier and Type | Method and Description |
---|---|
static TimeStamp |
add(AudioContext ac,
TimeStamp a,
TimeStamp b) |
double |
getTimeMS()
Gets the time of the TimeStamp in milliseconds.
|
long |
getTimeSamples()
Gets the time in samples.
|
boolean |
isAfter(TimeStamp other) |
boolean |
isBefore(TimeStamp other) |
double |
since(TimeStamp oldest) |
static TimeStamp |
subtract(AudioContext ac,
TimeStamp a,
TimeStamp b) |
public final AudioContext context
public final long timeStep
public final int index
public TimeStamp(AudioContext context, long timeStep, int index)
AudioContext.generateTimeStamp(int)
to generate a
TimeStamp for the current time.context
- the AudioContext.timeStep
- the time step.index
- the index.public TimeStamp(AudioContext context, long timeInSamples)
AudioContext.generateTimeStamp(int)
to generate a
TimeStamp for the current time.context
- the AudioContext.timeStep
- the time step.index
- the index.public double getTimeMS()
public long getTimeSamples()
public double since(TimeStamp oldest)
public boolean isBefore(TimeStamp other)
public boolean isAfter(TimeStamp other)
public static TimeStamp subtract(AudioContext ac, TimeStamp a, TimeStamp b)
public static TimeStamp add(AudioContext ac, TimeStamp a, TimeStamp b)