From aaee37d7f743e1c022ed5569e89d418878b704bc Mon Sep 17 00:00:00 2001 From: Hasinjato Date: Tue, 11 Aug 2026 11:06:40 +0300 Subject: [PATCH] Fix! note duration after triolet on midi --- .../kotlin/mg/dot/feufaro/solfa/Solfa.kt | 21 ++++++++----------- .../kotlin/mg/dot/feufaro/midi/MidiPlayer.kt | 5 ----- 2 files changed, 9 insertions(+), 17 deletions(-) diff --git a/composeApp/src/commonMain/kotlin/mg/dot/feufaro/solfa/Solfa.kt b/composeApp/src/commonMain/kotlin/mg/dot/feufaro/solfa/Solfa.kt index ea016fd..14c0bfa 100644 --- a/composeApp/src/commonMain/kotlin/mg/dot/feufaro/solfa/Solfa.kt +++ b/composeApp/src/commonMain/kotlin/mg/dot/feufaro/solfa/Solfa.kt @@ -2108,7 +2108,7 @@ class Solfa(val sharedScreenModel: SharedScreenModel, private val fileRepository val lineChar = lineRepeated.toCharArray() lineChar.forEach { when (it) { - '|', ':', '!', '/', '&' -> { + '|', ':', '!', '/' -> { if (it == '|' && lastIt == '[') { // le séparateur split } else if (lastIt == '|' || lastIt == ':' || lastIt == '!' || lastIt == '/') { @@ -2169,17 +2169,14 @@ class Solfa(val sharedScreenModel: SharedScreenModel, private val fileRepository 'D', 'R', 'F', 'S', 'T', '-', 'Z', 'z' -> { - if (trioletCount == 2) { - trioletCount = 1 - midiDuration = nextTrioletDuration / 2 - nextTrioletDuration = nextTrioletDuration - midiDuration + val isTripletNote = trioletCount >= 0 + if (isTripletNote) { + midiDuration = 20 pushMidi() - nextDuration = nextTrioletDuration - } else if (trioletCount == 1) { - midiDuration = nextDuration - pushMidi() - trioletCount = 0 - nextTrioletDuration = 0 + trioletCount-- + if (trioletCount < 0) { + nextDuration = 60 + } } var noteString = it.toString().lowercase() if (it == 'D' || it == 'R' || it == 'F' || it == 'S') { @@ -2194,7 +2191,7 @@ class Solfa(val sharedScreenModel: SharedScreenModel, private val fileRepository newN.addItem(noteString) when (noteString) { "-" -> { - midiDuration += nextDuration + midiDuration += if (nextDuration > 0) nextDuration else 20 nextDuration = 0 } diff --git a/composeApp/src/desktopMain/kotlin/mg/dot/feufaro/midi/MidiPlayer.kt b/composeApp/src/desktopMain/kotlin/mg/dot/feufaro/midi/MidiPlayer.kt index 7c059ef..71e3cd5 100644 --- a/composeApp/src/desktopMain/kotlin/mg/dot/feufaro/midi/MidiPlayer.kt +++ b/composeApp/src/desktopMain/kotlin/mg/dot/feufaro/midi/MidiPlayer.kt @@ -735,11 +735,6 @@ actual class FMediaPlayer actual constructor( .maxByOrNull { it.gridIndex } ?.dynamic ?: Dynamic.MF currentDynamicFactor = lastDynamic.factor - navigationSteps.forEach { step -> - if (step.gridIndex > gridIndex) { - step.alreadyDone = false - } - } applyVoiceStates() }