summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrekado <rekado@elephly.net>2013-01-14 18:24:42 +0800
committerrekado <rekado@elephly.net>2013-01-14 18:24:42 +0800
commita61cfd9afc0b3904dbcaca99911c5caa68684f17 (patch)
tree173f32d0a928f9f90dc4bdf59d51c0c02546a6b5
parentef39638b45cc3dd0a3196c05f89417d0ea4604db (diff)
implement note reset
-rw-r--r--src/mdaPiano.cpp13
-rw-r--r--src/mdaPianoVoice.cpp1
-rw-r--r--src/mdaPianoVoice.h1
3 files changed, 9 insertions, 6 deletions
diff --git a/src/mdaPiano.cpp b/src/mdaPiano.cpp
index 903bce7..d4c574c 100644
--- a/src/mdaPiano.cpp
+++ b/src/mdaPiano.cpp
@@ -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;
}
diff --git a/src/mdaPianoVoice.cpp b/src/mdaPianoVoice.cpp
index aa4182b..633fb5a 100644
--- a/src/mdaPianoVoice.cpp
+++ b/src/mdaPianoVoice.cpp
@@ -30,6 +30,7 @@ void mdaPianoVoice::reset() {
dec = 0.99f;
muff = 160.0f;
volume = 0.2f;
+ sustain = 0;
}
diff --git a/src/mdaPianoVoice.h b/src/mdaPianoVoice.h
index 86a1c2a..b7958d4 100644
--- a/src/mdaPianoVoice.h
+++ b/src/mdaPianoVoice.h
@@ -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