|
|
|
@ -119,6 +119,7 @@ uint8_t effect_delay_time = 0; |
|
|
|
|
uint8_t effect_delay_feedback = 0; |
|
|
|
|
uint8_t effect_delay_volume = 0; |
|
|
|
|
bool effect_delay_sync = 0; |
|
|
|
|
elapsedMicros fill_audio_buffer; |
|
|
|
|
|
|
|
|
|
#ifdef MASTER_KEY_MIDI |
|
|
|
|
bool master_key_enabled = false; |
|
|
|
@ -332,16 +333,18 @@ void setup() |
|
|
|
|
void loop() |
|
|
|
|
{ |
|
|
|
|
int16_t* audio_buffer; // pointer to AUDIO_BLOCK_SAMPLES * int16_t
|
|
|
|
|
const uint16_t audio_block_time_ms = 1000000 / (SAMPLE_RATE / AUDIO_BLOCK_SAMPLES); |
|
|
|
|
const uint16_t audio_block_time_us = 1000000 / (SAMPLE_RATE / AUDIO_BLOCK_SAMPLES); |
|
|
|
|
|
|
|
|
|
// Main sound calculation
|
|
|
|
|
if (queue1.available()) |
|
|
|
|
if (queue1.available() && fill_audio_buffer > audio_block_time_us - 10) |
|
|
|
|
{ |
|
|
|
|
fill_audio_buffer = 0; |
|
|
|
|
|
|
|
|
|
audio_buffer = queue1.getBuffer(); |
|
|
|
|
|
|
|
|
|
elapsedMicros t1; |
|
|
|
|
dexed->getSamples(AUDIO_BLOCK_SAMPLES, audio_buffer); |
|
|
|
|
if (t1 > audio_block_time_ms) // everything greater 2.9ms is a buffer underrun!
|
|
|
|
|
if (t1 > audio_block_time_us) // everything greater 2.9ms is a buffer underrun!
|
|
|
|
|
xrun++; |
|
|
|
|
if (t1 > render_time_max) |
|
|
|
|
render_time_max = t1; |
|
|
|
@ -366,6 +369,7 @@ void loop() |
|
|
|
|
|
|
|
|
|
// MIDI input handling
|
|
|
|
|
handle_input(); |
|
|
|
|
|
|
|
|
|
#ifdef I2C_DISPLAY |
|
|
|
|
// UI
|
|
|
|
|
if (master_timer >= TIMER_UI_HANDLING_MS) |
|
|
|
@ -654,6 +658,7 @@ bool queue_midi_event(uint8_t type, uint8_t data1, uint8_t data2) |
|
|
|
|
mixer2.gain(1, mapfloat(effect_delay_volume, 0, ENC_DELAY_VOLUME_STEPS, 0.0, 1.0)); // delay tap1 signal (with added feedback)
|
|
|
|
|
break; |
|
|
|
|
default: |
|
|
|
|
ret = dexed->processMidiMessage(type, data1, data2); |
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|