From c39b2c29f12c604ed2fd36484a19d176603c589c Mon Sep 17 00:00:00 2001 From: David Robillard Date: Mon, 12 Mar 2007 22:50:13 +0000 Subject: Fixed MIDI note off normalization for multiple channels. git-svn-id: http://svn.drobilla.net/lad/raul@359 a436a847-0d15-0410-975c-d299462d15a1 --- src/SMFReader.cpp | 4 ++-- tests/smf_test.cpp | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/SMFReader.cpp b/src/SMFReader.cpp index 4c03229..56232cf 100644 --- a/src/SMFReader.cpp +++ b/src/SMFReader.cpp @@ -260,8 +260,8 @@ SMFReader::read_event(size_t buf_len, unsigned char* buf, uint32_t* ev_size, uin // Read event, return size fread(buf+1, 1, *ev_size - 1, _fd); - if (buf[0] == 0x90 && buf[2] == 0) { - buf[0] = 0x80; + if ((buf[0] & 0xF0) == 0x90 && buf[2] == 0) { + buf[0] = (0x80 | (buf[0] & 0x0F)); buf[2] = 0x40; } diff --git a/tests/smf_test.cpp b/tests/smf_test.cpp index d4e5411..3396b90 100644 --- a/tests/smf_test.cpp +++ b/tests/smf_test.cpp @@ -47,8 +47,8 @@ main(int argc, char** argv) uint32_t ev_delta_time; while (reader.read_event(4, buf, &ev_size, &ev_delta_time) >= 0) { - cout << "\n\nEvent, size = " << ev_size << ", time = " << ev_delta_time; - cout << ", data = "; + cout << "Event, size = " << ev_size << ", time = " << ev_delta_time; + cout << ":\t"; cout.flags(ios::hex); for (uint32_t i=0; i < ev_size; ++i) { cout << "0x" << (int)buf[i] << " "; -- cgit v1.2.1