diff --git a/MicroDexed.ino b/MicroDexed.ino index 665d762..c91f9b1 100644 --- a/MicroDexed.ino +++ b/MicroDexed.ino @@ -1414,11 +1414,11 @@ void handleClock(void) { if (configuration.fx.delay_sync[instance_id] > 0) { - uint16_t t = uint16_t(60.0 / float(midi_bpm) * 1000.0 * midi_ticks_factor[configuration.fx.delay_sync[instance_id]] + 0.5); - delay_fx[instance_id]->delay(0, constrain(t, DELAY_TIME_MIN * 10, DELAY_TIME_MAX * 10)); + uint16_t midi_sync_delay_time = uint16_t(60.0 / float(midi_bpm) * 1000.0 * midi_ticks_factor[configuration.fx.delay_sync[instance_id]] + 0.5); + delay_fx[instance_id]->delay(0, constrain(midi_sync_delay_time, DELAY_TIME_MIN * 10, DELAY_TIME_MAX * 10)); #ifdef DEBUG Serial.print(F("Setting Delay-Sync to ")); - Serial.print(constrain(t, DELAY_TIME_MIN * 10, DELAY_TIME_MAX * 10), DEC); + Serial.print(constrain(midi_sync_delay_time, DELAY_TIME_MIN * 10, DELAY_TIME_MAX * 10), DEC); Serial.println(F(" ms")); #endif } @@ -2183,13 +2183,6 @@ void check_and_create_directories(void) // create directories for banks for (i = 0; i < MAX_BANKS; i++) { -#ifdef ENABLE_LCD_UI - lcd.clear(); - lcd.setCursor(0, 0); - lcd.print(F("Setting up SD")); - lcd.setCursor(0, 1); - lcd.print(F("Please wait...")); -#endif sprintf(tmp, "/%d", i); if (!SD.exists(tmp)) { diff --git a/UI.hpp b/UI.hpp index 4a31960..3e27922 100644 --- a/UI.hpp +++ b/UI.hpp @@ -103,6 +103,9 @@ extern char g_voice_name[NUM_DEXED][VOICE_NAME_LEN]; extern char g_bank_name[NUM_DEXED][BANK_NAME_LEN]; extern int perform_attack_mod[NUM_DEXED]; extern int perform_release_mod[NUM_DEXED]; +extern float midi_ticks_factor[10]; +extern uint8_t midi_bpm; + /*********************************************************************** GLOBAL ************************************************************************/ @@ -6037,34 +6040,49 @@ void lcd_display_delay_sync(uint8_t sync) switch (sync) { case 1: - lcd.show(1, 10, 5, "1/16"); + lcd.show(1, 10, 6, "1/16"); break; case 2: - lcd.show(1, 10, 5, "1/16T"); + lcd.show(1, 10, 6, "1/16T"); break; case 3: - lcd.show(1, 10, 5, "1/8"); + lcd.show(1, 10, 6, "1/8"); break; case 4: - lcd.show(1, 10, 5, "1/8T"); + lcd.show(1, 10, 6, "1/8T"); break; case 5: - lcd.show(1, 10, 5, "1/4"); + lcd.show(1, 10, 6, "1/4"); break; case 6: - lcd.show(1, 10, 5, "1/4T"); + lcd.show(1, 10, 6, "1/4T"); break; case 7: - lcd.show(1, 10, 5, "1/2"); + lcd.show(1, 10, 6, "1/2"); break; case 8: - lcd.show(1, 10, 5, "1/2T"); + lcd.show(1, 10, 6, "1/2T"); break; case 9: - lcd.show(1, 10, 5, "1/1"); + lcd.show(1, 10, 6, "1/1"); break; } + + uint16_t midi_sync_delay_time = uint16_t(1000.0 * midi_bpm * midi_ticks_factor[sync] / 60.0 + 0.5); + if (midi_sync_delay_time > DELAY_MAX_TIME) + { +#ifdef DEBUG + Serial.println(F("Calculated MIDI-Sync delay: ")); + Serial.print(round(1000.0 * midi_bpm * midi_ticks_factor[sync] / 60.0), DEC); + Serial.println(F("ms")); + Serial.println(F("MIDI-Sync delay: midi_sync_delay_time")); + Serial.print(midi_sync_delay_time, DEC); + Serial.println(F("ms")); +#endif + lcd.show(1, 15, 1, "!"); + } } + void eeprom_update_var(uint16_t pos, uint8_t val, const char* val_string) { #ifdef DEBUG diff --git a/config.h b/config.h index 1a1eeb3..747927d 100644 --- a/config.h +++ b/config.h @@ -101,7 +101,7 @@ // Number of Dexed instances #define NUM_DEXED 2 // 1 or 2 - nothing else! // FX-CHAIN ENABLE/DISABLE -//#define USE_FX 1 +#define USE_FX 1 // COMPRESSOR/ LIMITER #define COMP_THRESHOLD -20.0 #define COMP_ATTACK 0.2