public class Tempo
extends java.lang.Object
Tempo
object tracks the speed of the music data. That is, the rate at which quarter notes occur.Modifier and Type | Field and Description |
---|---|
private int |
microSecondsPerQuarter
The number of microseconds which pass per quarter note in the song.
|
Constructor and Description |
---|
Tempo()
Create a default tempo - 120 QPM
|
Tempo(byte[] data)
Create a new Tempo from the given data array.
|
Tempo(int qpm)
Create a new Tempo with the given number of quarter notes per minute.
|
Modifier and Type | Method and Description |
---|---|
static int |
calculateMicroSecondsPerQuarter(byte[] data)
Calculate the number of microseconds per quarter note based on the given data array.
|
boolean |
equals(java.lang.Object other) |
int |
getMicroSecondsPerQuarter()
Gets the number of microseconds which pass per quarter note.
|
int |
hashCode() |
java.lang.String |
toString() |
private final int microSecondsPerQuarter
public Tempo()
public Tempo(byte[] data)
data
- calculateMicroSecondsPerQuarter(byte[])
public Tempo(int qpm)
qpm
- The number of quarter notes per minute.public int getMicroSecondsPerQuarter()
microSecondsPerQuarter
public static int calculateMicroSecondsPerQuarter(byte[] data)
data
- The Midi byte array of the tempo data for microseconds/quarter. It is actually just represented as an int,
but it is grabbed from the file as a byte array, so we need this conversion.public java.lang.String toString()
toString
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
public boolean equals(java.lang.Object other)
equals
in class java.lang.Object