mirror of
https://github.com/vsariola/sointu.git
synced 2025-06-04 01:28:45 -04:00
fix(tracker): show note octaves with letters in case the notes are out of numeric range
This commit is contained in:
parent
38008bdb87
commit
8f89bf7361
@ -27,10 +27,13 @@ func valueAsNote(val byte) string {
|
|||||||
if val == 0 {
|
if val == 0 {
|
||||||
return "---" // release
|
return "---" // release
|
||||||
}
|
}
|
||||||
octave := (val - baseNote) / 12
|
oNote := mod(int(val-baseNote), 12)
|
||||||
oNote := (val - baseNote) % 12
|
octave := (int(val) - oNote - baseNote) / 12
|
||||||
if octave < 0 || oNote < 0 || octave > 10 {
|
if octave < 0 {
|
||||||
return "???"
|
return fmt.Sprintf("%s%s", notes[oNote], string(byte('Z'+1+octave)))
|
||||||
|
}
|
||||||
|
if octave >= 10 {
|
||||||
|
return fmt.Sprintf("%s%s", notes[oNote], string(byte('A'+octave-10)))
|
||||||
}
|
}
|
||||||
return fmt.Sprintf("%s%d", notes[oNote], octave)
|
return fmt.Sprintf("%s%d", notes[oNote], octave)
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user