From 4f7d3d1a521bd3f49009b730c1088586223c9082 Mon Sep 17 00:00:00 2001 From: rekado Date: Mon, 14 Jan 2013 18:34:13 +0800 Subject: remove processReplacing `processReplacing` is almost the same as `process`. The differences are now in `process`, but commented until further review. --- src/mdaPiano.cpp | 71 +++++++++++--------------------------------------------- src/mdaPiano.h | 1 - 2 files changed, 14 insertions(+), 58 deletions(-) diff --git a/src/mdaPiano.cpp b/src/mdaPiano.cpp index d4c574c..8d1ca52 100644 --- a/src/mdaPiano.cpp +++ b/src/mdaPiano.cpp @@ -109,69 +109,20 @@ void mdaPiano::process(float **inputs, float **outputs, uint32_t sampleFrames) V->pos += V->frac >> 16; V->frac &= 0xFFFF; if(V->pos > V->end) V->pos -= V->loop; + i = waves[V->pos]; i = (i << 7) + (V->frac >> 9) * (waves[V->pos + 1] - i) + 0x40400000; x = V->env * (*(float *)&i - 3.0f); //fast int->float - V->env = V->env * V->dec; //envelope - V->f0 += V->ff * (x + V->f1 - V->f0); //muffle filter - V->f1 = x; - - l += V->outl * V->f0; - r += V->outr * V->f0; - - V++; - } - comb[cpos] = l + r; - ++cpos &= cmax; - x = cdep * comb[cpos]; //stereo simulator - - *out0++ += l + x; - *out1++ += r - x; - } - - if(framesampleFrames) frames = sampleFrames; - frames -= frame; - frame += frames; - - while(--frames>=0) - { - VOICE *V = voice; - l = r = 0.0f; - - for(v=0; vfrac += V->delta; //integer-based linear interpolation - V->pos += V->frac >> 16; - V->frac &= 0xFFFF; - if(V->pos > V->end) V->pos -= V->loop; + ///////////////////// + //TODO: This was used in processReplacing instead of the above + /* //i = (i << 7) + (V->frac >> 9) * (waves[V->pos + 1] - i) + 0x40400000; //not working on intel mac !?! i = waves[V->pos] + ((V->frac * (waves[V->pos + 1] - waves[V->pos])) >> 16); x = V->env * (float)i / 32768.0f; //x = V->env * (*(float *)&i - 3.0f); //fast int->float + */ + ///////////////////// V->env = V->env * V->dec; //envelope V->f0 += V->ff * (x + V->f1 - V->f0); //muffle filter @@ -180,6 +131,9 @@ void mdaPiano::processReplacing(float **inputs, float **outputs, uint32_t sample l += V->outl * V->f0; r += V->outr * V->f0; + //TODO: this was used in processReplacing + ///////////////////// + /* if(!(l > -2.0f) || !(l < 2.0f)) { printf("what is this shit? %d, %f, %f\n", i, x, V->f0); @@ -189,6 +143,8 @@ if(!(r > -2.0f) || !(r < 2.0f)) { r = 0.0f; } + */ + ///////////////////// V++; } @@ -196,8 +152,9 @@ if(!(r > -2.0f) || !(r < 2.0f)) ++cpos &= cmax; x = cdep * comb[cpos]; //stereo simulator - *out0++ = l + x; - *out1++ = r - x; + // TODO: processReplacing simply assigned instead of adding + *out0++ += l + x; + *out1++ += r - x; } if(frame