master
Holger Wirtz 6 years ago
parent 86f082b9cc
commit bb6879eac2
  1. 2
      config.h
  2. 8
      mdaEPiano.cpp

@ -36,7 +36,7 @@
#define DEFAULT_MIDI_CHANNEL MIDI_CHANNEL_OMNI
#define AUDIO_MEM 300
#define SAMPLE_RATE 44100
#define REDUCE_LOUDNESS 0
#define REDUCE_LOUDNESS 1
#if !defined(__MK66FX1M0__) // check for Teensy-3.6
#define NVOCIES 11 // No?

@ -352,8 +352,10 @@ void mdaEPiano::process(int16_t *outputs_r, int16_t *outputs_l)
V->pos -= V->loop;
i = waves[V->pos] + ((V->frac * (waves[V->pos + 1] - waves[V->pos])) >> 16);
x = V->env * static_cast<float>(i) / 32768.0f;
V->env = V->env * V->dec; //envelope
if (x > 0.0f) {
if (x > 0.0f)
{
x -= od * x * x; //overdrive
if (x < -V->env) x = -V->env;
}
@ -373,8 +375,8 @@ void mdaEPiano::process(int16_t *outputs_r, int16_t *outputs_l)
l += l * lmod * lfo1;
r += r * rmod * lfo1; //worth making all these local variables?
outputs_l[frame] = static_cast<int16_t>(l) >> REDUCE_LOUDNESS;
outputs_r[frame] = static_cast<int16_t>(r) >> REDUCE_LOUDNESS;
outputs_l[frame] = static_cast<int16_t>(l * 0x7fff) >> REDUCE_LOUDNESS;
outputs_r[frame] = static_cast<int16_t>(r * 0x7fff) >> REDUCE_LOUDNESS;
}
if (fabs(tl) < 1.0e-10) tl = 0.0f; //anti-denormal

Loading…
Cancel
Save