Implements ${P:x} for tempo change marker
This commit is contained in:
parent
5a39e1b79b
commit
097f1f5644
7 changed files with 20 additions and 15 deletions
|
|
@ -499,7 +499,7 @@ actual class FMediaPlayer actual constructor(
|
|||
val finReg = Regex("""(fine|fin|farany|end)""", RegexOption.IGNORE_CASE)
|
||||
|
||||
val modulaRegex = Regex("""D(ô|o)?\s*dia\s*(C|Db|D|Eb|E|F|Gb|G|Ab|A|Bb|B)""", RegexOption.IGNORE_CASE)
|
||||
val tempoRegex = Regex("""^♩\s*=\s*(\d+)""", RegexOption.IGNORE_CASE)
|
||||
val tempoRegex = Regex("""^(?:♩|P)\s*[:=]\s*(\d+)""", RegexOption.IGNORE_CASE)
|
||||
metadataList.forEach { midiMarker ->
|
||||
val ci = midiMarker.gridIndex ?: 0
|
||||
val last_grid = sharedScreenModel.getTotalGridCount()
|
||||
|
|
|
|||
|
|
@ -692,12 +692,12 @@ private suspend fun generatePdfToBytes(
|
|||
drawFermata(cs, colX + colWidth / 2 - 5f, markerY - 2f, 0.3f)
|
||||
}
|
||||
|
||||
if (markerText.contains("♩")) {
|
||||
val textPart = markerText.replace("♩", "BPM")
|
||||
if (markerText.contains("P:")) {
|
||||
val textPart = markerText
|
||||
cs.beginText()
|
||||
cs.setFont(italicBoldFont, fontSize)
|
||||
cs.newLineAtOffset(colX, markerY)
|
||||
cs.setFont(boldFont, fontSize-3f)
|
||||
cs.setFont(boldFont, fontSize)
|
||||
cs.showText(textPart)
|
||||
cs.endText()
|
||||
}
|
||||
|
|
|
|||
|
|
@ -94,7 +94,7 @@ class MidiWriterforEXport constructor(private val fileRepository: FileRepositor
|
|||
var pendingHairpinStartTick: Long? = null
|
||||
|
||||
val modulaRegex = Regex("""D(ô|o)?\s*dia\s*(C|Db|D|Eb|E|F|Gb|G|Ab|A|Bb|B)""", RegexOption.IGNORE_CASE)
|
||||
val tempoRegex = Regex("""^♩\s*=\s*(\d+)""", RegexOption.IGNORE_CASE)
|
||||
val tempoRegex = Regex("""^(?:♩|P)\s*[:=]\s*(\d+)""", RegexOption.IGNORE_CASE)
|
||||
|
||||
markers.forEach { midiMarker ->
|
||||
val gridIdx = (midiMarker.gridIndex ?: 0) * 480L
|
||||
|
|
|
|||
|
|
@ -68,7 +68,7 @@ fun parseMarkers(rawText: String): List<String> {
|
|||
.replace(Regex("""(D\.?S\.?)\s*(al\s*Coda)""", RegexOption.IGNORE_CASE), "D.S.alCoda")
|
||||
|
||||
val allStaticMarkers = getAllMarker().sortedByDescending { it.length }
|
||||
val tempoRegex = Regex("""^(♩\s*=\s*\d+)""", RegexOption.IGNORE_CASE)
|
||||
val tempoRegex = Regex("""^(?:♩|P)\s*[:=]\s*(\d+)""", RegexOption.IGNORE_CASE)
|
||||
val modulaRegex = Regex("""^(D(?:ô|o)?\s*dia\s*(?:C|Db|D|Eb|E|F|Gb|G|Ab|A|Bb|B))""", RegexOption.IGNORE_CASE)
|
||||
val measureRegex = Regex("""^\d+\s*/\s*\d+""")
|
||||
|
||||
|
|
@ -78,7 +78,8 @@ fun parseMarkers(rawText: String): List<String> {
|
|||
|
||||
val tempoMatch = tempoRegex.find(remaining)
|
||||
if (tempoMatch != null) {
|
||||
tokens.add(tempoMatch.value)
|
||||
val bpm = tempoMatch.groupValues[1]
|
||||
tokens.add("♩=$bpm")
|
||||
remaining = remaining.substring(tempoMatch.value.length)
|
||||
continue
|
||||
}
|
||||
|
|
|
|||
|
|
@ -482,9 +482,13 @@ class Solfa(val sharedScreenModel: SharedScreenModel, private val fileRepository
|
|||
"\${c:$lettre}"
|
||||
} else {
|
||||
markerClean.split(Regex("\\s+")).filter { it.isNotEmpty() }.joinToString(" ") { part ->
|
||||
when (part) {
|
||||
"𝄐" -> "\$Q"
|
||||
else -> "\${$part}"
|
||||
val trimmed = part.trim()
|
||||
when {
|
||||
trimmed == "𝄐" -> "\$Q"
|
||||
else -> {
|
||||
val formattedPart = trimmed.replace("♩", "P")
|
||||
"\${$formattedPart}"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -260,7 +260,7 @@ actual class FMediaPlayer actual constructor(
|
|||
val ritRegex = Regex("""rit\.?|ritard\.?|ritenuto\.?|ritardando""", RegexOption.IGNORE_CASE)
|
||||
val rallRegex = Regex("""rall\.?|rallent\.?|rallentando""", RegexOption.IGNORE_CASE)
|
||||
val modulaRegex = Regex("""D(ô|o)?\s*dia\s*(C|Db|D|Eb|E|F|Gb|G|Ab|A|Bb|B)""", RegexOption.IGNORE_CASE)
|
||||
val tempoRegex = Regex("""^♩\s*=\s*(\d+)""", RegexOption.IGNORE_CASE)
|
||||
val tempoRegex = Regex("""^(?:♩|P)\s*[:=]\s*(\d+)""", RegexOption.IGNORE_CASE)
|
||||
|
||||
metadataList.forEach { midiMarker ->
|
||||
val currentIndex = midiMarker.gridIndex ?: 0
|
||||
|
|
|
|||
|
|
@ -908,18 +908,18 @@ private suspend fun generatePdfToBytes(
|
|||
)
|
||||
}
|
||||
|
||||
if (markerText.contains("♩")) {
|
||||
val textPart = markerText.replace("♩", "BPM")
|
||||
if (markerText.contains("P:")) {
|
||||
val textPart = markerText
|
||||
cs.beginText()
|
||||
cs.setFont(italicBoldFont, fontSize)
|
||||
cs.newLineAtOffset(colX, markerY)
|
||||
cs.setFont(boldFont, fontSize-3f)
|
||||
cs.setFont(boldFont, fontSize)
|
||||
cs.showText(textPart)
|
||||
cs.endText()
|
||||
}
|
||||
|
||||
// marqueur
|
||||
if (markerText.isNotBlank() && !markerText.contains("𝄐") && !markerText.contains("♩")) {
|
||||
if (markerText.isNotBlank() && !markerText.contains("𝄐") && !markerText.contains("P:")) {
|
||||
val dsRegex = Regex("""D\.?S\.?""")
|
||||
val dcRegex = Regex("""D\.?C\.?""")
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue