diff --git a/MicroDexed.ino b/MicroDexed.ino index 2d12de5..eb24cdc 100644 --- a/MicroDexed.ino +++ b/MicroDexed.ino @@ -345,7 +345,7 @@ void setup() chorus_mixer.gain(0, 1.0); chorus_mixer.gain(1, 0.0); - delay1.delay(0, mapfloat(effect_delay_feedback, 0, ENC_DELAY_TIME_STEPS, 0.0, DELAY_MAX_TIME)); + delay1.delay(0, 0.0); // delay_fb_mixer is the feedback-adding mixer, delay_mixer_r the whole delay (with/without feedback) mixer delay_fb_mixer.gain(0, 1.0); // original signal delay_fb_mixer.gain(1, mapfloat(effect_delay_feedback, 0, ENC_DELAY_FB_STEPS, 0.0, 1.0)); // amount of feedback diff --git a/UI.hpp b/UI.hpp index dbbfc93..9ab5168 100644 --- a/UI.hpp +++ b/UI.hpp @@ -677,7 +677,7 @@ void UI_func_reverb_roomsize(uint8_t param) lcd.setCursor(0, 1); lcd_display_int(configuration.reverb_roomsize, 3, true, true, false); - freeverbs1.roomsize(configuration.reverb_roomsize / 100); + freeverbs1.roomsize(configuration.reverb_roomsize / 100.0); } if (LCDML.FUNC_close()) // ****** STABLE END ********* @@ -718,7 +718,7 @@ void UI_func_reverb_damping(uint8_t param) lcd.setCursor(0, 1); lcd_display_int(configuration.reverb_damping, 3, true, true, false); - freeverbs1.damping(configuration.reverb_damping / 100); + freeverbs1.damping(configuration.reverb_damping / 100.0); } if (LCDML.FUNC_close()) // ****** STABLE END ********* @@ -760,8 +760,8 @@ void UI_func_reverb_level(uint8_t param) lcd.setCursor(0, 1); lcd_display_int(configuration.reverb_level, 3, true, true, false); - reverb_mixer_r.gain(1, configuration.reverb_level / 100); - reverb_mixer_l.gain(1, configuration.reverb_level / 100); + reverb_mixer_r.gain(1, configuration.reverb_level / 100.0); + reverb_mixer_l.gain(1, configuration.reverb_level / 100.0); } if (LCDML.FUNC_close()) // ****** STABLE END ********* @@ -896,7 +896,7 @@ void UI_func_chorus_depth(uint8_t param) lcd.setCursor(0, 1); lcd_display_int(configuration.chorus_depth, 3, true, true, false); - modulator.amplitude(configuration.chorus_depth / 100); + modulator.amplitude(configuration.chorus_depth / 100.0); } if (LCDML.FUNC_close()) // ****** STABLE END ********* @@ -937,7 +937,7 @@ void UI_func_chorus_level(uint8_t param) lcd.setCursor(0, 1); lcd_display_int(configuration.chorus_level, 3, true, true, false); - chorus_mixer.gain(1, configuration.chorus_level / 100); + chorus_mixer.gain(1, configuration.chorus_level / 100.0); } if (LCDML.FUNC_close()) // ****** STABLE END ********* @@ -948,17 +948,126 @@ void UI_func_chorus_level(uint8_t param) void UI_func_delay_time(uint8_t param) { - ; + if (LCDML.FUNC_setup()) // ****** SETUP ********* + { + // setup function + lcd.setCursor(0, 0); + lcd.print(F("Delay Time")); + } + + if (LCDML.FUNC_loop()) // ****** LOOP ********* + { + if (LCDML.BT_checkEnter()) + { + LCDML.FUNC_goBackToMenu(); + } + else if (LCDML.BT_checkDown()) + { + if (configuration.delay_time < DELAY_TIME_MAX) + { + configuration.delay_time += 10; + } + } + else if (LCDML.BT_checkUp()) + { + if (configuration.delay_time > DELAY_TIME_MIN) + { + configuration.delay_time -= 10; + } + } + lcd.setCursor(0, 1); + lcd_display_int(configuration.delay_time * 10, 3, true, true, false); + + delay1.delay(0, configuration.delay_time * 10); + } + + if (LCDML.FUNC_close()) // ****** STABLE END ********* + { + // you can here reset some global vars or do nothing + } } void UI_func_delay_feedback(uint8_t param) { - ; + if (LCDML.FUNC_setup()) // ****** SETUP ********* + { + // setup function + lcd.setCursor(0, 0); + lcd.print(F("Delay Feedback")); + } + + if (LCDML.FUNC_loop()) // ****** LOOP ********* + { + if (LCDML.BT_checkEnter()) + { + LCDML.FUNC_goBackToMenu(); + } + else if (LCDML.BT_checkDown()) + { + if (configuration.delay_feedback < DELAY_FEEDBACK_MAX) + { + configuration.delay_feedback++; + } + } + else if (LCDML.BT_checkUp()) + { + if (configuration.delay_feedback > DELAY_FEEDBACK_MIN) + { + configuration.delay_feedback--; + } + } + lcd.setCursor(0, 1); + lcd_display_int(configuration.delay_feedback, 3, true, true, false); + + delay_fb_mixer.gain(1, configuration.delay_feedback / 100.0 ); // amount of feedback + delay_mixer.gain(0, 1.0 - configuration.delay_feedback / 100.0); // original signal + } + + if (LCDML.FUNC_close()) // ****** STABLE END ********* + { + // you can here reset some global vars or do nothing + } } void UI_func_delay_level(uint8_t param) { - ; + if (LCDML.FUNC_setup()) // ****** SETUP ********* + { + // setup function + lcd.setCursor(0, 0); + lcd.print(F("Delay Level")); + } + + if (LCDML.FUNC_loop()) // ****** LOOP ********* + { + if (LCDML.BT_checkEnter()) + { + LCDML.FUNC_goBackToMenu(); + } + else if (LCDML.BT_checkDown()) + { + if (configuration.delay_level < DELAY_LEVEL_MAX) + { + configuration.delay_level++; + } + } + else if (LCDML.BT_checkUp()) + { + if (configuration.delay_level > DELAY_LEVEL_MIN) + { + configuration.delay_level--; + } + } + lcd.setCursor(0, 1); + lcd_display_int(configuration.delay_level, 3, true, true, false); + + delay_mixer.gain(1, configuration.delay_level / 100.0); + } + + if (LCDML.FUNC_close()) // ****** STABLE END ********* + { + // you can here reset some global vars or do nothing + } } void UI_func_filter_cutoff(uint8_t param) diff --git a/config.h b/config.h index 6d34375..ce0cef6 100644 --- a/config.h +++ b/config.h @@ -88,7 +88,7 @@ #else #define AUDIO_MEM 225 #endif -#define DELAY_MAX_TIME 600.0 +#define DELAY_MAX_TIME 600 #define REDUCE_LOUDNESS 1 #else #if AUDIO_BLOCK_SAMPLES == 64 @@ -96,7 +96,7 @@ #else #define AUDIO_MEM 450 #endif -#define DELAY_MAX_TIME 1200.0 +#define DELAY_MAX_TIME 1200 #define REDUCE_LOUDNESS 1 #endif #define SAMPLE_RATE 44100 @@ -246,6 +246,18 @@ #define CHORUS_LEVEL_MAX 100 #define CHORUS_LEVEL_DEFAULT 0 +#define DELAY_TIME_MIN 0 +#define DELAY_TIME_MAX DELAY_MAX_TIME/10 +#define DELAY_TIME_DEFAULT 0 + +#define DELAY_FEEDBACK_MIN 0 +#define DELAY_FEEDBACK_MAX 100 +#define DELAY_FEEDBACK_DEFAULT 0 + +#define DELAY_LEVEL_MIN 0 +#define DELAY_LEVEL_MAX 100 +#define DELAY_LEVEL_DEFAULT 0 + // struct for holding the current configuration struct config_t { uint32_t checksum; @@ -262,6 +274,9 @@ struct config_t { uint8_t chorus_waveform; uint8_t chorus_depth; uint8_t chorus_level; + uint8_t delay_time; + uint8_t delay_feedback; + uint8_t delay_level; }; // struct for smoothing value changes