Small fixes.

master
Holger Wirtz 6 years ago
parent 1f7caea7a0
commit 7cc48260c8
  1. 4
      MicroMDAEPiano.ino
  2. 7
      effect_modulated_chorus.cpp

@ -239,8 +239,10 @@ void setup()
} }
// chorus modulation fixed // chorus modulation fixed
memset(r_delayline,0,sizeof(short)*CHORUS_DELAY_LENGTH);
memset(l_delayline,0,sizeof(short)*CHORUS_DELAY_LENGTH);
mod_sine1.amplitude(1.0); mod_sine1.amplitude(1.0);
mod_sine1.frequency(5.0); mod_sine1.frequency(2.0);
mod_sine1.phase(0); mod_sine1.phase(0);
// chorus level fixed // chorus level fixed
mixer_r.gain(2, 1.0); mixer_r.gain(2, 1.0);

@ -132,18 +132,17 @@ void AudioModulatedEffectChorus::update(void)
// linear interpolation // linear interpolation
x1 = int(mod_idx); x1 = int(mod_idx);
y1 = *(block->data + x1); y1 = *(block->data + x1);
if (x1 + 1 > delay_length) if (x1 + 1 >= delay_length)
{ {
x2 = 0; x2 = 0;
y2 = *block->data; y2 = *bp;
} }
else else
{ {
x2 = x1 + 1; x2 = x1 + 1;
y2 = *(block->data + x2); y2 = *bp + x2;
} }
*bp = (*bp >> 1) + (int((float(y2 - y1) / (x2 - x1) * (mod_idx - x1) + y1) + 0.5) >> 1); // mix original signal 1:1 with modulated signal *bp = (*bp >> 1) + (int((float(y2 - y1) / (x2 - x1) * (mod_idx - x1) + y1) + 0.5) >> 1); // mix original signal 1:1 with modulated signal
bp++; bp++;
mp++; mp++;
l_circ_idx++; l_circ_idx++;

Loading…
Cancel
Save