Patch from Joskar to use scientific pitch notation for MIDI note names (#3867).
git-svn-id: svn://localhost/ardour2/branches/3.0@9188 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
parent
073cf1782c
commit
7178f031ba
@ -29,24 +29,25 @@ midi_note_name (uint8_t val)
|
||||
}
|
||||
|
||||
static const char* notes[] = {
|
||||
"c",
|
||||
"c#",
|
||||
"d",
|
||||
"d#",
|
||||
"e",
|
||||
"f",
|
||||
"f#",
|
||||
"g",
|
||||
"g#",
|
||||
"a",
|
||||
"a#",
|
||||
"b"
|
||||
"C",
|
||||
"C#",
|
||||
"D",
|
||||
"D#",
|
||||
"E",
|
||||
"F",
|
||||
"F#",
|
||||
"G",
|
||||
"G#",
|
||||
"A",
|
||||
"A#",
|
||||
"B"
|
||||
};
|
||||
|
||||
int octave = val/12;
|
||||
/* MIDI note 0 is in octave -1 (in scientific pitch notation) */
|
||||
int octave = val / 12 - 1;
|
||||
static char buf[8];
|
||||
|
||||
val -= octave*12;
|
||||
val = val % 12;
|
||||
|
||||
snprintf (buf, sizeof (buf), "%s%d", notes[val], octave);
|
||||
return buf;
|
||||
|
Loading…
Reference in New Issue
Block a user