diff --git a/MicroDexed.ino b/MicroDexed.ino index 3731902..51de4a9 100644 --- a/MicroDexed.ino +++ b/MicroDexed.ino @@ -2540,16 +2540,55 @@ void check_and_create_directories(void) } } - // create directories for configuration files - sprintf(tmp, "/%s", VOICE_CONFIG_PATH); - if (!SD.exists(tmp)) - { -#ifdef DEBUG - Serial.print(F("Creating directory ")); - Serial.println(tmp); -#endif - SD.mkdir(tmp); - } + /* + // create directories for configuration files + sprintf(tmp, "/%s", VOICE_CONFIG_PATH); + if (!SD.exists(tmp)) + { + #ifdef DEBUG + Serial.print(F("Creating directory ")); + Serial.println(tmp); + #endif + SD.mkdir(tmp); + } + sprintf(tmp, "/%s", PERFORMANCE_CONFIG_PATH); + if (!SD.exists(tmp)) + { + #ifdef DEBUG + Serial.print(F("Creating directory ")); + Serial.println(tmp); + #endif + SD.mkdir(tmp); + } + sprintf(tmp, "/%s", FX_CONFIG_PATH); + if (!SD.exists(tmp)) + { + #ifdef DEBUG + Serial.print(F("Creating directory ")); + Serial.println(tmp); + #endif + SD.mkdir(tmp); + } + sprintf(tmp, "/%s", DRUM_CONFIG_PATH); + if (!SD.exists(tmp)) + { + #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); + } + */ + sprintf(tmp, "/%s", PERFORMANCE_CONFIG_PATH); if (!SD.exists(tmp)) { @@ -2559,45 +2598,8 @@ void check_and_create_directories(void) #endif SD.mkdir(tmp); } - sprintf(tmp, "/%s", FX_CONFIG_PATH); - if (!SD.exists(tmp)) - { -#ifdef DEBUG - Serial.print(F("Creating directory ")); - Serial.println(tmp); -#endif - SD.mkdir(tmp); - } - sprintf(tmp, "/%s", DRUM_CONFIG_PATH); - if (!SD.exists(tmp)) - { -#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); - } - sprintf(tmp, "/%s", SEQ_CONFIG_PATH); - if (!SD.exists(tmp)) - { -#ifdef DEBUG - Serial.print(F("Creating directory ")); - Serial.println(tmp); -#endif - SD.mkdir(tmp); - } //check if updated Fav-System is ready or if setup has to run once. - sprintf(tmp, "/%s/fav-v2", FAV_CONFIG_PATH); if (!SD.exists(tmp)) { diff --git a/UI.hpp b/UI.hpp index 55db3a4..4922d9e 100644 --- a/UI.hpp +++ b/UI.hpp @@ -53,7 +53,7 @@ extern PeriodicTimer timer1; extern void sequencer(void); -extern bool check_sd_seq_exists(uint8_t); +extern bool check_sd_performance_exists(uint8_t number); extern config_t configuration; extern void set_volume(uint8_t v, uint8_t m); @@ -6230,7 +6230,7 @@ void UI_func_load_performance(uint8_t param) char tmp[10]; sprintf(tmp, "[%2d]", temp_int); lcd.print(tmp); - if (check_sd_seq_exists(temp_int)) + if (check_sd_performance_exists(temp_int)) { get_sd_seq_name_json(temp_int); if ( seq_name_temp[0] != 0 ) @@ -6261,7 +6261,10 @@ void UI_func_save_performance(uint8_t param) { char tmp[FILENAME_LEN]; yesno = false; - if (seq_state_last_loadsave != 200)temp_int = seq_state_last_loadsave; else temp_int = 0; + if (seq_state_last_loadsave != 200) + temp_int = seq_state_last_loadsave; + else + temp_int = 0; mode = 0; encoderDir[ENC_R].reset(); lcd.setCursor(0, 0); @@ -6269,12 +6272,12 @@ void UI_func_save_performance(uint8_t param) lcd.setCursor(0, 1); sprintf(tmp, "[%2d]", temp_int); lcd.print(tmp); - sprintf(tmp, "/%s/%d-S.json", SEQ_CONFIG_PATH, temp_int); + sprintf(tmp, "/%s/%d-S.json", PERFORMANCE_CONFIG_PATH, temp_int); if (SD.exists(tmp)) overwrite = true; else overwrite = false; - if (check_sd_seq_exists(temp_int)) + if (check_sd_performance_exists(temp_int)) { get_sd_seq_name_json(temp_int); if ( seq_name_temp[0] != 0 ) @@ -6317,7 +6320,7 @@ void UI_func_save_performance(uint8_t param) if (yesno == true) { char tmp[FILENAME_LEN]; - sprintf(tmp, "/%s/%d-S.json", SEQ_CONFIG_PATH, temp_int); + sprintf(tmp, "/%s/%d-S.json", PERFORMANCE_CONFIG_PATH, temp_int); SD.remove(tmp); } save_sd_seq_json(temp_int); @@ -6340,7 +6343,7 @@ void UI_func_save_performance(uint8_t param) if (mode == 0) { char tmp[FILENAME_LEN]; - sprintf(tmp, "/%s/%d-S.json", SEQ_CONFIG_PATH, temp_int); + sprintf(tmp, "/%s/%d-S.json", PERFORMANCE_CONFIG_PATH, temp_int); if (SD.exists(tmp)) overwrite = true; else @@ -6352,7 +6355,7 @@ void UI_func_save_performance(uint8_t param) lcd.setCursor(5, 1); if (overwrite == false) { lcd.print("-- empty --"); - } else if (check_sd_seq_exists(temp_int)) + } else if (check_sd_performance_exists(temp_int)) { get_sd_seq_name_json(temp_int); if ( seq_name_temp[0] != 0 ) @@ -6845,7 +6848,7 @@ void UI_func_voice_select(uint8_t param) void UI_func_volume(uint8_t param) { char tmp[6]; - + if (LCDML.FUNC_setup()) // ****** SETUP ********* { diff --git a/addon/SD/PERFORMANCE/0/0-d.json b/addon/SD/PERFORMANCE/0/drums.json similarity index 100% rename from addon/SD/PERFORMANCE/0/0-d.json rename to addon/SD/PERFORMANCE/0/drums.json diff --git a/addon/SD/PERFORMANCE/0/0-fx.json b/addon/SD/PERFORMANCE/0/fx.json similarity index 100% rename from addon/SD/PERFORMANCE/0/0-fx.json rename to addon/SD/PERFORMANCE/0/fx.json diff --git a/addon/SD/PERFORMANCE/0/0-pat.json b/addon/SD/PERFORMANCE/0/patterns.json similarity index 100% rename from addon/SD/PERFORMANCE/0/0-pat.json rename to addon/SD/PERFORMANCE/0/patterns.json diff --git a/addon/SD/PERFORMANCE/0/0-S.json b/addon/SD/PERFORMANCE/0/performance.json similarity index 100% rename from addon/SD/PERFORMANCE/0/0-S.json rename to addon/SD/PERFORMANCE/0/performance.json diff --git a/addon/SD/PERFORMANCE/0/0-vel.json b/addon/SD/PERFORMANCE/0/velocity.json similarity index 100% rename from addon/SD/PERFORMANCE/0/0-vel.json rename to addon/SD/PERFORMANCE/0/velocity.json diff --git a/addon/SD/PERFORMANCE/0/0-v1.json b/addon/SD/PERFORMANCE/0/voice1.json similarity index 100% rename from addon/SD/PERFORMANCE/0/0-v1.json rename to addon/SD/PERFORMANCE/0/voice1.json diff --git a/addon/SD/PERFORMANCE/0/0-v0.json b/addon/SD/PERFORMANCE/0/voice2.json similarity index 100% rename from addon/SD/PERFORMANCE/0/0-v0.json rename to addon/SD/PERFORMANCE/0/voice2.json diff --git a/addon/SD/PERFORMANCE/1/1-d.json b/addon/SD/PERFORMANCE/1/drums.json similarity index 100% rename from addon/SD/PERFORMANCE/1/1-d.json rename to addon/SD/PERFORMANCE/1/drums.json diff --git a/addon/SD/PERFORMANCE/1/1-fx.json b/addon/SD/PERFORMANCE/1/fx.json similarity index 100% rename from addon/SD/PERFORMANCE/1/1-fx.json rename to addon/SD/PERFORMANCE/1/fx.json diff --git a/addon/SD/PERFORMANCE/1/1-pat.json b/addon/SD/PERFORMANCE/1/patterns.json similarity index 100% rename from addon/SD/PERFORMANCE/1/1-pat.json rename to addon/SD/PERFORMANCE/1/patterns.json diff --git a/addon/SD/PERFORMANCE/1/1-S.json b/addon/SD/PERFORMANCE/1/performance.json similarity index 100% rename from addon/SD/PERFORMANCE/1/1-S.json rename to addon/SD/PERFORMANCE/1/performance.json diff --git a/addon/SD/PERFORMANCE/1/1-vel.json b/addon/SD/PERFORMANCE/1/velocity.json similarity index 100% rename from addon/SD/PERFORMANCE/1/1-vel.json rename to addon/SD/PERFORMANCE/1/velocity.json diff --git a/addon/SD/PERFORMANCE/1/1-v0.json b/addon/SD/PERFORMANCE/1/voice1.json similarity index 100% rename from addon/SD/PERFORMANCE/1/1-v0.json rename to addon/SD/PERFORMANCE/1/voice1.json diff --git a/addon/SD/PERFORMANCE/1/1-v1.json b/addon/SD/PERFORMANCE/1/voice2.json similarity index 100% rename from addon/SD/PERFORMANCE/1/1-v1.json rename to addon/SD/PERFORMANCE/1/voice2.json diff --git a/addon/SD/PERFORMANCE/2/2-d.json b/addon/SD/PERFORMANCE/2/drums.json similarity index 100% rename from addon/SD/PERFORMANCE/2/2-d.json rename to addon/SD/PERFORMANCE/2/drums.json diff --git a/addon/SD/PERFORMANCE/2/2-fx.json b/addon/SD/PERFORMANCE/2/fx.json similarity index 100% rename from addon/SD/PERFORMANCE/2/2-fx.json rename to addon/SD/PERFORMANCE/2/fx.json diff --git a/addon/SD/PERFORMANCE/2/2-pat.json b/addon/SD/PERFORMANCE/2/patterns.json similarity index 100% rename from addon/SD/PERFORMANCE/2/2-pat.json rename to addon/SD/PERFORMANCE/2/patterns.json diff --git a/addon/SD/PERFORMANCE/2/2-S.json b/addon/SD/PERFORMANCE/2/performance.json similarity index 100% rename from addon/SD/PERFORMANCE/2/2-S.json rename to addon/SD/PERFORMANCE/2/performance.json diff --git a/addon/SD/PERFORMANCE/2/2-vel.json b/addon/SD/PERFORMANCE/2/velocity.json similarity index 100% rename from addon/SD/PERFORMANCE/2/2-vel.json rename to addon/SD/PERFORMANCE/2/velocity.json diff --git a/addon/SD/PERFORMANCE/2/2-v0.json b/addon/SD/PERFORMANCE/2/voice1.json similarity index 100% rename from addon/SD/PERFORMANCE/2/2-v0.json rename to addon/SD/PERFORMANCE/2/voice1.json diff --git a/addon/SD/PERFORMANCE/2/2-v1.json b/addon/SD/PERFORMANCE/2/voice2.json similarity index 100% rename from addon/SD/PERFORMANCE/2/2-v1.json rename to addon/SD/PERFORMANCE/2/voice2.json diff --git a/addon/SD/PERFORMANCE/3/3-d.json b/addon/SD/PERFORMANCE/3/drums.json similarity index 100% rename from addon/SD/PERFORMANCE/3/3-d.json rename to addon/SD/PERFORMANCE/3/drums.json diff --git a/addon/SD/PERFORMANCE/3/3-fx.json b/addon/SD/PERFORMANCE/3/fx.json similarity index 100% rename from addon/SD/PERFORMANCE/3/3-fx.json rename to addon/SD/PERFORMANCE/3/fx.json diff --git a/addon/SD/PERFORMANCE/3/3-pat.json b/addon/SD/PERFORMANCE/3/patterns.json similarity index 100% rename from addon/SD/PERFORMANCE/3/3-pat.json rename to addon/SD/PERFORMANCE/3/patterns.json diff --git a/addon/SD/PERFORMANCE/3/3-S.json b/addon/SD/PERFORMANCE/3/performance.json similarity index 100% rename from addon/SD/PERFORMANCE/3/3-S.json rename to addon/SD/PERFORMANCE/3/performance.json diff --git a/addon/SD/PERFORMANCE/3/3-vel.json b/addon/SD/PERFORMANCE/3/velocity.json similarity index 100% rename from addon/SD/PERFORMANCE/3/3-vel.json rename to addon/SD/PERFORMANCE/3/velocity.json diff --git a/addon/SD/PERFORMANCE/3/3-v0.json b/addon/SD/PERFORMANCE/3/voice1.json similarity index 100% rename from addon/SD/PERFORMANCE/3/3-v0.json rename to addon/SD/PERFORMANCE/3/voice1.json diff --git a/addon/SD/PERFORMANCE/3/3-v1.json b/addon/SD/PERFORMANCE/3/voice2.json similarity index 100% rename from addon/SD/PERFORMANCE/3/3-v1.json rename to addon/SD/PERFORMANCE/3/voice2.json diff --git a/addon/SD/PERFORMANCE/4/4-d.json b/addon/SD/PERFORMANCE/4/drums.json similarity index 100% rename from addon/SD/PERFORMANCE/4/4-d.json rename to addon/SD/PERFORMANCE/4/drums.json diff --git a/addon/SD/PERFORMANCE/4/4-fx.json b/addon/SD/PERFORMANCE/4/fx.json similarity index 100% rename from addon/SD/PERFORMANCE/4/4-fx.json rename to addon/SD/PERFORMANCE/4/fx.json diff --git a/addon/SD/PERFORMANCE/4/4-pat.json b/addon/SD/PERFORMANCE/4/patterns.json similarity index 100% rename from addon/SD/PERFORMANCE/4/4-pat.json rename to addon/SD/PERFORMANCE/4/patterns.json diff --git a/addon/SD/PERFORMANCE/4/4-S.json b/addon/SD/PERFORMANCE/4/performance.json similarity index 100% rename from addon/SD/PERFORMANCE/4/4-S.json rename to addon/SD/PERFORMANCE/4/performance.json diff --git a/addon/SD/PERFORMANCE/4/4-vel.json b/addon/SD/PERFORMANCE/4/velocity.json similarity index 100% rename from addon/SD/PERFORMANCE/4/4-vel.json rename to addon/SD/PERFORMANCE/4/velocity.json diff --git a/addon/SD/PERFORMANCE/4/4-v0.json b/addon/SD/PERFORMANCE/4/voice1.json similarity index 100% rename from addon/SD/PERFORMANCE/4/4-v0.json rename to addon/SD/PERFORMANCE/4/voice1.json diff --git a/addon/SD/PERFORMANCE/4/4-v1.json b/addon/SD/PERFORMANCE/4/voice2.json similarity index 100% rename from addon/SD/PERFORMANCE/4/4-v1.json rename to addon/SD/PERFORMANCE/4/voice2.json diff --git a/addon/SD/PERFORMANCE/5/5-d.json b/addon/SD/PERFORMANCE/5/drums.json similarity index 100% rename from addon/SD/PERFORMANCE/5/5-d.json rename to addon/SD/PERFORMANCE/5/drums.json diff --git a/addon/SD/PERFORMANCE/5/5-fx.json b/addon/SD/PERFORMANCE/5/fx.json similarity index 100% rename from addon/SD/PERFORMANCE/5/5-fx.json rename to addon/SD/PERFORMANCE/5/fx.json diff --git a/addon/SD/PERFORMANCE/5/5-pat.json b/addon/SD/PERFORMANCE/5/patterns.json similarity index 100% rename from addon/SD/PERFORMANCE/5/5-pat.json rename to addon/SD/PERFORMANCE/5/patterns.json diff --git a/addon/SD/PERFORMANCE/5/5-S.json b/addon/SD/PERFORMANCE/5/performance.json similarity index 100% rename from addon/SD/PERFORMANCE/5/5-S.json rename to addon/SD/PERFORMANCE/5/performance.json diff --git a/addon/SD/PERFORMANCE/5/5-vel.json b/addon/SD/PERFORMANCE/5/velocity.json similarity index 100% rename from addon/SD/PERFORMANCE/5/5-vel.json rename to addon/SD/PERFORMANCE/5/velocity.json diff --git a/addon/SD/PERFORMANCE/5/5-v0.json b/addon/SD/PERFORMANCE/5/voice1.json similarity index 100% rename from addon/SD/PERFORMANCE/5/5-v0.json rename to addon/SD/PERFORMANCE/5/voice1.json diff --git a/addon/SD/PERFORMANCE/5/5-v1.json b/addon/SD/PERFORMANCE/5/voice2.json similarity index 100% rename from addon/SD/PERFORMANCE/5/5-v1.json rename to addon/SD/PERFORMANCE/5/voice2.json diff --git a/addon/SD/PERFORMANCE/6/6-d.json b/addon/SD/PERFORMANCE/6/drums.json similarity index 100% rename from addon/SD/PERFORMANCE/6/6-d.json rename to addon/SD/PERFORMANCE/6/drums.json diff --git a/addon/SD/PERFORMANCE/6/6-fx.json b/addon/SD/PERFORMANCE/6/fx.json similarity index 100% rename from addon/SD/PERFORMANCE/6/6-fx.json rename to addon/SD/PERFORMANCE/6/fx.json diff --git a/addon/SD/PERFORMANCE/6/6-pat.json b/addon/SD/PERFORMANCE/6/patterns.json similarity index 100% rename from addon/SD/PERFORMANCE/6/6-pat.json rename to addon/SD/PERFORMANCE/6/patterns.json diff --git a/addon/SD/PERFORMANCE/6/6-S.json b/addon/SD/PERFORMANCE/6/performance.json similarity index 100% rename from addon/SD/PERFORMANCE/6/6-S.json rename to addon/SD/PERFORMANCE/6/performance.json diff --git a/addon/SD/PERFORMANCE/6/6-vel.json b/addon/SD/PERFORMANCE/6/velocity.json similarity index 100% rename from addon/SD/PERFORMANCE/6/6-vel.json rename to addon/SD/PERFORMANCE/6/velocity.json diff --git a/addon/SD/PERFORMANCE/6/6-v0.json b/addon/SD/PERFORMANCE/6/voice1.json similarity index 100% rename from addon/SD/PERFORMANCE/6/6-v0.json rename to addon/SD/PERFORMANCE/6/voice1.json diff --git a/addon/SD/PERFORMANCE/6/6-v1.json b/addon/SD/PERFORMANCE/6/voice2.json similarity index 100% rename from addon/SD/PERFORMANCE/6/6-v1.json rename to addon/SD/PERFORMANCE/6/voice2.json diff --git a/addon/SD/PERFORMANCE/7/7-d.json b/addon/SD/PERFORMANCE/7/drums.json similarity index 100% rename from addon/SD/PERFORMANCE/7/7-d.json rename to addon/SD/PERFORMANCE/7/drums.json diff --git a/addon/SD/PERFORMANCE/7/7-fx.json b/addon/SD/PERFORMANCE/7/fx.json similarity index 100% rename from addon/SD/PERFORMANCE/7/7-fx.json rename to addon/SD/PERFORMANCE/7/fx.json diff --git a/addon/SD/PERFORMANCE/7/7-pat.json b/addon/SD/PERFORMANCE/7/patterns.json similarity index 100% rename from addon/SD/PERFORMANCE/7/7-pat.json rename to addon/SD/PERFORMANCE/7/patterns.json diff --git a/addon/SD/PERFORMANCE/7/7-S.json b/addon/SD/PERFORMANCE/7/performance.json similarity index 100% rename from addon/SD/PERFORMANCE/7/7-S.json rename to addon/SD/PERFORMANCE/7/performance.json diff --git a/addon/SD/PERFORMANCE/7/7-vel.json b/addon/SD/PERFORMANCE/7/velocity.json similarity index 100% rename from addon/SD/PERFORMANCE/7/7-vel.json rename to addon/SD/PERFORMANCE/7/velocity.json diff --git a/addon/SD/PERFORMANCE/7/7-v0.json b/addon/SD/PERFORMANCE/7/voice1.json similarity index 100% rename from addon/SD/PERFORMANCE/7/7-v0.json rename to addon/SD/PERFORMANCE/7/voice1.json diff --git a/addon/SD/PERFORMANCE/7/7-v1.json b/addon/SD/PERFORMANCE/7/voice2.json similarity index 100% rename from addon/SD/PERFORMANCE/7/7-v1.json rename to addon/SD/PERFORMANCE/7/voice2.json diff --git a/addon/SD/PERFORMANCE/8/8-d.json b/addon/SD/PERFORMANCE/8/drums.json similarity index 100% rename from addon/SD/PERFORMANCE/8/8-d.json rename to addon/SD/PERFORMANCE/8/drums.json diff --git a/addon/SD/PERFORMANCE/8/8-fx.json b/addon/SD/PERFORMANCE/8/fx.json similarity index 100% rename from addon/SD/PERFORMANCE/8/8-fx.json rename to addon/SD/PERFORMANCE/8/fx.json diff --git a/addon/SD/PERFORMANCE/8/8-pat.json b/addon/SD/PERFORMANCE/8/patterns.json similarity index 100% rename from addon/SD/PERFORMANCE/8/8-pat.json rename to addon/SD/PERFORMANCE/8/patterns.json diff --git a/addon/SD/PERFORMANCE/8/8-S.json b/addon/SD/PERFORMANCE/8/performance.json similarity index 100% rename from addon/SD/PERFORMANCE/8/8-S.json rename to addon/SD/PERFORMANCE/8/performance.json diff --git a/addon/SD/PERFORMANCE/8/8-vel.json b/addon/SD/PERFORMANCE/8/velocity.json similarity index 100% rename from addon/SD/PERFORMANCE/8/8-vel.json rename to addon/SD/PERFORMANCE/8/velocity.json diff --git a/addon/SD/PERFORMANCE/8/8-v0.json b/addon/SD/PERFORMANCE/8/voice1.json similarity index 100% rename from addon/SD/PERFORMANCE/8/8-v0.json rename to addon/SD/PERFORMANCE/8/voice1.json diff --git a/addon/SD/PERFORMANCE/8/8-v1.json b/addon/SD/PERFORMANCE/8/voice2.json similarity index 100% rename from addon/SD/PERFORMANCE/8/8-v1.json rename to addon/SD/PERFORMANCE/8/voice2.json diff --git a/config.h b/config.h index 40fabd2..30880e7 100644 --- a/config.h +++ b/config.h @@ -308,26 +308,23 @@ #define MAX_FX 99 #define MAX_PERFORMANCE 99 #define MAX_VOICECONFIG 99 +#define MAX_VELOCITY 99 #define BANK_NAME_LEN 11 // 10 (plus '\0') #define VOICE_NAME_LEN 12 // 11 (plus '\0') #define FILENAME_LEN BANK_NAME_LEN + VOICE_NAME_LEN +#define CONFIG_FILENAME_LEN 50 #define DRUM_NAME_LEN 21 -#define FX_CONFIG_PATH "FXCFG" -#define FX_CONFIG_NAME "FXCFG" -#define PERFORMANCE_CONFIG_PATH "PCFG" -#define PERFORMANCE_CONFIG_NAME "PCFG" -#define VOICE_CONFIG_PATH "VCFG" -#define VOICE_CONFIG_NAME "VCFG" - #define FAV_CONFIG_PATH "FAVCFG" #define FAV_CONFIG_NAME "FAVCFG" -#define SEQ_CONFIG_PATH "PERFORMANCE" -#define SEQ_CONFIG_NAME "PERFORMANCE" - -#define DRUM_CONFIG_PATH "DRM" -#define DRUM_CONFIG_NAME "DRM" +#define PERFORMANCE_CONFIG_PATH "PERFORMANCE" +#define PERFORMANCE_CONFIG_NAME "performance" +#define DRUMS_CONFIG_NAME "drums" +#define PATTERN_CONFIG_NAME "pattern" +#define VELOCITY_CONFIG_NAME "velocity" +#define FX_CONFIG_NAME "fx" +#define VOICE_CONFIG_NAME "voice" #define MAX_PERF_MOD 30 @@ -630,7 +627,11 @@ #define FX_NUM_MIN 0 #define FX_NUM_MAX MAX_FX -#define FX_NUM_DEFAULT -1 +#define FX_NUM_DEFAULT 0 + +#define VELOCITY_NUM_MIN 0 +#define VELOCITY_NUM_MAX MAX_VELOCITY +#define VELOCITY_NUM_DEFAULT 0 #define VOICECONFIG_NUM_MIN 0 #define VOICECONFIG_NUM_MAX MAX_VOICECONFIG @@ -665,8 +666,7 @@ #define EQ_7_DEFAULT 15 // Buffer-size define for load/save configuration as JSON -//#define JSON_BUFFER_SIZE 8192 -#define JSON_BUFFER_SIZE 16384 +#define JSON_BUFFER_SIZE 8192 // Internal configuration structure typedef struct dexed_s { diff --git a/dexed_sd.cpp b/dexed_sd.cpp index 4ff9355..9068eb0 100644 --- a/dexed_sd.cpp +++ b/dexed_sd.cpp @@ -301,7 +301,7 @@ bool get_sd_voice(File sysex, uint8_t voice_number, uint8_t* data) return (false); } - MicroDexed[0]->resetRenderTimeMax(); + // MicroDexed[0]->resetRenderTimeMax(); // necessary? return (true); } @@ -454,7 +454,7 @@ bool save_sd_bank(const char* bank_filename, uint8_t* data) SD DRUMSETTINGS ******************************************************************************/ -bool load_sd_drumsettings_json(uint8_t number, uint8_t target) +bool load_sd_drumsettings_json(uint8_t number) { if (number < 0) return (false); @@ -465,11 +465,9 @@ bool load_sd_drumsettings_json(uint8_t number, uint8_t target) { File json; StaticJsonDocument data_json; - char filename[FILENAME_LEN]; - if (target == 0) - sprintf(filename, "/%s/%d/%s%d.json", DRUM_CONFIG_PATH, number, DRUM_CONFIG_NAME, number); - else - sprintf(filename, "/%s/%d/%d-d.json", SEQ_CONFIG_PATH, number, number); + char filename[CONFIG_FILENAME_LEN]; + + sprintf(filename, "/%s/%d/%s.json", PERFORMANCE_CONFIG_PATH, number, DRUMS_CONFIG_NAME); // first check if file exists... AudioNoInterrupts(); @@ -507,13 +505,6 @@ bool load_sd_drumsettings_json(uint8_t number, uint8_t target) set_sample_vol_max( drumnumber, data_json["vol_max"][i]) ; set_sample_vol_min( drumnumber, data_json["vol_min"][i] ); set_sample_reverb_send( drumnumber, data_json["reverb_send"][i]); - //Serial.print(" drumnumber: "); - //Serial.print(drumnumber); - //Serial.print(" notenumber: "); - //Serial.print(find_drum_number_from_note( data_json["note"][i] )); - //Serial.print(" note: "); - //Serial.print( (int)data_json["note"][i] ); - //Serial.println(F(" ")); } } return (true); @@ -537,18 +528,18 @@ bool load_sd_drumsettings_json(uint8_t number, uint8_t target) return (false); } -bool save_sd_drumsettings_json(uint8_t number, uint8_t target) +bool save_sd_drumsettings_json(uint8_t number) { - char filename[FILENAME_LEN]; + char filename[CONFIG_FILENAME_LEN]; number = constrain(number, 0, 99); + if (sd_card > 0) { File json; StaticJsonDocument data_json; - if (target == 0) - sprintf(filename, "/%s/%d/%s%d.json", DRUM_CONFIG_PATH, number, DRUM_CONFIG_NAME, number); - else - sprintf(filename, "/%s/%d/%d-d.json", SEQ_CONFIG_PATH, number, number); + + sprintf(filename, "/%s/%d/%s.json", PERFORMANCE_CONFIG_PATH, number, DRUMS_CONFIG_NAME); + #ifdef DEBUG Serial.print(F("Saving drums config ")); Serial.print(number); @@ -602,9 +593,9 @@ bool save_sd_drumsettings_json(uint8_t number, uint8_t target) /****************************************************************************** SD VOICECONFIG ******************************************************************************/ -bool load_sd_voiceconfig_json(uint8_t vc, uint8_t instance_id, uint8_t target) +bool load_sd_voiceconfig_json(uint8_t vc, uint8_t instance_id) { - char filename[FILENAME_LEN]; + char filename[CONFIG_FILENAME_LEN]; vc = constrain(vc, 0, MAX_VOICECONFIG); @@ -612,10 +603,9 @@ bool load_sd_voiceconfig_json(uint8_t vc, uint8_t instance_id, uint8_t target) { File json; StaticJsonDocument data_json; - if (target == 0) - sprintf(filename, "/%s/%d/%s%d.json", VOICE_CONFIG_PATH, vc, VOICE_CONFIG_NAME, vc); - else - sprintf(filename, "/%s/%d/%d-v%d.json", SEQ_CONFIG_PATH, vc, vc, instance_id); + + sprintf(filename, "/%s/%d/%s%d.json", PERFORMANCE_CONFIG_PATH, vc, VOICE_CONFIG_NAME, instance_id); + // first check if file exists... AudioNoInterrupts(); if (SD.exists(filename)) @@ -696,9 +686,9 @@ bool load_sd_voiceconfig_json(uint8_t vc, uint8_t instance_id, uint8_t target) return (false); } -bool save_sd_voiceconfig_json(uint8_t vc, uint8_t instance_id, uint8_t target) +bool save_sd_voiceconfig_json(uint8_t vc, uint8_t instance_id) { - char filename[FILENAME_LEN]; + char filename[CONFIG_FILENAME_LEN]; vc = constrain(vc, 0, MAX_VOICECONFIG); @@ -706,10 +696,8 @@ bool save_sd_voiceconfig_json(uint8_t vc, uint8_t instance_id, uint8_t target) { File json; StaticJsonDocument data_json; - if (target == 0) - sprintf(filename, "/%s/%d/%s%d.json", VOICE_CONFIG_PATH, vc, VOICE_CONFIG_NAME, vc); - else - sprintf(filename, "/%s/%d/%d-v%d.json", SEQ_CONFIG_PATH, vc, vc, instance_id); + sprintf(filename, "/%s/%d/%s%d.json", PERFORMANCE_CONFIG_PATH, vc, VOICE_CONFIG_NAME, instance_id); + #ifdef DEBUG Serial.print(F("Saving voice config ")); Serial.print(vc); @@ -786,22 +774,19 @@ bool save_sd_voiceconfig_json(uint8_t vc, uint8_t instance_id, uint8_t target) /****************************************************************************** SD FX ******************************************************************************/ -bool load_sd_fx_json(uint8_t fx, uint8_t target) +bool load_sd_fx_json(uint8_t fx) { - if (fx < 0) - return (false); - load_sd_drumsettings_json(fx, target); - fx = constrain(fx, 0, MAX_FX); + fx = constrain(fx, FX_NUM_MIN, FX_NUM_MAX); + + load_sd_drumsettings_json(fx); if (sd_card > 0) { File json; StaticJsonDocument data_json; - char filename[FILENAME_LEN]; - if (target == 0) - sprintf(filename, "/%s/%d/%s%d.json", FX_CONFIG_PATH, fx, FX_CONFIG_NAME, fx); - else - sprintf(filename, "/%s/%d/%d-fx.json", SEQ_CONFIG_PATH, fx, fx); + char filename[CONFIG_FILENAME_LEN]; + sprintf(filename, "/%s/%d/%s.json", PERFORMANCE_CONFIG_PATH, fx, FX_CONFIG_NAME); + // first check if file exists... AudioNoInterrupts(); if (SD.exists(filename)) @@ -885,20 +870,19 @@ bool load_sd_fx_json(uint8_t fx, uint8_t target) return (false); } -bool save_sd_fx_json(uint8_t fx, uint8_t target) +bool save_sd_fx_json(uint8_t fx) { - char filename[FILENAME_LEN]; + char filename[CONFIG_FILENAME_LEN]; + + fx = constrain(fx, FX_NUM_MIN, FX_NUM_MAX); - fx = constrain(fx, 0, MAX_FX); - save_sd_drumsettings_json(fx, target); + save_sd_drumsettings_json(fx); if (sd_card > 0) { File json; StaticJsonDocument data_json; - if (target == 0) - sprintf(filename, "/%s/%d/%s%d.json", FX_CONFIG_PATH, fx, FX_CONFIG_NAME, fx); - else - sprintf(filename, "/%s/%d/%d-fx.json", SEQ_CONFIG_PATH, fx, fx); + sprintf(filename, "/%s/%d/%s.json", PERFORMANCE_CONFIG_PATH, fx, FX_CONFIG_NAME); + #ifdef DEBUG Serial.print(F("Saving fx config ")); Serial.print(fx); @@ -967,14 +951,15 @@ bool save_sd_fx_json(uint8_t fx, uint8_t target) bool save_sd_seq_sub_vel_json(uint8_t seq_number) { - char filename[FILENAME_LEN]; + char filename[CONFIG_FILENAME_LEN]; int count = 0; - seq_number = constrain(seq_number, 0, 99); + seq_number = constrain(seq_number, VELOCITY_NUM_MIN, VELOCITY_NUM_MAX); + if (sd_card > 0) { File json; StaticJsonDocument data_json; - sprintf(filename, "/%s/%d/%d-vel.json", SEQ_CONFIG_PATH, seq_number, seq_number); + sprintf(filename, "/%s/%d/%s.json", PERFORMANCE_CONFIG_PATH, seq_number, VELOCITY_CONFIG_NAME); #ifdef DEBUG Serial.print(F("Saving sequencer velocity ")); Serial.print(seq_number); @@ -1022,14 +1007,15 @@ bool save_sd_seq_sub_vel_json(uint8_t seq_number) bool save_sd_seq_sub_patterns_json(uint8_t seq_number) { - char filename[FILENAME_LEN]; + char filename[CONFIG_FILENAME_LEN]; int count = 0; - seq_number = constrain(seq_number, 0, 99); + seq_number = constrain(seq_number, VELOCITY_NUM_MIN, VELOCITY_NUM_MAX); + if (sd_card > 0) { File json; StaticJsonDocument data_json; - sprintf(filename, "/%s/%d/%d-pat.json", SEQ_CONFIG_PATH, seq_number, seq_number); + sprintf(filename, "/%s/%d/%s.json", PERFORMANCE_CONFIG_PATH, seq_number, VELOCITY_CONFIG_NAME); #ifdef DEBUG Serial.print(F("Saving sequencer patterns ")); Serial.print(seq_number); @@ -1077,10 +1063,11 @@ bool save_sd_seq_sub_patterns_json(uint8_t seq_number) bool save_sd_seq_json(uint8_t seq_number) { - char filename[FILENAME_LEN]; + char filename[CONFIG_FILENAME_LEN]; int count = 0; bool seq_was_running = false; - seq_number = constrain(seq_number, 0, 99); + seq_number = constrain(seq_number, VELOCITY_NUM_MIN, VELOCITY_NUM_MAX); + if (seq_running == true ) { seq_was_running = true; handleStop(); @@ -1089,29 +1076,29 @@ bool save_sd_seq_json(uint8_t seq_number) AudioNoInterrupts(); save_sd_seq_sub_vel_json(seq_number); save_sd_seq_sub_patterns_json(seq_number); - sprintf(filename, "/%s/%d/%d-fx.json", SEQ_CONFIG_PATH, seq_number, seq_number); #ifdef DEBUG - Serial.print(F("write SEQ-FX-Config ")); + Serial.print(F("Write performance config ")); Serial.print(seq_number); Serial.print(F(" ")); #endif - save_sd_fx_json(seq_number, 1); + save_sd_fx_json(seq_number); for (uint8_t i = 0; i < MAX_DEXED; i++) - { sprintf(filename, "/%s/%d/%d-v%d.json", SEQ_CONFIG_PATH, seq_number, seq_number, i); + { + sprintf(filename, "/%s/%d/%s%d.json", PERFORMANCE_CONFIG_PATH, seq_number, VOICE_CONFIG_NAME, i); #ifdef DEBUG Serial.print(F("Write Voice-Config for sequencer")); Serial.print(filename); Serial.print(F(" ")); #endif - save_sd_voiceconfig_json(seq_number, i, 1); + save_sd_voiceconfig_json(seq_number, i); } if (sd_card > 0) { File json; StaticJsonDocument data_json; - sprintf(filename, "/%s/%d/%d-S.json", SEQ_CONFIG_PATH, seq_number, seq_number); + sprintf(filename, "/%s/%d/%s.json", PERFORMANCE_CONFIG_PATH, seq_number, PERFORMANCE_CONFIG_NAME); #ifdef DEBUG - Serial.print(F("Saving sequencer config ")); + Serial.print(F("Saving performance config ")); Serial.print(seq_number); Serial.print(F(" to ")); Serial.println(filename); @@ -1203,9 +1190,9 @@ void get_sd_seq_name_json(uint8_t seq_number) { File json; StaticJsonDocument data_json; - char filename[FILENAME_LEN]; + char filename[CONFIG_FILENAME_LEN]; - sprintf(filename, "/%s/%d/%d-S.json", SEQ_CONFIG_PATH, seq_number, seq_number); + sprintf(filename, "/%s/%d/%s.json", PERFORMANCE_CONFIG_PATH, seq_number, PERFORMANCE_CONFIG_NAME); // first check if file exists... AudioNoInterrupts(); @@ -1240,9 +1227,9 @@ bool load_sd_seq_sub_vel_json(uint8_t seq_number) { File json; StaticJsonDocument data_json; - char filename[FILENAME_LEN]; + char filename[CONFIG_FILENAME_LEN]; - sprintf(filename, "/%s/%d/%d-vel.json", SEQ_CONFIG_PATH, seq_number, seq_number); + sprintf(filename, "/%s/%d/%s.json", PERFORMANCE_CONFIG_PATH, seq_number, VELOCITY_CONFIG_NAME); // first check if file exists... AudioNoInterrupts(); @@ -1308,9 +1295,9 @@ bool load_sd_seq_sub_patterns_json(uint8_t seq_number) { File json; StaticJsonDocument data_json; - char filename[FILENAME_LEN]; + char filename[CONFIG_FILENAME_LEN]; - sprintf(filename, "/%s/%d/%d-pat.json", SEQ_CONFIG_PATH, seq_number, seq_number); + sprintf(filename, "/%s/%d/%s.json", PERFORMANCE_CONFIG_PATH, seq_number, PATTERN_CONFIG_NAME); // first check if file exists... AudioNoInterrupts(); @@ -1385,14 +1372,14 @@ bool load_sd_seq_json(uint8_t seq_number) AudioNoInterrupts(); load_sd_seq_sub_patterns_json(seq_number); load_sd_seq_sub_vel_json(seq_number); - load_sd_fx_json(seq_number, 1); + load_sd_fx_json(seq_number); if (sd_card > 0) { File json; StaticJsonDocument data_json; - char filename[FILENAME_LEN]; - sprintf(filename, "/%s/%d/%d-S.json", SEQ_CONFIG_PATH, seq_number, seq_number); + char filename[CONFIG_FILENAME_LEN]; + sprintf(filename, "/%s/%d/%s.json", PERFORMANCE_CONFIG_PATH, seq_number, PERFORMANCE_CONFIG_NAME); // first check if file exists... if (SD.exists(filename)) { @@ -1465,7 +1452,7 @@ bool load_sd_seq_json(uint8_t seq_number) configuration.performance.bank[instance_id] = data_json["bank"][instance_id]; configuration.performance.voice[instance_id] = data_json["voice"][instance_id]; load_sd_voice(configuration.performance.bank[instance_id], configuration.performance.voice[instance_id], instance_id); - load_sd_voiceconfig_json(seq_number, instance_id, 1); + load_sd_voiceconfig_json(seq_number, instance_id); MicroDexed[instance_id]->setGain(midi_volume_transform(map(configuration.dexed[instance_id].sound_intensity, SOUND_INTENSITY_MIN, SOUND_INTENSITY_MAX, 0, 127))); MicroDexed[instance_id]->panic(); #ifdef DEBUG @@ -1509,7 +1496,7 @@ bool load_sd_seq_json(uint8_t seq_number) return (false); } -bool check_sd_seq_exists(uint8_t number) +bool check_sd_performance_exists(uint8_t number) { if (number < 0) return (false); @@ -1518,9 +1505,9 @@ bool check_sd_seq_exists(uint8_t number) AudioNoInterrupts(); if (sd_card > 0) { - char filename[FILENAME_LEN]; + char filename[CONFIG_FILENAME_LEN]; - sprintf(filename, "/%s/%d/%d-S.json", SEQ_CONFIG_PATH, number, number); + sprintf(filename, "/%s/%d/%s.json", PERFORMANCE_CONFIG_PATH, number, PERFORMANCE_CONFIG_NAME); // check if file exists... if (SD.exists(filename)) @@ -1543,7 +1530,8 @@ bool check_sd_seq_exists(uint8_t number) /****************************************************************************** SD PERFORMANCE ******************************************************************************/ -bool load_sd_performance_json(uint8_t p) +/* + bool load_sd_performance_json(uint8_t p) { if (p < 0) return (false); @@ -1553,8 +1541,8 @@ bool load_sd_performance_json(uint8_t p) { File json; StaticJsonDocument data_json; - char filename[FILENAME_LEN]; - sprintf(filename, "/%s/%d/%s%d.json", PERFORMANCE_CONFIG_PATH, p, PERFORMANCE_CONFIG_NAME, p); + char filename[CONFIG_FILENAME_LEN]; + sprintf(filename, "/%s/%d/%s.json", PERFORMANCE_CONFIG_PATH, p, PERFORMANCE_CONFIG_NAME); // first check if file exists... AudioNoInterrupts(); if (SD.exists(filename)) @@ -1590,7 +1578,7 @@ bool load_sd_performance_json(uint8_t p) for (uint8_t instance_id = 0; instance_id < NUM_DEXED; instance_id++) { load_sd_voice(configuration.performance.bank[instance_id], configuration.performance.voice[instance_id], instance_id); - load_sd_voiceconfig_json(configuration.performance.voiceconfig_number[instance_id], instance_id, 0); + load_sd_voiceconfig_json(configuration.performance.voiceconfig_number[instance_id], instance_id); MicroDexed[instance_id]->ControllersRefresh(); MicroDexed[instance_id]->panic(); } @@ -1621,9 +1609,9 @@ bool load_sd_performance_json(uint8_t p) bool save_sd_performance_json(uint8_t p) { - char filename[FILENAME_LEN]; + char filename[CONFIG_FILENAME_LEN]; p = constrain(p, 0, MAX_PERFORMANCE); - sprintf(filename, "/%s/%s%d.json", PERFORMANCE_CONFIG_PATH, PERFORMANCE_CONFIG_NAME, p); + sprintf(filename, "/%s/%d/%s.json", PERFORMANCE_CONFIG_PATH, p, PERFORMANCE_CONFIG_NAME); if (sd_card > 0) { File json; @@ -1660,7 +1648,7 @@ bool save_sd_performance_json(uint8_t p) save_sd_voiceconfig_json(configuration.performance.voiceconfig_number[i], i, 0); } } - sprintf(filename, "/%s/%s%d.json", PERFORMANCE_CONFIG_PATH, PERFORMANCE_CONFIG_NAME, p); + sprintf(filename, "/%s/%d/%s.json", PERFORMANCE_CONFIG_PATH, PERFORMANCE_CONFIG_NAME, p); json = SD.open(filename, FILE_WRITE); if (json) { @@ -1696,6 +1684,7 @@ bool save_sd_performance_json(uint8_t p) AudioInterrupts(); return (false); } +*/ /****************************************************************************** HELPER FUNCTIONS @@ -1861,7 +1850,7 @@ uint8_t calc_checksum(uint8_t* data, uint16_t len) void strip_extension(const char* s, char* target, uint8_t len) { - char tmp[FILENAME_LEN]; + char tmp[CONFIG_FILENAME_LEN]; char* token; strcpy(tmp, s); diff --git a/dexed_sd.h b/dexed_sd.h index c2c6853..3d93c27 100644 --- a/dexed_sd.h +++ b/dexed_sd.h @@ -41,25 +41,21 @@ extern uint8_t ui_state; extern uint8_t ui_main_state; extern config_t configuration; extern uint32_t crc32(byte * calc_start, uint16_t calc_bytes); -extern void eeprom_update_dexed(uint8_t instance_id); -extern void eeprom_update_performance(void); -extern void eeprom_update_fx(void); extern void set_fx_params(void); extern void set_voiceconfig_params(uint8_t instance_id); extern void set_sys_params(void); - bool load_sd_voice(uint8_t b, uint8_t v, uint8_t instance_id); bool save_sd_voice(uint8_t b, uint8_t v, uint8_t instance_id); 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_json(uint8_t vc, uint8_t instance_id, uint8_t target); -bool save_sd_voiceconfig_json(uint8_t vc, uint8_t instance_id, uint8_t target); +bool load_sd_voiceconfig_json(uint8_t vc, uint8_t instance_id); +bool save_sd_voiceconfig_json(uint8_t vc, uint8_t instance_id); -bool load_sd_fx_json(uint8_t fx, uint8_t target); -bool save_sd_fx_json(uint8_t fx, uint8_t target); +bool load_sd_fx_json(uint8_t fx); +bool save_sd_fx_json(uint8_t fx); bool load_sd_performance_json(uint8_t p); bool save_sd_performance_json(uint8_t p);