diff options
author | Carl Hetherington <carl@carlh.net> | 2011-03-23 13:17:35 +0000 |
---|---|---|
committer | Carl Hetherington <carl@carlh.net> | 2011-03-23 13:17:35 +0000 |
commit | 7178f031ba40f017b9633cd34ad525c19181378c (patch) | |
tree | c29450fe373794e1fc6e5669856a7c667d33c997 /libs/evoral | |
parent | 073cf1782c600a1e8b4713a3023a7185c576a9c7 (diff) |
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
Diffstat (limited to 'libs/evoral')
-rw-r--r-- | libs/evoral/src/midi_util.cpp | 29 |
1 files changed, 15 insertions, 14 deletions
diff --git a/libs/evoral/src/midi_util.cpp b/libs/evoral/src/midi_util.cpp index e84f3ca2d4..b6e71013b0 100644 --- a/libs/evoral/src/midi_util.cpp +++ b/libs/evoral/src/midi_util.cpp @@ -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; |