Fix! Implement visual note Transposition by Clicking on SongKey
This commit is contained in:
parent
e2a5d18a20
commit
44064f5317
2 changed files with 6 additions and 3 deletions
|
|
@ -61,10 +61,12 @@ class Transpose {
|
|||
val remaining = token.drop(separators.length)
|
||||
|
||||
val totalAlter = interval + currentModulationInterval
|
||||
|
||||
val rawIndex = (0 + totalAlter) % 12
|
||||
val targetKeyIndex = if (rawIndex < 0) rawIndex + 12 else rawIndex
|
||||
val calculatedToKey = keyToNumber[targetKeyIndex]
|
||||
val transposedBody = NOTE_UNIT_REGEX.replace(remaining) { matchResult ->
|
||||
val fullNote = matchResult.value
|
||||
transpose(note = fullNote, fromKey = "C", toKey = "C", alter = totalAlter)
|
||||
transpose(note = fullNote, fromKey = "C", toKey = calculatedToKey)
|
||||
}
|
||||
|
||||
val result = separators + transposedBody
|
||||
|
|
|
|||
|
|
@ -248,7 +248,8 @@ fun MainScreenWithDrawer(
|
|||
var isEyeVisible by remember { mutableStateOf(false) }
|
||||
val keysOrder = Transpose.keyToNumber
|
||||
val songKeyIndex = keysOrder.indexOf(songKey).takeIf { it != -1 } ?: 0
|
||||
val tempUiKey = keysOrder[(songKeyIndex + tempInterval + 24) % 12]
|
||||
val rawKeyIndex = (songKeyIndex + tempInterval) % 12
|
||||
val tempUiKey = keysOrder[if (rawKeyIndex < 0) rawKeyIndex + 12 else rawKeyIndex]
|
||||
val appliedInterval by sharedScreenModel.transpositionInterval.collectAsState()
|
||||
val isPendingChange = tempInterval != appliedInterval
|
||||
val isCurrentlyTransposed = appliedInterval != 0
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue