From 1068d0d54b3b39932ae6fc70de3ed4113efabac1 Mon Sep 17 00:00:00 2001 From: rekado Date: Fri, 25 Jan 2013 19:06:13 +0800 Subject: define SAMPLES_PER_NOTE --- src/mdaPianoCommon.h | 1 + src/mdaPianoVoice.cpp | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/mdaPianoCommon.h b/src/mdaPianoCommon.h index 581ffd5..ce41fbd 100644 --- a/src/mdaPianoCommon.h +++ b/src/mdaPianoCommon.h @@ -7,6 +7,7 @@ #define SUSTAIN 128 #define SILENCE 0.0001f //voice choking #define PARAM_OFFSET 3 //offset for param enum +#define SAMPLES_PER_NOTE 1 struct KGRP //keygroup { diff --git a/src/mdaPianoVoice.cpp b/src/mdaPianoVoice.cpp index 0657baf..8198d13 100644 --- a/src/mdaPianoVoice.cpp +++ b/src/mdaPianoVoice.cpp @@ -52,7 +52,7 @@ void mdaPianoVoice::on(unsigned char key, unsigned char velocity) { if(velocity > 40) s += (uint32_t)(sizevel * (float)(velocity - 40)); k = 0; - while(key > (kgrp[k].high + s)) k++; // find keygroup + while(key > (kgrp[k].high + s)) k += SAMPLES_PER_NOTE; // find keygroup sample_index = k; // store sample index l += (float)(key - kgrp[k].root); // pitch -- cgit v1.2.3