diff options
author | Carl Hetherington <carl@carlh.net> | 2010-12-28 18:19:40 +0000 |
---|---|---|
committer | Carl Hetherington <carl@carlh.net> | 2010-12-28 18:19:40 +0000 |
commit | f8ebb4582d4d881fbda75a6bc9cd9c50f5c921f3 (patch) | |
tree | 90608a3cb424866b2a164c354d1665a7b0a9d79a /libs/evoral/src/SMF.cpp | |
parent | 390f18c1152f2007b790a77c873b50ef48209f44 (diff) |
Unify program change and bank handling so that they are manipulated together.
git-svn-id: svn://localhost/ardour2/branches/3.0@8346 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs/evoral/src/SMF.cpp')
-rw-r--r-- | libs/evoral/src/SMF.cpp | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/libs/evoral/src/SMF.cpp b/libs/evoral/src/SMF.cpp index e58090f2a3..8cc14290f7 100644 --- a/libs/evoral/src/SMF.cpp +++ b/libs/evoral/src/SMF.cpp @@ -281,10 +281,18 @@ SMF::append_event_delta(uint32_t delta_t, uint32_t size, const uint8_t* buf, eve smf_event_t* event; - /* XXX july 2010: currently only store event ID's for notes + /* XXX july 2010: currently only store event ID's for notes, program changes and bank changes */ - if (((buf[0] & 0xf0) == MIDI_CMD_NOTE_ON || ((buf[0] & 0xf0) == MIDI_CMD_NOTE_OFF)) && note_id >= 0) { + uint8_t const c = buf[0] & 0xf0; + bool const store_id = ( + c == MIDI_CMD_NOTE_ON || + c == MIDI_CMD_NOTE_OFF || + c == MIDI_CMD_PGM_CHANGE || + (c == MIDI_CMD_CONTROL && (buf[1] == MIDI_CTL_MSB_BANK || buf[1] == MIDI_CTL_LSB_BANK)) + ); + + if (store_id && note_id >= 0) { int idlen; int lenlen; uint8_t idbuf[16]; @@ -293,7 +301,6 @@ SMF::append_event_delta(uint32_t delta_t, uint32_t size, const uint8_t* buf, eve event = smf_event_new (); assert(event != NULL); - /* generate VLQ representation of note ID */ idlen = smf_format_vlq (idbuf, sizeof(idbuf), note_id); |