diff --git a/composeApp/src/commonMain/kotlin/mg/dot/feufaro/solfa/ParseULine.kt b/composeApp/src/commonMain/kotlin/mg/dot/feufaro/solfa/ParseULine.kt index 1c7992f..37bc457 100644 --- a/composeApp/src/commonMain/kotlin/mg/dot/feufaro/solfa/ParseULine.kt +++ b/composeApp/src/commonMain/kotlin/mg/dot/feufaro/solfa/ParseULine.kt @@ -135,7 +135,7 @@ class ParseULine (var line: String, var measure: Int) { val indexByFour = cursorX % 4 var sequence = mapXLate[codeChar]!![indexByFour]!! if (charX == 'z') { - sequence = sequence.replace('-', charX) + sequence = if (sequence == ".") "z." else sequence.replace('-', charX) } if (codeChar == 't') { cursorX += 4 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 40dbd60..2430c21 100644 --- a/composeApp/src/commonMain/kotlin/mg/dot/feufaro/solfa/Solfa.kt +++ b/composeApp/src/commonMain/kotlin/mg/dot/feufaro/solfa/Solfa.kt @@ -135,7 +135,9 @@ class Solfa(val sharedScreenModel: SharedScreenModel, private val fileRepository fun noteAt(voice: Int, idx: Int): String? = N.getOrNull(voice)?.oneVoiceNote?.getOrNull(idx)?.note val allPrevSilent = N.indices.all { v -> isSilent(noteAt(v, nextNIndex)) } - if (!allPrevSilent) { + val isExplicitDottedSilence = templateCharArray.getOrNull(index - 1)?.lowercaseChar() == 'z' + + if (!allPrevSilent || isExplicitDottedSilence) { if (unitObject.tuNotes.isEmpty()) { unitObject.addMarker(it) } else { 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 2e0db35..9dd1840 100644 --- a/composeApp/src/desktopMain/kotlin/mg/dot/feufaro/midi/MidiPlayer.kt +++ b/composeApp/src/desktopMain/kotlin/mg/dot/feufaro/midi/MidiPlayer.kt @@ -64,8 +64,8 @@ actual class FMediaPlayer actual constructor( val tempoType: String = "", val endGridForTempo: Int = -1, val targetTempoMultiplier: Float = 0.6f, - val newBpm: Float? = null - + val newBpm: Float? = null, + val template: String = "" ) private val navigationSteps = mutableListOf() @@ -315,7 +315,8 @@ actual class FMediaPlayer actual constructor( marker, currentIndex, isHold = true, - beatInDC = beat + beatInDC = beat, + template = midiMarker.template ) ) println("Point d'orgue (\uD834\uDD10) mémorisée au grille n° ${midiMarker.gridIndex}") @@ -577,9 +578,13 @@ actual class FMediaPlayer actual constructor( step.isHold -> { val currentBpm = sequencer?.tempoInBPM ?: targetBpm val beatMs = (60_000 / currentBpm).toLong() - val holdDuration = if (step.beatInDC == 2) beatMs / 2 else beatMs * 2 + val holdDuration = if (step.beatInDC == 2) beatMs / 1 else beatMs * 2 - println("POINT D'ORGUE sur Grille $currentIndex | Durée: ${holdDuration}ms") + val qIndex = step.template.count { it == 'D' } + if (qIndex > 1) { + val firstPartDelay = beatMs / qIndex + delay(firstPartDelay) + } synthetizer?.channels?.forEach { it?.controlChange(64, 127) } val previousFactor = sequencer?.tempoFactor ?: 1.0f