trust find_free_voice to return a valid index
authorrekado <rekado@elephly.net>
Sat, 26 Jan 2013 01:45:52 +0000 (09:45 +0800)
committerrekado <rekado@elephly.net>
Sat, 26 Jan 2013 01:45:52 +0000 (09:45 +0800)
src/mdaPiano.cpp

index 837626c..c9e2545 100644 (file)
@@ -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])