summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorrekado <rekado@elephly.net>2013-07-29 22:02:54 +0800
committerrekado <rekado@elephly.net>2013-07-29 22:02:54 +0800
commitcda788f4ba91a4524aa1c08476c07621c8e96665 (patch)
tree8564bd1540391bb706684e28566cc62955e6f086 /src
parentbd063f37d12eb333bd757c85a8a5761f1a870ac9 (diff)
replace k with sample_index
Diffstat (limited to 'src')
-rw-r--r--src/mdaPianoVoice.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/mdaPianoVoice.cpp b/src/mdaPianoVoice.cpp
index 35266f8..2b70c3e 100644
--- a/src/mdaPianoVoice.cpp
+++ b/src/mdaPianoVoice.cpp
@@ -71,11 +71,11 @@ void mdaPianoVoice::on(unsigned char key, unsigned char velocity) {
if(velocity > 40) s += (long)(sizevel * (float)(velocity - 40));
#endif
- k = 0;
- while(key > (kgrp[k].high + s)) k += SAMPLES_PER_NOTE; // find keygroup
- sample_index = k; // store sample index
+ sample_index = 0;
+ while (key > (kgrp[sample_index].high + s))
+ sample_index += SAMPLES_PER_NOTE; // find keygroup
- l += (float)(key - kgrp[k].root); // pitch
+ l += (float)(key - kgrp[sample_index].root); // pitch
#ifdef PIANO
l = 22050.0f * iFs * (float)exp(0.05776226505 * l);
#elif defined EPIANO