Minor simplification

This commit is contained in:
dotmg 2026-02-17 07:46:12 +01:00
parent 2cc1f230f4
commit d217017796

View file

@ -7,11 +7,6 @@ class MidiSequence(val resolution: Int = 60) {
val out: MutableList<Byte> = mutableListOf<Byte>()
private var lastTick = 0L
fun getDeltaAndSync(channel: Int, currentTick: Long): Long {
val delta = currentTick - lastTick
lastTick = currentTick
return delta
}
fun createTrack(): MutableList<Byte> {
val newTrack = mutableListOf<Byte>()
tracks.add(newTrack)
@ -45,7 +40,8 @@ class MidiSequence(val resolution: Int = 60) {
}
fun MutableList<Byte>.addNote(channel: Int, pitch: Int, currentTick: Long, type: Int = 80, finalVelocity: Int = 100) {
// Calcul du Delta-Time
val delta = getDeltaAndSync(channel, currentTick)
val delta = currentTick - lastTick
lastTick = currentTick
val status = if (type == 80) (0x80 or channel) else (0x90 or channel)