From cda788f4ba91a4524aa1c08476c07621c8e96665 Mon Sep 17 00:00:00 2001 From: rekado Date: Mon, 29 Jul 2013 22:02:54 +0800 Subject: replace k with sample_index --- src/mdaPianoVoice.cpp | 8 ++++---- 1 file 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 -- cgit v1.2.3