diff --git a/MicroDexed.ino b/MicroDexed.ino index eb5c38b..975f9f0 100644 --- a/MicroDexed.ino +++ b/MicroDexed.ino @@ -1360,20 +1360,21 @@ void initial_values_from_eeprom(bool init) { uint32_t _m_; - EEPROM.get(EEPROM_START_ADDRESS + offsetof(configuration_s, _marker_), _m_); - if (_m_ != EEPROM_MARKER) - { -#ifdef DEBUG - Serial.println(F("Found wrong EEPROM marker, initializing EEPROM...")); -#endif - init = true; - configuration._marker_ = EEPROM_MARKER; - } - if (init == true) init_configuration(); else { + + EEPROM.get(EEPROM_START_ADDRESS + offsetof(configuration_s, _marker_), _m_); + if (_m_ != EEPROM_MARKER) + { +#ifdef DEBUG + Serial.println(F("Found wrong EEPROM marker, initializing EEPROM...")); +#endif + init = true; + configuration._marker_ = EEPROM_MARKER; + } + #ifdef DEBUG Serial.println(F("Loading inital system data from EEPROM.")); #endif @@ -1390,21 +1391,22 @@ void initial_values_from_eeprom(bool init) show_configuration(); #endif - check_configuration(); - - for (uint8_t instance_id = 0; instance_id < NUM_DEXED; instance_id++) - { - set_voiceconfig_params(instance_id); - } - set_fx_params(); - set_sys_params(); - - set_volume(configuration.sys.vol, configuration.sys.mono); #ifdef DEBUG Serial.println(F("OK, loaded!")); #endif } + + check_configuration(); + + for (uint8_t instance_id = 0; instance_id < NUM_DEXED; instance_id++) + { + set_voiceconfig_params(instance_id); + } + set_fx_params(); + set_sys_params(); + set_volume(configuration.sys.vol, configuration.sys.mono); + #ifdef DEBUG show_configuration(); #endif diff --git a/UI.hpp b/UI.hpp index a91d3dd..c34ffa7 100644 --- a/UI.hpp +++ b/UI.hpp @@ -1434,8 +1434,8 @@ void UI_func_reverb_send(uint8_t param) lcd_display_bar_int("Reverb Send", configuration.fx.reverb_send[selected_instance_id], 1.0, REVERB_SEND_MIN, REVERB_SEND_MAX, 3, false, false, false); - reverb_mixer_r.gain(selected_instance_id, pseudo_log_curve(configuration.fx.reverb_send[selected_instance_id] / 100.0)); - reverb_mixer_l.gain(selected_instance_id, pseudo_log_curve(configuration.fx.reverb_send[selected_instance_id] / 100.0)); + reverb_mixer_r.gain(selected_instance_id, pseudo_log_curve(mapfloat(configuration.fx.reverb_send[selected_instance_id], REVERB_SEND_MIN, REVERB_SEND_MAX, 0.0, 1.0))); + reverb_mixer_l.gain(selected_instance_id, pseudo_log_curve(mapfloat(configuration.fx.reverb_send[selected_instance_id], REVERB_SEND_MIN, REVERB_SEND_MAX, 0.0, 1.0))); } if (LCDML.FUNC_close()) // ****** STABLE END ********* diff --git a/dexed.cpp b/dexed.cpp index 792ff43..88e0116 100644 --- a/dexed.cpp +++ b/dexed.cpp @@ -150,7 +150,7 @@ void Dexed::getSamples(uint16_t n_samples, int16_t* buffer) { //sumbuf[i + j] += static_cast(signed_saturate_rshift(audiobuf.get()[j] >> 4, 24, 9)) / 0x8000; //sumbuf[i + j] += static_cast(signed_saturate_rshift(audiobuf.get()[j] >> 5, 24, 9)) / 0x8000; - sumbuf[i + j] += static_cast(signed_saturate_rshift(audiobuf.get()[j], 32, 14)) / 0x8000; + sumbuf[i + j] += static_cast(signed_saturate_rshift(audiobuf.get()[j], 32, 13)) / 0x8000; //sumbuf[i + j] += static_cast(audiobuf.get()[j] / 0x8000); audiobuf.get()[j] = 0; } diff --git a/dexed_sd.cpp b/dexed_sd.cpp index 9e39a06..ddb9e8b 100644 --- a/dexed_sd.cpp +++ b/dexed_sd.cpp @@ -344,7 +344,7 @@ bool save_sd_bank(const char* bank_filename, uint8_t* data) /****************************************************************************** SD VOICECONFIG ******************************************************************************/ -bool load_sd_voiceconfig(uint8_t vc, uint8_t instance_id) +bool load_sd_voiceconfig(int8_t vc, uint8_t instance_id) { if (vc < 0) return (false); @@ -444,7 +444,7 @@ bool save_sd_voiceconfig(uint8_t vc, uint8_t instance_id) /****************************************************************************** SD FX ******************************************************************************/ -bool load_sd_fx(uint8_t fx) +bool load_sd_fx(int8_t fx) { if (fx < 0) return (false); @@ -543,7 +543,7 @@ bool save_sd_fx(uint8_t fx) /****************************************************************************** SD PERFORMANCE ******************************************************************************/ -bool load_sd_performance(uint8_t p) +bool load_sd_performance(int8_t p) { if (p < 0) return (false); diff --git a/dexed_sd.h b/dexed_sd.h index 655dd4e..075f2e2 100644 --- a/dexed_sd.h +++ b/dexed_sd.h @@ -53,13 +53,13 @@ bool get_sd_voice(File sysex, uint8_t voice_number, uint8_t* data); bool put_sd_voice(File sysex, uint8_t voice_number, uint8_t* data); bool save_sd_bank(const char* bank_filename, uint8_t* data); -bool load_sd_voiceconfig(uint8_t vc, uint8_t instance_id); +bool load_sd_voiceconfig(int8_t vc, uint8_t instance_id); bool save_sd_voiceconfig(uint8_t vc, uint8_t instance_id); -bool load_sd_fx(uint8_t fx); +bool load_sd_fx(int8_t fx); bool save_sd_fx(uint8_t fx); -bool load_sd_performance(uint8_t p); +bool load_sd_performance(int8_t p); bool save_sd_performance(uint8_t p); bool get_sd_data(File sysex, uint8_t format, uint8_t* conf);