Merge remote-tracking branch 'origin' into effects

pull/4/head
Holger Wirtz 6 years ago
commit e2ad1df2c2
  1. 11
      MicroDexed.ino
  2. 4
      UI.cpp
  3. 5
      config.h
  4. BIN
      doc/MicroDexed_Latency.png

@ -119,6 +119,7 @@ uint8_t effect_delay_time = 0;
uint8_t effect_delay_feedback = 0; uint8_t effect_delay_feedback = 0;
uint8_t effect_delay_volume = 0; uint8_t effect_delay_volume = 0;
bool effect_delay_sync = 0; bool effect_delay_sync = 0;
elapsedMicros fill_audio_buffer;
#ifdef MASTER_KEY_MIDI #ifdef MASTER_KEY_MIDI
bool master_key_enabled = false; bool master_key_enabled = false;
@ -332,16 +333,18 @@ void setup()
void loop() void loop()
{ {
int16_t* audio_buffer; // pointer to AUDIO_BLOCK_SAMPLES * int16_t 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 // 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(); audio_buffer = queue1.getBuffer();
elapsedMicros t1; elapsedMicros t1;
dexed->getSamples(AUDIO_BLOCK_SAMPLES, audio_buffer); 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++; xrun++;
if (t1 > render_time_max) if (t1 > render_time_max)
render_time_max = t1; render_time_max = t1;
@ -366,6 +369,7 @@ void loop()
// MIDI input handling // MIDI input handling
handle_input(); handle_input();
#ifdef I2C_DISPLAY #ifdef I2C_DISPLAY
// UI // UI
if (master_timer >= TIMER_UI_HANDLING_MS) 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) mixer2.gain(1, mapfloat(effect_delay_volume, 0, ENC_DELAY_VOLUME_STEPS, 0.0, 1.0)); // delay tap1 signal (with added feedback)
break; break;
default: default:
ret = dexed->processMidiMessage(type, data1, data2);
break; break;
} }
} }

@ -74,6 +74,7 @@ void handle_ui(void)
#ifdef DEBUG #ifdef DEBUG
Serial.print(F("Long button pressing detected for button ")); Serial.print(F("Long button pressing detected for button "));
Serial.println(i, DEC); Serial.println(i, DEC);
#endif
switch (i) switch (i)
{ {
@ -103,7 +104,6 @@ void handle_ui(void)
} }
break; break;
} }
#endif
} }
else else
{ {
@ -559,7 +559,7 @@ void ui_show_effects_delay(void)
lcd.show(1, 8, 5, "Vol:"); lcd.show(1, 8, 5, "Vol:");
} }
lcd.show(0, 9, 4, map(effect_delay_time, 0, ENC_DELAY_TIME_STEPS, 0, 1200)); lcd.show(0, 9, 4, map(effect_delay_time, 0, ENC_DELAY_TIME_STEPS, 0, DELAY_MAX_TIME));
lcd.show(1, 4, 2, map(effect_delay_feedback, 0, ENC_DELAY_FB_STEPS, 0, 99)); lcd.show(1, 4, 2, map(effect_delay_feedback, 0, ENC_DELAY_FB_STEPS, 0, 99));
lcd.show(1, 13, 2, map(effect_delay_volume, 0, ENC_DELAY_VOLUME_STEPS, 0, 99)); lcd.show(1, 13, 2, map(effect_delay_volume, 0, ENC_DELAY_VOLUME_STEPS, 0, 99));

@ -44,8 +44,10 @@
//#define DEXED_ENGINE DEXED_ENGINE_MODERN //#define DEXED_ENGINE DEXED_ENGINE_MODERN
#ifndef TEENSY_AUDIO_BOARD #ifndef TEENSY_AUDIO_BOARD
#define AUDIO_MEM 450 #define AUDIO_MEM 450
#define DELAY_MAX_TIME 600.0
#else #else
#define AUDIO_MEM 900 #define AUDIO_MEM 900
#define DELAY_MAX_TIME 1200.0
#endif #endif
#define SAMPLE_RATE 44100 #define SAMPLE_RATE 44100
#define MAX_BANKS 100 #define MAX_BANKS 100
@ -62,7 +64,6 @@
// EFFECTS // EFFECTS
#define FILTER_MAX_FREQ 10000 #define FILTER_MAX_FREQ 10000
#define DELAY_MAX_TIME 1200.0
// Master key handling (comment for disabling) // Master key handling (comment for disabling)
//#define MASTER_KEY_MIDI MIDI_C7 //#define MASTER_KEY_MIDI MIDI_C7
@ -70,7 +71,7 @@
// Debug output // Debug output
#define SERIAL_SPEED 38400 #define SERIAL_SPEED 38400
#define DEBUG 1 //#define DEBUG 1
#define SHOW_MIDI_EVENT 1 #define SHOW_MIDI_EVENT 1
#define SHOW_XRUN 1 #define SHOW_XRUN 1
#define SHOW_CPU_LOAD_MSEC 5000 #define SHOW_CPU_LOAD_MSEC 5000

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

Loading…
Cancel
Save