From 71412c4bd664ac5545614f8e0d3ddcd7bee0b85c Mon Sep 17 00:00:00 2001 From: Holger Wirtz Date: Sun, 14 Mar 2021 11:43:44 +0100 Subject: [PATCH] Startet to add plate reverb parameters to menu (T_4.x only). --- MicroDexed.ino | 51 ++++++++++++++++---- UI.hpp | 35 ++++++++++++-- UI_FX_T4.h | 125 +++++++++++++++++++++++++++++++++++++++++++++++++ config.h | 20 ++++++++ 4 files changed, 218 insertions(+), 13 deletions(-) create mode 100644 UI_FX_T4.h diff --git a/MicroDexed.ino b/MicroDexed.ino index e778cd8..f5055fd 100644 --- a/MicroDexed.ino +++ b/MicroDexed.ino @@ -1568,8 +1568,16 @@ void check_configuration(void) configuration.performance.fx_number = constrain(configuration.performance.fx_number, FX_NUM_MIN, FX_NUM_MAX); - configuration.fx.reverb_roomsize = constrain(configuration.fx.reverb_roomsize, REVERB_ROOMSIZE_MIN, REVERB_ROOMSIZE_MAX); +#ifdef USE_PLATEREVERB + configuration.fx.reverb_lowpass = constrain(configuration.fx.reverb_lowpass, REVERB_LOWPASS_MIN, REVERB_LOWPASS_MAX); + configuration.fx.reverb_lodamp = constrain(configuration.fx.reverb_lodamp, REVERB_LODAMP_MIN, REVERB_LODAMP_MAX); + configuration.fx.reverb_hidamp = constrain(configuration.fx.reverb_hidamp, REVERB_HIDAMP_MIN, REVERB_HIDAMP_MAX); + configuration.fx.reverb_diffusion = constrain(configuration.fx.reverb_diffusion, REVERB_DIFFUSION_MIN, REVERB_DIFFUSION_MAX); +#else configuration.fx.reverb_damping = constrain(configuration.fx.reverb_damping, REVERB_DAMPING_MIN, REVERB_DAMPING_MAX); +#endif + + configuration.fx.reverb_roomsize = constrain(configuration.fx.reverb_roomsize, REVERB_ROOMSIZE_MIN, REVERB_ROOMSIZE_MAX); configuration.fx.reverb_level = constrain(configuration.fx.reverb_level, REVERB_LEVEL_MIN, REVERB_LEVEL_MAX); for (uint8_t instance_id = 0; instance_id < NUM_DEXED; instance_id++) @@ -1585,7 +1593,7 @@ void check_configuration(void) configuration.dexed[instance_id].pan = constrain(configuration.dexed[instance_id].pan, PANORAMA_MIN, PANORAMA_MAX); configuration.dexed[instance_id].transpose = constrain(configuration.dexed[instance_id].transpose, TRANSPOSE_MIN, TRANSPOSE_MAX); configuration.dexed[instance_id].tune = constrain(configuration.dexed[instance_id].tune, TUNE_MIN, TUNE_MAX); - configuration.dexed[instance_id].polyphony = constrain(configuration.dexed[instance_id].polyphony, POLYPHONY_MIN, POLYPHONY_MAX/instance_id); + configuration.dexed[instance_id].polyphony = constrain(configuration.dexed[instance_id].polyphony, POLYPHONY_MIN, POLYPHONY_MAX / instance_id); configuration.dexed[instance_id].velocity_level = constrain(configuration.dexed[instance_id].velocity_level, VELOCITY_LEVEL_MIN, VELOCITY_LEVEL_MAX); configuration.dexed[instance_id].engine = constrain(configuration.dexed[instance_id].engine, ENGINE_MIN, ENGINE_MAX); configuration.dexed[instance_id].monopoly = constrain(configuration.dexed[instance_id].monopoly, MONOPOLY_MIN, MONOPOLY_MAX); @@ -1634,8 +1642,16 @@ void init_configuration(void) configuration.sys.soft_midi_thru = SOFT_MIDI_THRU_DEFAULT; configuration.sys.performance_number = PERFORMANCE_NUM_DEFAULT; - configuration.fx.reverb_roomsize = REVERB_ROOMSIZE_DEFAULT; +#ifdef USE_PLATEREVERB + configuration.fx.reverb_lowpass = REVERB_LOWPASS_DEFAULT; + configuration.fx.reverb_lodamp = REVERB_LODAMP_DEFAULT; + configuration.fx.reverb_hidamp = REVERB_HIDAMP_DEFAULT; + configuration.fx.reverb_diffusion = REVERB_DIFFUSION_DEFAULT; +#else configuration.fx.reverb_damping = REVERB_DAMPING_DEFAULT; +#endif + + configuration.fx.reverb_roomsize = REVERB_ROOMSIZE_DEFAULT; configuration.fx.reverb_level = REVERB_LEVEL_DEFAULT; configuration.performance.fx_number = FX_NUM_DEFAULT; @@ -1870,11 +1886,11 @@ void set_fx_params(void) // REVERB #ifdef USE_PLATEREVERB - reverb.size(mapfloat(configuration.fx.reverb_roomsize, REVERB_ROOMSIZE_MIN, REVERB_ROOMSIZE_MAX, 0.0, 1.0)); // max reverb length - reverb.lowpass(0.3); // sets the reverb master lowpass filter - reverb.lodamp(0.1); // amount of low end loss in the reverb tail - reverb.hidamp(mapfloat(configuration.fx.reverb_damping, REVERB_DAMPING_MIN, REVERB_DAMPING_MAX, 0.0, 1.0)); // amount of treble loss in the reverb tail - reverb.diffusion(1.0); // 1.0 is the detault setting, lower it to create more "echoey" reverb + reverb.size(mapfloat(configuration.fx.reverb_roomsize, REVERB_ROOMSIZE_MIN, REVERB_ROOMSIZE_MAX, 0.0, 1.0)); + reverb.lowpass(mapfloat(configuration.fx.reverb_lowpass, REVERB_LOWPASS_MIN, REVERB_LOWPASS_MAX, 0.0, 1.0)); + reverb.lodamp(mapfloat(configuration.fx.reverb_lodamp, REVERB_LODAMP_MIN, REVERB_LODAMP_MAX, 0.0, 1.0)); + reverb.hidamp(mapfloat(configuration.fx.reverb_hidamp, REVERB_HIDAMP_MIN, REVERB_HIDAMP_MAX, 0.0, 1.0)); + reverb.diffusion(mapfloat(configuration.fx.reverb_diffusion, REVERB_DIFFUSION_MIN, REVERB_DIFFUSION_MAX, 0.0, 1.0)); #else freeverb_r.roomsize(mapfloat(configuration.fx.reverb_roomsize, REVERB_ROOMSIZE_MIN, REVERB_ROOMSIZE_MAX, 0.0, 1.0)); freeverb_r.damping(mapfloat(configuration.fx.reverb_damping, REVERB_DAMPING_MIN, REVERB_DAMPING_MAX, 0.0, 1.0)); @@ -2147,6 +2163,15 @@ void check_and_create_directories(void) #ifdef DEBUG Serial.print(F("Creating directory ")); Serial.println(tmp); +#endif + SD.mkdir(tmp); + } + sprintf(tmp, "/%s", FAV_CONFIG_PATH); + if (!SD.exists(tmp)) + { +#ifdef DEBUG + Serial.print(F("Creating directory ")); + Serial.println(tmp); #endif SD.mkdir(tmp); } @@ -2237,9 +2262,15 @@ void show_configuration(void) Serial.print(F(" Soft MIDI Thru ")); Serial.println(configuration.sys.soft_midi_thru, DEC); Serial.println(F("FX")); Serial.print(F(" Reverb Roomsize ")); Serial.println(configuration.fx.reverb_roomsize, DEC); - Serial.print(F(" Reverb Damping ")); Serial.println(configuration.fx.reverb_damping, DEC); Serial.print(F(" Reverb Level ")); Serial.println(configuration.fx.reverb_level, DEC); - +#ifdef USE_PLATEREVERB + Serial.print(F(" Reverb Lowpass ")); Serial.println(configuration.fx.reverb_lowpass, DEC); + Serial.print(F(" Reverb Lodamp ")); Serial.println(configuration.fx.reverb_lodamp, DEC); + Serial.print(F(" Reverb Hidamp ")); Serial.println(configuration.fx.reverb_hidamp, DEC); + Serial.print(F(" Reverb Diffusion ")); Serial.println(configuration.fx.reverb_diffusion, DEC); +#else + Serial.print(F(" Reverb Damping ")); Serial.println(configuration.fx.reverb_damping, DEC); +#endif for (uint8_t instance_id = 0; instance_id < NUM_DEXED; instance_id++) { diff --git a/UI.hpp b/UI.hpp index 579a2af..387f977 100644 --- a/UI.hpp +++ b/UI.hpp @@ -184,6 +184,10 @@ void lcdml_menu_control(void); #ifdef USE_FX void UI_func_reverb_roomsize(uint8_t param); void UI_func_reverb_damping(uint8_t param); +void UI_func_reverb_lowpass(uint8_t param); +void UI_func_reverb_lodamp(uint8_t param); +void UI_func_reverb_hidamp(uint8_t param); +void UI_func_reverb_diffusion(uint8_t param); void UI_func_reverb_level(uint8_t param); void UI_func_chorus_frequency(uint8_t param); void UI_func_chorus_waveform(uint8_t param); @@ -271,7 +275,11 @@ LCDMenuLib2_menu LCDML_0(255, 0, 0, NULL, NULL); // normal root menu element (do LCDMenuLib2 LCDML(LCDML_0, _LCDML_DISP_rows, _LCDML_DISP_cols, lcdml_menu_display, lcdml_menu_clear, lcdml_menu_control); #if defined(USE_FX) +#if defined(TEENSY4) +#include "UI_FX_T4.h" +#else #include "UI_FX.h" +#endif #else #include "UI_NO_FX.h" #endif @@ -754,7 +762,7 @@ void lcdml_menu_control(void) Serial.println(F("ENC-L long recognized")); #endif - //save_favorite(configuration.performance.bank[selected_instance_id], configuration.performance.voice[selected_instance_id], selected_instance_id); + save_favorite(configuration.performance.bank[selected_instance_id], configuration.performance.voice[selected_instance_id], selected_instance_id); //for (uint8_t i = 0; i < NUM_DEXED; i++) // MicroDexed[i]->panic(); @@ -984,6 +992,27 @@ void UI_func_reverb_damping(uint8_t param) } } +//// HIER +void UI_func_reverb_lowpass(uint8_t param) +{ + +} + +void UI_func_reverb_lodamp(uint8_t param) +{ + +} + +void UI_func_reverb_hidamp(uint8_t param) +{ + +} + +void UI_func_reverb_diffusion(uint8_t param) +{ + +} + void UI_func_reverb_level(uint8_t param) { if (LCDML.FUNC_setup()) // ****** SETUP ********* @@ -6080,7 +6109,7 @@ void save_favorite(uint8_t b, uint8_t v, uint8_t instance_id) #endif myFav.close(); } - lcd.setCursor(15, 1); + lcd.setCursor(13, 0); lcd.write(2); //fav symbol #ifdef DEBUG Serial.println("Added to Favorites..."); @@ -6105,7 +6134,7 @@ void save_favorite(uint8_t b, uint8_t v, uint8_t instance_id) Serial.println("Removed hasfav file since no voice in bank flagged as favorite any more"); #endif } - lcd.setCursor(15, 1); + lcd.setCursor(13, 0); lcd.print(" "); //remove fav symbol #ifdef DEBUG Serial.println("Removed from Favorites..."); diff --git a/UI_FX_T4.h b/UI_FX_T4.h new file mode 100644 index 0000000..de61f48 --- /dev/null +++ b/UI_FX_T4.h @@ -0,0 +1,125 @@ +/* + MicroDexed + + MicroDexed is a port of the Dexed sound engine + (https://github.com/asb2m10/dexed) for the Teensy-3.5/3.6/4.x with audio shield. + Dexed ist heavily based on https://github.com/google/music-synthesizer-for-android + + (c)2018-2021 H. Wirtz + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +*/ + +#ifndef _UI_H_ +#define _UI_H_ + +boolean COND_hide() // hide a menu element +{ + return false; +} + +LCDML_add(0, LCDML_0, 1, "Voice", NULL); +LCDML_add(1, LCDML_0_1, 1, "Select", UI_func_voice_select); +LCDML_add(2, LCDML_0_1, 2, "Audio", NULL); +LCDML_add(3, LCDML_0_1_2, 1, "Voice Level", UI_func_sound_intensity); +LCDML_add(4, LCDML_0_1_2, 2, "Panorama", UI_func_panorama); +LCDML_add(5, LCDML_0_1_2, 3, "Effects", NULL); +LCDML_add(6, LCDML_0_1_2_3, 1, "Chorus", NULL); +LCDML_add(7, LCDML_0_1_2_3_1, 1, "Frequency", UI_func_chorus_frequency); +LCDML_add(8, LCDML_0_1_2_3_1, 2, "Waveform", UI_func_chorus_waveform); +LCDML_add(9, LCDML_0_1_2_3_1, 3, "Depth", UI_func_chorus_depth); +LCDML_add(10, LCDML_0_1_2_3_1, 4, "Level", UI_func_chorus_level); +LCDML_add(11, LCDML_0_1_2_3, 2, "Delay", NULL); +LCDML_add(12, LCDML_0_1_2_3_2, 1, "Time", UI_func_delay_time); +LCDML_add(13, LCDML_0_1_2_3_2, 2, "Feedback", UI_func_delay_feedback); +LCDML_add(14, LCDML_0_1_2_3_2, 3, "Level", UI_func_delay_level); +LCDML_add(15, LCDML_0_1_2_3, 3, "Filter", NULL); +LCDML_add(16, LCDML_0_1_2_3_3, 1, "Cutoff", UI_func_filter_cutoff); +LCDML_add(17, LCDML_0_1_2_3_3, 2, "Resonance", UI_func_filter_resonance); +LCDML_add(18, LCDML_0_1_2_3, 4, "Reverb", NULL); +LCDML_add(19, LCDML_0_1_2_3_4, 1, "Roomsize", UI_func_reverb_roomsize); +LCDML_add(20, LCDML_0_1_2_3_4, 2, "Lowpass", UI_func_reverb_lowpass); +LCDML_add(21, LCDML_0_1_2_3_4, 3, "Lodamp", UI_func_reverb_lodamp); +LCDML_add(22, LCDML_0_1_2_3_4, 4, "Hidamp", UI_func_reverb_hidamp); +LCDML_add(23, LCDML_0_1_2_3_4, 5, "Diffusion", UI_func_reverb_diffusion); +LCDML_add(24, LCDML_0_1_2_3_4, 6, "Level", UI_func_reverb_level); +LCDML_add(25, LCDML_0_1_2_3_4, 7, "Reverb Send", UI_func_reverb_send); +LCDML_add(26, LCDML_0_1_2_3, 5, "EQ", NULL); +LCDML_add(27, LCDML_0_1_2_3_5, 1, "Bass", UI_func_eq_bass); +LCDML_add(28, LCDML_0_1_2_3_5, 2, "Treble", UI_func_eq_treble); +LCDML_add(29, LCDML_0_1, 3, "Controller", NULL); +LCDML_add(30, LCDML_0_1_3, 1, "Pitchbend", NULL); +LCDML_add(31, LCDML_0_1_3_1, 1, "PB Range", UI_func_pb_range); +LCDML_add(32, LCDML_0_1_3_1, 2, "PB Step", UI_func_pb_step); +LCDML_add(33, LCDML_0_1_3, 2, "Mod Wheel", NULL); +LCDML_add(34, LCDML_0_1_3_2, 1, "MW Range", UI_func_mw_range); +LCDML_add(35, LCDML_0_1_3_2, 2, "MW Assign", UI_func_mw_assign); +LCDML_add(36, LCDML_0_1_3_2, 3, "MW Mode", UI_func_mw_mode); +LCDML_add(37, LCDML_0_1_3, 3, "Aftertouch", NULL); +LCDML_add(38, LCDML_0_1_3_3, 1, "AT Range", UI_func_at_range); +LCDML_add(39, LCDML_0_1_3_3, 2, "AT Assign", UI_func_at_assign); +LCDML_add(40, LCDML_0_1_3_3, 3, "AT Mode", UI_func_at_mode); +LCDML_add(41, LCDML_0_1_3, 4, "Foot Ctrl", NULL); +LCDML_add(42, LCDML_0_1_3_4, 1, "FC Range", UI_func_fc_range); +LCDML_add(43, LCDML_0_1_3_4, 2, "FC Assign", UI_func_fc_assign); +LCDML_add(44, LCDML_0_1_3_4, 3, "FC Mode", UI_func_fc_mode); +LCDML_add(45, LCDML_0_1_3, 5, "Breath Ctrl", NULL); +LCDML_add(46, LCDML_0_1_3_5, 1, "BC Range", UI_func_bc_range); +LCDML_add(47, LCDML_0_1_3_5, 2, "BC Assign", UI_func_bc_assign); +LCDML_add(48, LCDML_0_1_3_5, 3, "BC Mode", UI_func_bc_mode); +LCDML_add(49, LCDML_0_1, 4, "MIDI", NULL); +LCDML_add(50, LCDML_0_1_4, 1, "MIDI Channel", UI_func_midi_channel); +LCDML_add(51, LCDML_0_1_4, 2, "Lowest Note", UI_func_lowest_note); +LCDML_add(52, LCDML_0_1_4, 3, "Highest Note", UI_func_highest_note); +LCDML_add(53, LCDML_0_1_4, 4, "MIDI Send Voice", UI_func_sysex_send_voice); +LCDML_add(54, LCDML_0_1, 5, "Setup", NULL); +LCDML_add(55, LCDML_0_1_5, 1, "Portamento", NULL); +LCDML_add(56, LCDML_0_1_5_1, 1, "Port. Mode", UI_func_portamento_mode); +LCDML_add(57, LCDML_0_1_5_1, 2, "Port. Gliss", UI_func_portamento_glissando); +LCDML_add(58, LCDML_0_1_5_1, 3, "Port. Time", UI_func_portamento_time); +LCDML_add(59, LCDML_0_1_5, 2, "Polyphony", UI_func_polyphony); +LCDML_add(60, LCDML_0_1_5, 3, "Transpose", UI_func_transpose); +LCDML_add(61, LCDML_0_1_5, 4, "Fine Tune", UI_func_tune); +LCDML_add(62, LCDML_0_1_5, 5, "Mono/Poly", UI_func_mono_poly); +LCDML_add(63, LCDML_0_1, 6, "Internal", NULL); +LCDML_add(64, LCDML_0_1_6, 1, "Note Refresh", UI_func_note_refresh); +LCDML_add(65, LCDML_0_1_6, 2, "Velocity Lvl", UI_func_velocity_level); +LCDML_add(66, LCDML_0_1_6, 3, "Engine", UI_func_engine); +LCDML_add(67, LCDML_0_1, 7, "Operator", UI_handle_OP); +LCDML_add(68, LCDML_0_1, 8, "Save Voice", UI_func_save_voice); +LCDML_add(69, LCDML_0, 3, "Load/Save", NULL); +LCDML_add(70, LCDML_0_3, 1, "Performance", NULL); +LCDML_add(71, LCDML_0_3_1, 1, "Load Perf.", UI_func_load_performance); +LCDML_add(72, LCDML_0_3_1, 2, "Save Perf.", UI_func_save_performance); +LCDML_add(73, LCDML_0_3, 2, "Voice Config", NULL); +LCDML_add(74, LCDML_0_3_2, 1, "Load Voice Cfg", UI_func_load_voiceconfig); +LCDML_add(75, LCDML_0_3_2, 2, "Save Voice Cfg", UI_func_save_voiceconfig); +LCDML_add(76, LCDML_0_3, 3, "Effects", NULL); +LCDML_add(77, LCDML_0_3_3, 1, "Load Effects", UI_func_load_fx); +LCDML_add(78, LCDML_0_3_3, 2, "Save Effects", UI_func_save_fx); +LCDML_add(79, LCDML_0_3, 5, "MIDI", NULL); +LCDML_add(80, LCDML_0_3_5, 1, "MIDI Recv Bank", UI_func_sysex_receive_bank); +LCDML_add(81, LCDML_0_3_5, 2, "MIDI Snd Bank", UI_func_sysex_send_bank); +LCDML_add(82, LCDML_0_3_5, 3, "MIDI Snd Voice", UI_func_sysex_send_voice); +LCDML_add(83, LCDML_0, 4, "System", NULL); +//LCDML_add81, LCDML_0_4, 1, "Volume", UI_func_volume); +LCDML_add(84, LCDML_0_4, 1, "Stereo/Mono", UI_func_stereo_mono); +LCDML_add(85, LCDML_0_4, 2, "MIDI Soft THRU", UI_func_midi_soft_thru); +LCDML_add(86, LCDML_0_4, 3, "Favorites", UI_func_favorites); +LCDML_add(87, LCDML_0_4, 4, "EEPROM Reset", UI_func_eeprom_reset); +LCDML_add(88, LCDML_0, 6, "Info", UI_func_information); +LCDML_addAdvanced(89, LCDML_0, 7, COND_hide, "Volume", UI_func_volume, 0, _LCDML_TYPE_default); +#define _LCDML_DISP_cnt 89 +#endif diff --git a/config.h b/config.h index e4ef53e..542582f 100644 --- a/config.h +++ b/config.h @@ -427,6 +427,22 @@ #define REVERB_DAMPING_MAX 100 #define REVERB_DAMPING_DEFAULT 0 +#define REVERB_LOWPASS_MIN 0 +#define REVERB_LOWPASS_MAX 100 +#define REVERB_LOWPASS_DEFAULT 0 + +#define REVERB_LODAMP_MIN 0 +#define REVERB_LODAMP_MAX 100 +#define REVERB_LODAMP_DEFAULT 0 + +#define REVERB_HIDAMP_MIN 0 +#define REVERB_HIDAMP_MAX 100 +#define REVERB_HIDAMP_DEFAULT 0 + +#define REVERB_DIFFUSION_MIN 0 +#define REVERB_DIFFUSION_MAX 100 +#define REVERB_DIFFUSION_DEFAULT 0 + #define REVERB_LEVEL_MIN 0 #define REVERB_LEVEL_MAX 100 #define REVERB_LEVEL_DEFAULT 0 @@ -631,6 +647,10 @@ typedef struct fx_s { uint8_t reverb_send[MAX_DEXED]; uint8_t reverb_roomsize; uint8_t reverb_damping; + uint8_t reverb_lowpass; + uint8_t reverb_lodamp; + uint8_t reverb_hidamp; + uint8_t reverb_diffusion; uint8_t reverb_level; int8_t eq_bass; int8_t eq_treble;