Bug: import XML missed replacing fi with F

This commit is contained in:
dotmg 2025-07-25 06:04:14 +02:00
parent b968047214
commit 8ebd255cc8
2 changed files with 12 additions and 3 deletions

View file

@ -44,6 +44,6 @@ var unpitched: String? = null,
} }
fun toKey(key: String, numPart: Int): String { fun toKey(key: String, numPart: Int): String {
if (unpitched != null) return "z" if (unpitched != null) return "z"
return Transpose.transpose(toCNote(numPart), "C", key, alter ?: 0) return Transpose.transpose(toCNote(numPart), "C", key, alter ?: 0, true)
} }
} }

View file

@ -46,7 +46,7 @@ class Transpose {
} }
} }
} }
fun transpose(note: String, fromKey: String, toKey: String, alter: Int = 0): String { fun transpose(note: String, fromKey: String, toKey: String, alter: Int = 0, toSolfaCode: Boolean = false): String {
val regexFound = REGEX_ONE_NOTE.find(note) val regexFound = REGEX_ONE_NOTE.find(note)
if (regexFound == null) { if (regexFound == null) {
return note return note
@ -67,7 +67,7 @@ class Transpose {
suffix = "'" suffix = "'"
} }
val newNote = noteToNumber[newNoteNum] + regexFound.groupValues[2] + suffix val newNote = noteToNumber[newNoteNum] + regexFound.groupValues[2] + suffix
return newNote.replace("¹,", "") val transposed = newNote.replace("¹,", "")
.replace("¹'", "²") .replace("¹'", "²")
.replace("¹,", "") .replace("¹,", "")
.replace("₁'", "") .replace("₁'", "")
@ -84,6 +84,15 @@ class Transpose {
.replace("⁴,", "³") .replace("⁴,", "³")
.replace(",", "") .replace(",", "")
.replace("'", "¹") + regexFound.groupValues[3] .replace("'", "¹") + regexFound.groupValues[3]
if (!toSolfaCode) {
return transposed
}
return transposed
.replace("di", "D")
.replace("ri", "R")
.replace("fi", "F")
.replace("si", "S")
.replace("ta", "T")
} }
@OptIn(ExperimentalMaterial3Api::class) // Ajoutez cette annotation pour utiliser ExposedDropdownMenuBox @OptIn(ExperimentalMaterial3Api::class) // Ajoutez cette annotation pour utiliser ExposedDropdownMenuBox
@Composable @Composable