From f8ebb4582d4d881fbda75a6bc9cd9c50f5c921f3 Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Tue, 28 Dec 2010 18:19:40 +0000 Subject: 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 --- libs/evoral/src/SMF.cpp | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'libs/evoral/src/SMF.cpp') 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); -- cgit v1.2.3