From f9020a788fb384a3f095977aa629a31db9d43962 Mon Sep 17 00:00:00 2001 From: rekado Date: Sun, 28 Jul 2013 12:01:02 +0800 Subject: [epiano] fix: pick different sample for different velocity --- src/mdaPianoVoice.cpp | 9 +++++---- 1 file 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 -- cgit v1.2.3