From 7d1ce9bce6abf37eb233d691eab509cfeaef1ce6 Mon Sep 17 00:00:00 2001 From: Holger Wirtz Date: Thu, 1 Jul 2021 18:42:03 +0200 Subject: [PATCH] Testing delay-sync to midi clock. --- MicroDexed.ino | 11 +++++++++-- config.h | 4 ++-- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/MicroDexed.ino b/MicroDexed.ino index a542b5c..14b0445 100644 --- a/MicroDexed.ino +++ b/MicroDexed.ino @@ -224,7 +224,7 @@ uint8_t midi_ticks[10] = {0, 6, 9, 12, 18, 24, 36, 48, 72, 96}; uint8_t midi_bpm_counter = 0; elapsedMillis midi_bpm; #ifdef USE_FX -uint8_t midi_timing_counter[NUM_DEXED]; +uint8_t midi_timing_counter[NUM_DEXED] = {0, 0}; elapsedMillis midi_timing_timer[NUM_DEXED]; #endif elapsedMillis long_button_pressed; @@ -1407,7 +1407,14 @@ void handleClock(void) if (midi_timing_counter[instance_id] % midi_ticks[configuration.fx.delay_sync[instance_id]] == 0) { int32_t t = midi_timing_timer[instance_id]; - delay_fx[instance_id]->delay(0, constrain(t, DELAY_TIME_MIN, DELAY_TIME_MAX)); + delay_fx[instance_id]->delay(0, constrain(t*10, DELAY_TIME_MIN*10, DELAY_TIME_MAX*10)); +#ifdef DEBUG + Serial.print(F("Delay-Sync to ")); + Serial.print(constrain(t, DELAY_TIME_MIN, DELAY_TIME_MAX), DEC); + Serial.print(F(" ms / ")); + Serial.print(midi_timing_counter[instance_id], DEC); + Serial.println(F(" ticks")); +#endif midi_timing_counter[instance_id] = 0; midi_timing_timer[instance_id] = 0; } diff --git a/config.h b/config.h index ffe9815..98b91aa 100644 --- a/config.h +++ b/config.h @@ -172,7 +172,7 @@ #if defined(TEENSY3_6) #define DELAY_MAX_TIME 500 #elif defined(TEENSY4) -#define DELAY_MAX_TIME 1000 +#define DELAY_MAX_TIME 1500 #else #define DELAY_MAX_TIME 250 #endif @@ -420,7 +420,7 @@ #define DELAY_SYNC_MIN 0 #define DELAY_SYNC_MAX 9 -#define DELAY_SYNC_DEFAULT 0 +#define DELAY_SYNC_DEFAULT 7 #define REVERB_ROOMSIZE_MIN 0 #define REVERB_ROOMSIZE_MAX 100