From c6261dee67010135173c008dde36d7f2585d4839 Mon Sep 17 00:00:00 2001 From: rekado Date: Sat, 26 Jan 2013 09:45:52 +0800 Subject: trust find_free_voice to return a valid index --- src/mdaPiano.cpp | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) (limited to 'src/mdaPiano.cpp') 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]) -- cgit v1.2.3