summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorrekado <rekado@elephly.net>2013-07-28 12:01:02 +0800
committerrekado <rekado@elephly.net>2013-07-28 12:01:02 +0800
commitf9020a788fb384a3f095977aa629a31db9d43962 (patch)
tree5ed740becb6927cf48bfc684925b67c6a19ac570 /src
parent7f1350581a42ff02003e4164008dd0b20914abf2 (diff)
[epiano] fix: pick different sample for different velocity
Diffstat (limited to 'src')
-rw-r--r--src/mdaPianoVoice.cpp9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/mdaPianoVoice.cpp b/src/mdaPianoVoice.cpp
index 9e46e6b..4551c6b 100644
--- a/src/mdaPianoVoice.cpp
+++ b/src/mdaPianoVoice.cpp
@@ -77,10 +77,6 @@ void mdaPianoVoice::on(unsigned char key, unsigned char velocity) {
k = 0;
while(key > (kgrp[k].high + s)) k += SAMPLES_PER_NOTE; // find keygroup
-#ifdef EPIANO
- if(velocity > 48) k++; // mid velocity sample
- if(velocity > 80) k++; // high velocity sample
-#endif
sample_index = k; // store sample index
l += (float)(key - kgrp[k].root); // pitch
@@ -94,6 +90,11 @@ void mdaPianoVoice::on(unsigned char key, unsigned char velocity) {
frac = 0;
pos = 0;
+#ifdef EPIANO
+ if(velocity > 48) sample_index++; // mid velocity sample
+ if(velocity > 80) sample_index++; // high velocity sample
+#endif
+
#ifdef PIANO
end = samples[sample_index].size;
#elif defined EPIANO