Fix bug midi duration when ",D|)" and ":(D,D.D,D|)" note ":m,:f,;-.-;--l,:"
This commit is contained in:
parent
ffc525fe27
commit
1aa11747b5
1 changed files with 20 additions and 3 deletions
|
|
@ -2421,6 +2421,7 @@ class Solfa(val sharedScreenModel: SharedScreenModel, private val fileRepository
|
||||||
}
|
}
|
||||||
var lastIt = ' '
|
var lastIt = ' '
|
||||||
var lastSignificantIt = ' '
|
var lastSignificantIt = ' '
|
||||||
|
var beatPos = 0
|
||||||
val newN = POneVoiceNote()
|
val newN = POneVoiceNote()
|
||||||
val lineRepeated = REGEX_REPETITION.replace(line) { matchResult ->
|
val lineRepeated = REGEX_REPETITION.replace(line) { matchResult ->
|
||||||
val (charIterated, iteration) = matchResult.destructured
|
val (charIterated, iteration) = matchResult.destructured
|
||||||
|
|
@ -2440,7 +2441,15 @@ class Solfa(val sharedScreenModel: SharedScreenModel, private val fileRepository
|
||||||
if (nextDuration > 0 && lastIt != '-') {
|
if (nextDuration > 0 && lastIt != '-') {
|
||||||
midiDuration += nextDuration
|
midiDuration += nextDuration
|
||||||
}
|
}
|
||||||
|
if (lastNoteString.isNotEmpty()
|
||||||
|
&& midiDuration == 0
|
||||||
|
&& nextDuration == 0
|
||||||
|
&& beatPos in 1..59
|
||||||
|
) {
|
||||||
|
midiDuration = 60 - beatPos
|
||||||
|
}
|
||||||
nextDuration = 60
|
nextDuration = 60
|
||||||
|
beatPos = 0
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -2459,6 +2468,7 @@ class Solfa(val sharedScreenModel: SharedScreenModel, private val fileRepository
|
||||||
}
|
}
|
||||||
|
|
||||||
'.' -> {
|
'.' -> {
|
||||||
|
beatPos = 30
|
||||||
if (lastIt == ';' || lastSignificantIt == ';') {
|
if (lastIt == ';' || lastSignificantIt == ';') {
|
||||||
pushMidi()
|
pushMidi()
|
||||||
lastNoteString = "z"
|
lastNoteString = "z"
|
||||||
|
|
@ -2466,8 +2476,12 @@ class Solfa(val sharedScreenModel: SharedScreenModel, private val fileRepository
|
||||||
nextDuration = 30
|
nextDuration = 30
|
||||||
}
|
}
|
||||||
if (lastSignificantIt == '-') {
|
if (lastSignificantIt == '-') {
|
||||||
midiDuration += 30 - nextDuration
|
if (nextDuration > 30) {
|
||||||
nextDuration = 30
|
midiDuration += 30 - nextDuration
|
||||||
|
nextDuration = 30
|
||||||
|
} else {
|
||||||
|
nextDuration = (30 - nextDuration).coerceAtLeast(0)
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
if (nextDuration == 0) {
|
if (nextDuration == 0) {
|
||||||
if (midiDuration == 0) {
|
if (midiDuration == 0) {
|
||||||
|
|
@ -2486,6 +2500,7 @@ class Solfa(val sharedScreenModel: SharedScreenModel, private val fileRepository
|
||||||
}
|
}
|
||||||
|
|
||||||
';' -> {
|
';' -> {
|
||||||
|
beatPos = if (beatPos < 15) 15 else if (beatPos < 30) 30 else 45
|
||||||
if ((lastIt == '.' || lastSignificantIt == '.') && lastNoteString == "z" && midiDuration == 0) {
|
if ((lastIt == '.' || lastSignificantIt == '.') && lastNoteString == "z" && midiDuration == 0) {
|
||||||
pushMidi()
|
pushMidi()
|
||||||
lastNoteString = "z"
|
lastNoteString = "z"
|
||||||
|
|
@ -2493,7 +2508,9 @@ class Solfa(val sharedScreenModel: SharedScreenModel, private val fileRepository
|
||||||
nextDuration = 15
|
nextDuration = 15
|
||||||
}
|
}
|
||||||
if (lastSignificantIt == '-') {
|
if (lastSignificantIt == '-') {
|
||||||
midiDuration += 15 - nextDuration
|
if (nextDuration > 15) {
|
||||||
|
midiDuration += 15 - nextDuration
|
||||||
|
}
|
||||||
nextDuration = 15
|
nextDuration = 15
|
||||||
} else {
|
} else {
|
||||||
if (nextDuration == 0) {
|
if (nextDuration == 0) {
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue