public class TimeTrackerNode
extends java.lang.Object
TimeTrackerNode
represents the state of a musical score at a given time. That is,
it represents a <TimeSignature
,
Tempo
, KeySignature
>
triple, and contains information about the times at which that triple is contiguously valid.Modifier and Type | Field and Description |
---|---|
private boolean |
isTimeSignatureDummy
Whether the Time Signature in this Node is a dummy first node or not.
|
private KeySignature |
keySignature
The KeySignature associated with this TimeTrackerNode.
|
private long |
startTick
The start tick for this TimeTrackerNode.
|
private long |
startTime
The start time for this TimeTrackerNode, measured in microseconds.
|
private Tempo |
tempo
The Tempo associated with this TimeTrackerNode.
|
private TimeSignature |
timeSignature
The TimeSignature associated with this TimeTrackerNode.
|
Constructor and Description |
---|
TimeTrackerNode(double ppq)
Create a new dummy first TimeTrackerNode at tick and time 0.
|
TimeTrackerNode(TimeTrackerNode prev,
long tick,
double ppq)
Create a new TimeTrackerNode with the given previous TimeTrackerNode at the given tick.
|
Modifier and Type | Method and Description |
---|---|
KeySignature |
getKeySignature()
Get the KeySignature of this node.
|
long |
getStartTick()
Get the start tick of this node.
|
long |
getStartTime()
Get the start time of this node.
|
Tempo |
getTempo()
Get the Tempo of this node.
|
long |
getTickAtTime(long time,
double ppq)
Get the tick number at the given time.
|
long |
getTimeAtTick(long tick,
double ppq)
Get the time at the given tick.
|
double |
getTimePerTick(double ppq)
Gets the amount of time, in microseconds, that passes between each tick.
|
TimeSignature |
getTimeSignature()
Get the TimeSignature of this node.
|
boolean |
isTimeSignatureDummy()
Get if this node has a dummy time signature.
|
void |
setIsTimeSignatureDummy(boolean dummy)
Set if this node's time signature is a dummy node.
|
void |
setKeySignature(KeySignature keySignature)
Set the KeySignature of this node.
|
void |
setTempo(Tempo tempo)
Set the Tempo of this node.
|
void |
setTimeSignature(TimeSignature timeSignature)
Set the TimeSignature of this node.
|
java.lang.String |
toString() |
private long startTick
private long startTime
private TimeSignature timeSignature
private Tempo tempo
private KeySignature keySignature
private boolean isTimeSignatureDummy
public TimeTrackerNode(double ppq)
ppq
- The pulses per quarter note of the song.public TimeTrackerNode(TimeTrackerNode prev, long tick, double ppq)
prev
- The previous TimeTrackerNode, cannot be null.ppq
- The pulses per quarter note of the song.tick
- The tick at which this new one becomes valid.public long getTickAtTime(long time, double ppq)
time
- The time at which we want the tick, measured in microseconds.ppq
- The pulses per quarter note of the song.public long getTimeAtTick(long tick, double ppq)
tick
- The tick at which we want the time.ppq
- The pulses per quarter note of the song.public double getTimePerTick(double ppq)
ppq
- The pulses per quarter note of the song.public long getStartTick()
startTick
public long getStartTime()
startTime
public void setTempo(Tempo tempo)
tempo
- public void setTimeSignature(TimeSignature timeSignature)
timeSignature
- timeSignature
public boolean isTimeSignatureDummy()
isTimeSignatureDummy
public void setIsTimeSignatureDummy(boolean dummy)
dummy
- isTimeSignatureDummy
public void setKeySignature(KeySignature keySignature)
keySignature
- public TimeSignature getTimeSignature()
timeSignature
public KeySignature getKeySignature()
keySignature
public java.lang.String toString()
toString
in class java.lang.Object