Massive changes for better save/load of a performance.

pull/111/head
Holger Wirtz 3 years ago
parent a3d8a613b9
commit 9d81ffe334
  1. 26
      MicroDexed.ino
  2. 19
      UI.hpp
  3. 0
      addon/SD/PERFORMANCE/0/drums.json
  4. 0
      addon/SD/PERFORMANCE/0/fx.json
  5. 0
      addon/SD/PERFORMANCE/0/patterns.json
  6. 0
      addon/SD/PERFORMANCE/0/performance.json
  7. 0
      addon/SD/PERFORMANCE/0/velocity.json
  8. 0
      addon/SD/PERFORMANCE/0/voice1.json
  9. 0
      addon/SD/PERFORMANCE/0/voice2.json
  10. 0
      addon/SD/PERFORMANCE/1/drums.json
  11. 0
      addon/SD/PERFORMANCE/1/fx.json
  12. 0
      addon/SD/PERFORMANCE/1/patterns.json
  13. 0
      addon/SD/PERFORMANCE/1/performance.json
  14. 0
      addon/SD/PERFORMANCE/1/velocity.json
  15. 0
      addon/SD/PERFORMANCE/1/voice1.json
  16. 0
      addon/SD/PERFORMANCE/1/voice2.json
  17. 0
      addon/SD/PERFORMANCE/2/drums.json
  18. 0
      addon/SD/PERFORMANCE/2/fx.json
  19. 0
      addon/SD/PERFORMANCE/2/patterns.json
  20. 0
      addon/SD/PERFORMANCE/2/performance.json
  21. 0
      addon/SD/PERFORMANCE/2/velocity.json
  22. 0
      addon/SD/PERFORMANCE/2/voice1.json
  23. 0
      addon/SD/PERFORMANCE/2/voice2.json
  24. 0
      addon/SD/PERFORMANCE/3/drums.json
  25. 0
      addon/SD/PERFORMANCE/3/fx.json
  26. 0
      addon/SD/PERFORMANCE/3/patterns.json
  27. 0
      addon/SD/PERFORMANCE/3/performance.json
  28. 0
      addon/SD/PERFORMANCE/3/velocity.json
  29. 0
      addon/SD/PERFORMANCE/3/voice1.json
  30. 0
      addon/SD/PERFORMANCE/3/voice2.json
  31. 0
      addon/SD/PERFORMANCE/4/drums.json
  32. 0
      addon/SD/PERFORMANCE/4/fx.json
  33. 0
      addon/SD/PERFORMANCE/4/patterns.json
  34. 0
      addon/SD/PERFORMANCE/4/performance.json
  35. 0
      addon/SD/PERFORMANCE/4/velocity.json
  36. 0
      addon/SD/PERFORMANCE/4/voice1.json
  37. 0
      addon/SD/PERFORMANCE/4/voice2.json
  38. 0
      addon/SD/PERFORMANCE/5/drums.json
  39. 0
      addon/SD/PERFORMANCE/5/fx.json
  40. 0
      addon/SD/PERFORMANCE/5/patterns.json
  41. 0
      addon/SD/PERFORMANCE/5/performance.json
  42. 0
      addon/SD/PERFORMANCE/5/velocity.json
  43. 0
      addon/SD/PERFORMANCE/5/voice1.json
  44. 0
      addon/SD/PERFORMANCE/5/voice2.json
  45. 0
      addon/SD/PERFORMANCE/6/drums.json
  46. 0
      addon/SD/PERFORMANCE/6/fx.json
  47. 0
      addon/SD/PERFORMANCE/6/patterns.json
  48. 0
      addon/SD/PERFORMANCE/6/performance.json
  49. 0
      addon/SD/PERFORMANCE/6/velocity.json
  50. 0
      addon/SD/PERFORMANCE/6/voice1.json
  51. 0
      addon/SD/PERFORMANCE/6/voice2.json
  52. 0
      addon/SD/PERFORMANCE/7/drums.json
  53. 0
      addon/SD/PERFORMANCE/7/fx.json
  54. 0
      addon/SD/PERFORMANCE/7/patterns.json
  55. 0
      addon/SD/PERFORMANCE/7/performance.json
  56. 0
      addon/SD/PERFORMANCE/7/velocity.json
  57. 0
      addon/SD/PERFORMANCE/7/voice1.json
  58. 0
      addon/SD/PERFORMANCE/7/voice2.json
  59. 0
      addon/SD/PERFORMANCE/8/drums.json
  60. 0
      addon/SD/PERFORMANCE/8/fx.json
  61. 0
      addon/SD/PERFORMANCE/8/patterns.json
  62. 0
      addon/SD/PERFORMANCE/8/performance.json
  63. 0
      addon/SD/PERFORMANCE/8/velocity.json
  64. 0
      addon/SD/PERFORMANCE/8/voice1.json
  65. 0
      addon/SD/PERFORMANCE/8/voice2.json
  66. 30
      config.h
  67. 161
      dexed_sd.cpp
  68. 12
      dexed_sd.h

@ -2540,53 +2540,56 @@ void check_and_create_directories(void)
}
}
/*
// create directories for configuration files
sprintf(tmp, "/%s", VOICE_CONFIG_PATH);
if (!SD.exists(tmp))
{
#ifdef DEBUG
#ifdef DEBUG
Serial.print(F("Creating directory "));
Serial.println(tmp);
#endif
#endif
SD.mkdir(tmp);
}
sprintf(tmp, "/%s", PERFORMANCE_CONFIG_PATH);
if (!SD.exists(tmp))
{
#ifdef DEBUG
#ifdef DEBUG
Serial.print(F("Creating directory "));
Serial.println(tmp);
#endif
#endif
SD.mkdir(tmp);
}
sprintf(tmp, "/%s", FX_CONFIG_PATH);
if (!SD.exists(tmp))
{
#ifdef DEBUG
#ifdef DEBUG
Serial.print(F("Creating directory "));
Serial.println(tmp);
#endif
#endif
SD.mkdir(tmp);
}
sprintf(tmp, "/%s", DRUM_CONFIG_PATH);
if (!SD.exists(tmp))
{
#ifdef DEBUG
#ifdef DEBUG
Serial.print(F("Creating directory "));
Serial.println(tmp);
#endif
#endif
SD.mkdir(tmp);
}
sprintf(tmp, "/%s", FAV_CONFIG_PATH);
if (!SD.exists(tmp))
{
#ifdef DEBUG
#ifdef DEBUG
Serial.print(F("Creating directory "));
Serial.println(tmp);
#endif
#endif
SD.mkdir(tmp);
}
sprintf(tmp, "/%s", SEQ_CONFIG_PATH);
*/
sprintf(tmp, "/%s", PERFORMANCE_CONFIG_PATH);
if (!SD.exists(tmp))
{
#ifdef DEBUG
@ -2597,7 +2600,6 @@ void check_and_create_directories(void)
}
//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)) {

@ -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 )

@ -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 {

@ -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<JSON_BUFFER_SIZE> 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<JSON_BUFFER_SIZE> 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<JSON_BUFFER_SIZE> 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<JSON_BUFFER_SIZE> 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<JSON_BUFFER_SIZE> 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<JSON_BUFFER_SIZE> 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<JSON_BUFFER_SIZE> 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<JSON_BUFFER_SIZE> 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<JSON_BUFFER_SIZE> 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<JSON_BUFFER_SIZE> 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<JSON_BUFFER_SIZE> 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<JSON_BUFFER_SIZE> 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<JSON_BUFFER_SIZE> 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<JSON_BUFFER_SIZE> 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);

@ -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);

Loading…
Cancel
Save