implement note reset
authorrekado <rekado@elephly.net>
Mon, 14 Jan 2013 10:24:42 +0000 (18:24 +0800)
committerrekado <rekado@elephly.net>
Mon, 14 Jan 2013 10:24:42 +0000 (18:24 +0800)
src/mdaPiano.cpp
src/mdaPianoVoice.cpp
src/mdaPianoVoice.h

index 903bce7..d4c574c 100644 (file)
@@ -259,12 +259,13 @@ uint32_t mdaPiano::processEvents(VstEvents* ev)
             }
             break;
 
-          default:  //all notes off
-            if(midiData[1]>0x7A)
-            {
-              for(uint32_t v=0; v<NVOICES; v++) voice[v].dec=0.99f;
-              sustain = 0;
-              muff = 160.0f;
+          //all sound off
+          case 0x78:
+          //all notes off
+          case 0x7b:
+          default:
+            for(short v=0; v<NVOICES; v++) {
+              voices[v]->reset();
             }
             break;
         }
index aa4182b..633fb5a 100644 (file)
@@ -30,6 +30,7 @@ void mdaPianoVoice::reset() {
   dec = 0.99f;
   muff = 160.0f;
   volume = 0.2f;
+  sustain = 0;
 }
 
 
index 86a1c2a..b7958d4 100644 (file)
@@ -20,6 +20,7 @@ class mdaPianoVoice : public LV2::Voice {
     KGRP  *kgrp;
     short *waves;
     float default_preset[NPARAMS]; // contains the default preset
+    short sustain;
 
     // voice state
     uint32_t  delta;  //sample playback