Compare commits
2 commits
5ec0079f2c
...
cbd0ccfd94
| Author | SHA1 | Date | |
|---|---|---|---|
| cbd0ccfd94 | |||
| 44064f5317 |
2 changed files with 6 additions and 3 deletions
|
|
@ -61,10 +61,12 @@ class Transpose {
|
||||||
val remaining = token.drop(separators.length)
|
val remaining = token.drop(separators.length)
|
||||||
|
|
||||||
val totalAlter = interval + currentModulationInterval
|
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 transposedBody = NOTE_UNIT_REGEX.replace(remaining) { matchResult ->
|
||||||
val fullNote = matchResult.value
|
val fullNote = matchResult.value
|
||||||
transpose(note = fullNote, fromKey = "C", toKey = "C", alter = totalAlter)
|
transpose(note = fullNote, fromKey = "C", toKey = calculatedToKey)
|
||||||
}
|
}
|
||||||
|
|
||||||
val result = separators + transposedBody
|
val result = separators + transposedBody
|
||||||
|
|
|
||||||
|
|
@ -248,7 +248,8 @@ fun MainScreenWithDrawer(
|
||||||
var isEyeVisible by remember { mutableStateOf(false) }
|
var isEyeVisible by remember { mutableStateOf(false) }
|
||||||
val keysOrder = Transpose.keyToNumber
|
val keysOrder = Transpose.keyToNumber
|
||||||
val songKeyIndex = keysOrder.indexOf(songKey).takeIf { it != -1 } ?: 0
|
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 appliedInterval by sharedScreenModel.transpositionInterval.collectAsState()
|
||||||
val isPendingChange = tempInterval != appliedInterval
|
val isPendingChange = tempInterval != appliedInterval
|
||||||
val isCurrentlyTransposed = appliedInterval != 0
|
val isCurrentlyTransposed = appliedInterval != 0
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue