diff --git a/composeApp/src/commonMain/kotlin/mg/dot/feufaro/midi/MidiSequence.kt b/composeApp/src/commonMain/kotlin/mg/dot/feufaro/midi/MidiSequence.kt index fe8e8d7..1b65aee 100644 --- a/composeApp/src/commonMain/kotlin/mg/dot/feufaro/midi/MidiSequence.kt +++ b/composeApp/src/commonMain/kotlin/mg/dot/feufaro/midi/MidiSequence.kt @@ -7,11 +7,6 @@ class MidiSequence(val resolution: Int = 60) { val out: MutableList = mutableListOf() private var lastTick = 0L - fun getDeltaAndSync(channel: Int, currentTick: Long): Long { - val delta = currentTick - lastTick - lastTick = currentTick - return delta - } fun createTrack(): MutableList { val newTrack = mutableListOf() tracks.add(newTrack) @@ -45,7 +40,8 @@ class MidiSequence(val resolution: Int = 60) { } fun MutableList.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) @@ -83,7 +79,7 @@ class MidiSequence(val resolution: Int = 60) { out.write16Bit(1) // 4. Nombre de pistes (16 bits) - out.write16Bit(trackCount) + out.write16Bit(trackCount) // 5. Division / Résolution (16 bits) // Ticks par noire (votre variable 'resolution')