diff options
author | rekado <rekado@elephly.net> | 2013-01-14 22:01:03 +0800 |
---|---|---|
committer | rekado <rekado@elephly.net> | 2013-01-14 22:01:03 +0800 |
commit | fba9fc35f94198e8f2cf29d6fdc6937029f38e01 (patch) | |
tree | 830106cfaf7590361731c475915f4311791ab7b7 | |
parent | 6ecbe702bf74f30e4bac40c3466c957364765315 (diff) |
handle note on event
-rw-r--r-- | src/mdaPiano.cpp | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/mdaPiano.cpp b/src/mdaPiano.cpp index bc9a5f8..09163d7 100644 --- a/src/mdaPiano.cpp +++ b/src/mdaPiano.cpp @@ -112,9 +112,13 @@ void mdaPiano::handle_midi(uint32_t size, unsigned char* data) { break; case 0x90: //note on - notes[npos++] = data[1] & 0x7F; //note - notes[npos++] = data[2] & 0x7F; //vel - break; + { + unsigned int v = find_free_voice(data[1], data[2]); + if (v < NVOICES) { + voices[v]->on(data[1], data[2]); + } + break; + } case 0xB0: //controller switch(data[1]) |