Small additions and fixes.

chorus
Holger Wirtz 6 years ago
parent 69a6bd885d
commit 63f42d7036
  1. 27
      MicroMDAPiano.ino
  2. 36
      mdaEPiano.cpp

@ -64,6 +64,8 @@ uint8_t voice = 0;
float vol = VOLUME;
float vol_right = 1.0;
float vol_left = 1.0;
elapsedMicros fill_audio_buffer;
const uint16_t audio_block_time_us = 1000000 / (SAMPLE_RATE / AUDIO_BLOCK_SAMPLES);
#ifdef MASTER_KEY_MIDI
bool master_key_enabled = false;
@ -173,6 +175,23 @@ void setup()
sched_note_off.begin(note_off, 6333333);
#endif
/*
0 decay
1 release
2 hardness
3 treble
4 pan_trem
5 lfo_rate
6 velocity_sense
7 stereo
8 max_poly
9 tune
10 detune
11 overdrive
*/
//ep->setParameter(11,1.0); // overdrive
//ep->setParameter(10,1.0); // overdrive
Serial.println(F("<setup end>"));
#if defined (DEBUG) && defined (SHOW_CPU_LOAD_MSEC)
@ -188,8 +207,10 @@ void loop()
const uint16_t audio_block_time_ms = 1000000 / (SAMPLE_RATE / AUDIO_BLOCK_SAMPLES);
// Main sound calculation
if (queue_r.available() && queue_l.available())
if (queue_r.available() && queue_l.available() && fill_audio_buffer > audio_block_time_us - 10)
{
fill_audio_buffer = 0;
audio_buffer_r = queue_r.getBuffer();
audio_buffer_l = queue_l.getBuffer();
@ -201,8 +222,6 @@ void loop()
}
#endif
handle_input();
audio_buffer_r = queue_r.getBuffer();
if (audio_buffer_r == NULL)
{
@ -242,6 +261,8 @@ void loop()
queue_r.playBuffer();
queue_l.playBuffer();
}
handle_input();
}
void handle_input(void)

@ -90,25 +90,25 @@ mdaEPiano::mdaEPiano() // mdaEPiano::mdaEPiano(audioMasterCallback audioMaster)
kgrp[31].pos = 406046; kgrp[31].end = 414486; kgrp[31].loop = 2306; //ghost
kgrp[32].pos = 414487; kgrp[32].end = 422408; kgrp[32].loop = 2169;
/*
//extra xfade looping...
for (int32_t k = 0; k < 28; k++)
{
int32_t p0 = kgrp[k].end;
int32_t p1 = kgrp[k].end - kgrp[k].loop;
/*
//extra xfade looping...
for (int32_t k = 0; k < 28; k++)
{
int32_t p0 = kgrp[k].end;
int32_t p1 = kgrp[k].end - kgrp[k].loop;
float xf = 1.0f;
float dxf = -0.02f;
float xf = 1.0f;
float dxf = -0.02f;
while (xf > 0.0f)
{
waves[p0] = (short)((1.0f - xf) * (float)waves[p0] + xf * (float)waves[p1]);
while (xf > 0.0f)
{
waves[p0] = (short)((1.0f - xf) * (float)waves[p0] + xf * (float)waves[p1]);
p0--;
p1--;
xf += dxf;
p0--;
p1--;
xf += dxf;
}
}
}
*/
//initialise...
@ -235,7 +235,7 @@ void mdaEPiano::process(int16_t *outputs_r, int16_t *outputs_l)
}
l += V->outl * x;
r += V->outr * x;
V++;
}
@ -249,8 +249,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 * 0x7fff) >> REDUCE_LOUDNESS;
outputs_r[frame] = static_cast<int16_t>(r * 0x7fff) >> REDUCE_LOUDNESS;
outputs_l[frame] += static_cast<int16_t>((l * 0.5) * 0x7fff);
outputs_r[frame] += static_cast<int16_t>((r * 0.5) * 0x7fff);
}
if (fabs(tl) < 1.0e-10) tl = 0.0f; //anti-denormal

Loading…
Cancel
Save