diff options
author | rekado <rekado@elephly.net> | 2013-01-26 09:45:52 +0800 |
---|---|---|
committer | rekado <rekado@elephly.net> | 2013-01-26 09:45:52 +0800 |
commit | c6261dee67010135173c008dde36d7f2585d4839 (patch) | |
tree | c688ee5567f0bfffacc06fea5c7b279e06c11501 | |
parent | 07778ea88bbd4f49b97ad491c58b2065e191a9b3 (diff) |
trust find_free_voice to return a valid index
-rw-r--r-- | src/mdaPiano.cpp | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/src/mdaPiano.cpp b/src/mdaPiano.cpp index 837626c..c9e2545 100644 --- a/src/mdaPiano.cpp +++ b/src/mdaPiano.cpp @@ -108,13 +108,9 @@ void mdaPiano::handle_midi(uint32_t size, unsigned char* data) { break; case 0x90: //note on - { - unsigned int v = find_free_voice(data[1], data[2]); - if (v < NVOICES) { - voices[v]->on(data[1], data[2]); - } - break; - } + voices[ find_free_voice(data[1], data[2]) ]->on(data[1], data[2]); + break; + case 0xB0: //controller switch(data[1]) |