Small additions and fixes.

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

@ -64,6 +64,8 @@ uint8_t voice = 0;
float vol = VOLUME; float vol = VOLUME;
float vol_right = 1.0; float vol_right = 1.0;
float vol_left = 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 #ifdef MASTER_KEY_MIDI
bool master_key_enabled = false; bool master_key_enabled = false;
@ -173,6 +175,23 @@ void setup()
sched_note_off.begin(note_off, 6333333); sched_note_off.begin(note_off, 6333333);
#endif #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>")); Serial.println(F("<setup end>"));
#if defined (DEBUG) && defined (SHOW_CPU_LOAD_MSEC) #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); const uint16_t audio_block_time_ms = 1000000 / (SAMPLE_RATE / AUDIO_BLOCK_SAMPLES);
// Main sound calculation // 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_r = queue_r.getBuffer();
audio_buffer_l = queue_l.getBuffer(); audio_buffer_l = queue_l.getBuffer();
@ -201,8 +222,6 @@ void loop()
} }
#endif #endif
handle_input();
audio_buffer_r = queue_r.getBuffer(); audio_buffer_r = queue_r.getBuffer();
if (audio_buffer_r == NULL) if (audio_buffer_r == NULL)
{ {
@ -242,6 +261,8 @@ void loop()
queue_r.playBuffer(); queue_r.playBuffer();
queue_l.playBuffer(); queue_l.playBuffer();
} }
handle_input();
} }
void handle_input(void) void handle_input(void)

@ -90,7 +90,7 @@ mdaEPiano::mdaEPiano() // mdaEPiano::mdaEPiano(audioMasterCallback audioMaster)
kgrp[31].pos = 406046; kgrp[31].end = 414486; kgrp[31].loop = 2306; //ghost 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; kgrp[32].pos = 414487; kgrp[32].end = 422408; kgrp[32].loop = 2169;
/* /*
//extra xfade looping... //extra xfade looping...
for (int32_t k = 0; k < 28; k++) for (int32_t k = 0; k < 28; k++)
{ {
@ -249,8 +249,8 @@ void mdaEPiano::process(int16_t *outputs_r, int16_t *outputs_l)
l += l * lmod * lfo1; l += l * lmod * lfo1;
r += r * rmod * lfo1; //worth making all these local variables? r += r * rmod * lfo1; //worth making all these local variables?
outputs_l[frame] = static_cast<int16_t>(l * 0x7fff) >> REDUCE_LOUDNESS; outputs_l[frame] += static_cast<int16_t>((l * 0.5) * 0x7fff);
outputs_r[frame] = static_cast<int16_t>(r * 0x7fff) >> REDUCE_LOUDNESS; outputs_r[frame] += static_cast<int16_t>((r * 0.5) * 0x7fff);
} }
if (fabs(tl) < 1.0e-10) tl = 0.0f; //anti-denormal if (fabs(tl) < 1.0e-10) tl = 0.0f; //anti-denormal

Loading…
Cancel
Save