diff --git a/MicroDexed.ino b/MicroDexed.ino index ef4b05c..9244acc 100644 --- a/MicroDexed.ino +++ b/MicroDexed.ino @@ -217,9 +217,6 @@ uint32_t peak_l = 0; bool eeprom_update_flag = false; config_t configuration; uint8_t selected_dexed_instance = 0; -/*const uint8_t cs_pins[] = { SDCARD_AUDIO_CS_PIN, SDCARD_TEENSY_CS_PIN }; - const uint8_t mosi_pins[] = { SDCARD_AUDIO_MOSI_PIN, SDCARD_TEENSY_MOSI_PIN }; - const uint8_t sck_pins[] = { SDCARD_AUDIO_SCK_PIN, SDCARD_TEENSY_SCK_PIN };*/ const uint8_t cs_pins[] = { SDCARD_TEENSY_CS_PIN, SDCARD_AUDIO_CS_PIN }; const uint8_t mosi_pins[] = { SDCARD_TEENSY_MOSI_PIN, SDCARD_AUDIO_MOSI_PIN }; const uint8_t sck_pins[] = { SDCARD_TEENSY_SCK_PIN, SDCARD_AUDIO_SCK_PIN }; @@ -258,10 +255,6 @@ void setup() setup_debug_message(); #endif Serial.begin(SERIAL_SPEED); -/* while (!Serial) - { - yield(); - }*/ #endif #ifndef ENABLE_LCD_UI #ifdef DEBUG @@ -755,7 +748,7 @@ void handleControlChange(byte inChannel, byte inCtrl, byte inValue) Serial.println(F("BREATH CC")); #endif MicroDexed[instance_id]->controllers.breath_cc = inValue; - //MicroDexed[instance_id]->controllers.breath_cc = 100 – BCrange + Output * BCrange * Bcvalue/100 + //MicroDexed[instance_id]->controllers.breath_cc = 100 – BCrange + Output * BCrange * Bcvalue/100 MicroDexed[instance_id]->controllers.refresh(); break; case 4: diff --git a/UI.hpp b/UI.hpp index 178d038..a8dffca 100644 --- a/UI.hpp +++ b/UI.hpp @@ -2083,6 +2083,7 @@ void UI_func_mw_mode(uint8_t param) configuration.dexed[instance_id].mw_mode = constrain(configuration.dexed[instance_id].mw_mode - 1, MW_MODE_MIN, MW_MODE_MAX); MicroDexed[instance_id]->setMWController(configuration.dexed[instance_id].mw_range, configuration.dexed[instance_id].mw_assign, configuration.dexed[instance_id].mw_mode); + MicroDexed[instance_id]->controllers.refresh(); } lcd.setCursor(0, 1); @@ -2243,6 +2244,7 @@ void UI_func_fc_mode(uint8_t param) configuration.dexed[instance_id].fc_mode = constrain(configuration.dexed[instance_id].fc_mode - 1, FC_MODE_MIN, FC_MODE_MAX); MicroDexed[instance_id]->setFCController(configuration.dexed[instance_id].fc_range, configuration.dexed[instance_id].fc_assign, configuration.dexed[instance_id].fc_mode); + MicroDexed[instance_id]->controllers.refresh(); } lcd.setCursor(0, 1); @@ -2403,6 +2405,7 @@ void UI_func_bc_mode(uint8_t param) configuration.dexed[instance_id].bc_mode = constrain(configuration.dexed[instance_id].bc_mode - 1, BC_MODE_MIN, BC_MODE_MAX); MicroDexed[instance_id]->setBCController(configuration.dexed[instance_id].bc_range, configuration.dexed[instance_id].bc_assign, configuration.dexed[instance_id].bc_mode); + MicroDexed[instance_id]->controllers.refresh(); } lcd.setCursor(0, 1); @@ -2563,6 +2566,7 @@ void UI_func_at_mode(uint8_t param) configuration.dexed[instance_id].at_mode = constrain(configuration.dexed[instance_id].at_mode - 1, AT_MODE_MIN, AT_MODE_MAX); MicroDexed[instance_id]->setATController(configuration.dexed[instance_id].at_range, configuration.dexed[instance_id].at_assign, configuration.dexed[instance_id].at_mode); + MicroDexed[instance_id]->controllers.refresh(); } lcd.setCursor(0, 1); diff --git a/controllers.h b/controllers.h index 715005d..208a0d2 100644 --- a/controllers.h +++ b/controllers.h @@ -70,32 +70,46 @@ class FmMod { class Controllers { void applyMod(int cc, FmMod &mod) { - float range; uint8_t total; - range = 0.01 * mod.range; + float range = mod.range / 100.0; switch (mod.ctrl_mode) { case 0: - total = (float)cc * range; // NORMAL mode + total = float(cc) * range; // NORMAL mode break; case 1: - total = (float)(127 - cc) * range; // REVERSE mode + total = (127.0 - float(cc)) * range; // REVERSE mode break; case 2: //total = 100.0 - range + (float)cc * range / 100.0; // Special BC mode by Thierry (opus.quatre) - total = 127.0 * ( 1 - range ) + ((float)cc * range ); // Special BC mode by Thierry (opus.quatre) + //total = 127.0 * ( 1.0 - range ) + (float(cc) * range ); // Special BC mode by Thierry (opus.quatre) + total = range * float(cc) + (1.0 - range) * 127.0; // Special BC mode by Thierry (opus.quatre) break; } - if (mod.amp) - amp_mod = max(amp_mod, total); + if (mod.ctrl_mode < 2) + { + if (mod.amp) + amp_mod = max(amp_mod, total); + + if (mod.pitch) + pitch_mod = max(pitch_mod, total); + + if (mod.eg) + eg_mod = max(eg_mod, total); + } + else + { + if (mod.amp) + amp_mod = total; - if (mod.pitch) - pitch_mod = max(pitch_mod, total); + if (mod.pitch) + pitch_mod = total; - if (mod.eg) - eg_mod = max(eg_mod, total); + if (mod.eg) + eg_mod = total; + } } public: