diff options
author | rekado <rekado@elephly.net> | 2013-01-14 22:18:03 +0800 |
---|---|---|
committer | rekado <rekado@elephly.net> | 2013-01-14 22:18:03 +0800 |
commit | cfcc7b8fa35afc096c1771a4b513f94ccaa1fc67 (patch) | |
tree | 0db76a3a0091233991e1b11ce1509be880cde872 | |
parent | 9b02feb9d5dc0ed830f437afa493631747b72ed7 (diff) |
handle note off event
-rw-r--r-- | src/mdaPiano.cpp | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/mdaPiano.cpp b/src/mdaPiano.cpp index 09163d7..3e44cc7 100644 --- a/src/mdaPiano.cpp +++ b/src/mdaPiano.cpp @@ -107,8 +107,12 @@ void mdaPiano::handle_midi(uint32_t size, unsigned char* data) { switch(data[0] & 0xf0) { case 0x80: //note off - notes[npos++] = data[1] & 0x7F; //note - notes[npos++] = 0; //vel + for (unsigned i = 0; i < NVOICES; ++i) { + if (voices[i]->get_key() == data[1]) { + voices[i]->release(data[2]); + break; + } + } break; case 0x90: //note on |