Dateien hochladen nach „“

pull/85/head
positionhigh 3 years ago
parent 2900b031a9
commit d9c83ed277
  1. 86
      UI.hpp
  2. 32
      config.h
  3. 48
      dexed_sd.cpp

@ -6626,7 +6626,7 @@ void UI_func_save_performance(uint8_t param)
void UI_func_load_voiceconfig(uint8_t param) void UI_func_load_voiceconfig(uint8_t param)
{ {
#if NUMDEXED > 1 #if NUM_DEXED > 1
static int8_t selected_instance_id; static int8_t selected_instance_id;
#else #else
uint8_t selected_instance_id = 0; uint8_t selected_instance_id = 0;
@ -6636,15 +6636,14 @@ void UI_func_load_voiceconfig(uint8_t param)
if (LCDML.FUNC_setup()) // ****** SETUP ********* if (LCDML.FUNC_setup()) // ****** SETUP *********
{ {
char tmp[10];
selected_instance_id = 0; selected_instance_id = 0;
encoderDir[ENC_R].reset(); encoderDir[ENC_R].reset();
lcd.setCursor(0, 0); lcd.setCursor(0, 0);
lcd.print(F("Load VoiceCfg SD")); lcd.print(F("Load VoiceCfg SD"));
#if NUMDEXED > 1 #if NUM_DEXED > 1
mode = 0; mode = 0;
lcd.setCursor(0, 1); lcd.setCursor(0, 1);
lcd.print(F("Instance [0]")); lcd.print(F("Instance [0]"));
@ -6663,29 +6662,33 @@ void UI_func_load_voiceconfig(uint8_t param)
if (LCDML.BT_checkDown()) if (LCDML.BT_checkDown())
{ {
if (mode == 0) if (mode == 0)
selected_instance_id = (selected_instance_id + 1) % 2; selected_instance_id = 1;
//selected_instance_id = (selected_instance_id + 1) % 2;
else if (mode == 1) else if (mode == 1)
configuration.performance.voiceconfig_number[selected_instance_id] = constrain(configuration.performance.voiceconfig_number[selected_instance_id] + ENCODER[ENC_L].speed(), VOICECONFIG_NUM_MIN, VOICECONFIG_NUM_MAX); configuration.performance.voiceconfig_number[selected_instance_id] = constrain(configuration.performance.voiceconfig_number[selected_instance_id] + ENCODER[ENC_L].speed(), VOICECONFIG_NUM_MIN, VOICECONFIG_NUM_MAX);
} }
else if (LCDML.BT_checkUp()) else if (LCDML.BT_checkUp())
{ {
if (mode == 0) if (mode == 0)
selected_instance_id = (selected_instance_id - 1) % 2; //selected_instance_id = (selected_instance_id - 1) % 2;
selected_instance_id = 0;
else if (mode == 1) else if (mode == 1)
configuration.performance.voiceconfig_number[selected_instance_id] = constrain(configuration.performance.voiceconfig_number[selected_instance_id] - ENCODER[ENC_L].speed(), VOICECONFIG_NUM_MIN, VOICECONFIG_NUM_MAX); configuration.performance.voiceconfig_number[selected_instance_id] = constrain(configuration.performance.voiceconfig_number[selected_instance_id] - ENCODER[ENC_L].speed(), VOICECONFIG_NUM_MIN, VOICECONFIG_NUM_MAX);
} }
else if (LCDML.BT_checkEnter()) else if (LCDML.BT_checkEnter())
{ {
mode = 0xff; if (mode > 0) {
lcd.setCursor(0, 1); mode = 0xff;
if (load_sd_voiceconfig_json(configuration.performance.voiceconfig_number[selected_instance_id], selected_instance_id) == false) lcd.setCursor(0, 1);
lcd.print("Does not exist. "); if (load_sd_voiceconfig_json(configuration.performance.voiceconfig_number[selected_instance_id], selected_instance_id) == false)
else lcd.print("Does not exist. ");
lcd.print("Done. "); else
lcd.print("Done. ");
delay(MESSAGE_WAIT_TIME); delay(MESSAGE_WAIT_TIME);
LCDML.FUNC_goBackToMenu(); LCDML.FUNC_goBackToMenu();
} else mode = 1;
} }
if (mode == 0) if (mode == 0)
@ -6727,7 +6730,7 @@ void UI_func_load_voiceconfig(uint8_t param)
void UI_func_save_voiceconfig(uint8_t param) void UI_func_save_voiceconfig(uint8_t param)
{ {
#if NUMDEXED > 1 #if NUM_DEXED > 1
static int8_t selected_instance_id; static int8_t selected_instance_id;
#else #else
uint8_t selected_instance_id = 0; uint8_t selected_instance_id = 0;
@ -6739,8 +6742,6 @@ void UI_func_save_voiceconfig(uint8_t param)
if (LCDML.FUNC_setup()) // ****** SETUP ********* if (LCDML.FUNC_setup()) // ****** SETUP *********
{ {
char tmp[FILENAME_LEN];
yesno = false; yesno = false;
selected_instance_id = 0; selected_instance_id = 0;
@ -6748,7 +6749,7 @@ void UI_func_save_voiceconfig(uint8_t param)
lcd.setCursor(0, 0); lcd.setCursor(0, 0);
lcd.print(F("Save VoiceCfg SD")); lcd.print(F("Save VoiceCfg SD"));
#if NUMDEXED > 1 #if NUM_DEXED > 1
mode = 0; mode = 0;
lcd.setCursor(0, 1); lcd.setCursor(0, 1);
lcd.print(F("Instance [0]")); lcd.print(F("Instance [0]"));
@ -6773,7 +6774,8 @@ void UI_func_save_voiceconfig(uint8_t param)
if (LCDML.BT_checkDown()) if (LCDML.BT_checkDown())
{ {
if (mode == 0) if (mode == 0)
selected_instance_id = (selected_instance_id + 1) % 2; selected_instance_id = 1;
// selected_instance_id = (selected_instance_id +1) % 2;
else if (mode == 1) else if (mode == 1)
configuration.performance.voiceconfig_number[selected_instance_id] = constrain(configuration.performance.voiceconfig_number[selected_instance_id] + ENCODER[ENC_L].speed(), VOICECONFIG_NUM_MIN, VOICECONFIG_NUM_MAX); configuration.performance.voiceconfig_number[selected_instance_id] = constrain(configuration.performance.voiceconfig_number[selected_instance_id] + ENCODER[ENC_L].speed(), VOICECONFIG_NUM_MIN, VOICECONFIG_NUM_MAX);
else else
@ -6782,7 +6784,8 @@ void UI_func_save_voiceconfig(uint8_t param)
else if (LCDML.BT_checkUp()) else if (LCDML.BT_checkUp())
{ {
if (mode == 0) if (mode == 0)
selected_instance_id = (selected_instance_id - 1) % 2; selected_instance_id = 0;
//selected_instance_id = (selected_instance_id - 1) % 2;
else if (mode == 1) else if (mode == 1)
configuration.performance.voiceconfig_number[selected_instance_id] = constrain(configuration.performance.voiceconfig_number[selected_instance_id] - ENCODER[ENC_L].speed(), VOICECONFIG_NUM_MIN, VOICECONFIG_NUM_MAX); configuration.performance.voiceconfig_number[selected_instance_id] = constrain(configuration.performance.voiceconfig_number[selected_instance_id] - ENCODER[ENC_L].speed(), VOICECONFIG_NUM_MIN, VOICECONFIG_NUM_MAX);
else else
@ -6796,7 +6799,7 @@ void UI_func_save_voiceconfig(uint8_t param)
lcd.setCursor(0, 1); lcd.setCursor(0, 1);
lcd.print(F("Overwrite: [ ]")); lcd.print(F("Overwrite: [ ]"));
} }
else else if (mode > 0 )
{ {
mode = 0xff; mode = 0xff;
if (overwrite == false || yesno == true) if (overwrite == false || yesno == true)
@ -6822,12 +6825,18 @@ void UI_func_save_voiceconfig(uint8_t param)
lcd.print(tmp); lcd.print(tmp);
} }
} }
else {
mode = 1;
lcd.setCursor(4, 1);
lcd.print(" ");
}
} }
if (mode == 0) if (mode == 0)
{ {
lcd.setCursor(10, 1); lcd.setCursor(10, 1);
lcd.print(configuration.performance.voiceconfig_number[selected_instance_id]); //lcd.print(configuration.performance.voiceconfig_number[selected_instance_id]);
lcd.print(selected_instance_id);
} }
else if (mode == 1) else if (mode == 1)
{ {
@ -7708,11 +7717,8 @@ void UI_func_eq_1(uint8_t param)
} }
} }
lcd_display_meter_float("EQ 50Hz", configuration.fx.eq_1, 0.1, 0.0, EQ_1_MIN, EQ_1_MAX, 1, 1, false, true, true); lcd_display_meter_float("EQ 50Hz", configuration.fx.eq_1, 0.1, 0.0, EQ_1_MIN, EQ_1_MAX, 1, 1, false, true, true);
sgtl5000.setEQGain(1, mapfloat(configuration.fx.eq_1, EQ_1_MIN, EQ_1_MAX, -9.9, 9.9)); sgtl5000.setEQGain(1, mapfloat(configuration.fx.eq_1, EQ_1_MIN, EQ_1_MAX, 0.0, 1.0));
sgtl5000.commitFilter(1); sgtl5000.commitFilter(1);
#ifdef DEBUG
sgtl5000.show_params(1);
#endif
} }
if (LCDML.FUNC_close()) // ****** STABLE END ********* if (LCDML.FUNC_close()) // ****** STABLE END *********
@ -7756,11 +7762,8 @@ void UI_func_eq_2(uint8_t param)
} }
} }
lcd_display_meter_float("EQ 120Hz", configuration.fx.eq_2, 0.1, 0.0, EQ_2_MIN, EQ_2_MAX, 1, 1, false, true, true); lcd_display_meter_float("EQ 120Hz", configuration.fx.eq_2, 0.1, 0.0, EQ_2_MIN, EQ_2_MAX, 1, 1, false, true, true);
sgtl5000.setEQGain(2, mapfloat(configuration.fx.eq_2, EQ_2_MIN, EQ_2_MAX, -9.9, 9.9)); sgtl5000.setEQGain(2, mapfloat(configuration.fx.eq_2, EQ_2_MIN, EQ_2_MAX, 0.0, 1.0));
sgtl5000.commitFilter(2); sgtl5000.commitFilter(2);
#ifdef DEBUG
sgtl5000.show_params(2);
#endif
} }
if (LCDML.FUNC_close()) // ****** STABLE END ********* if (LCDML.FUNC_close()) // ****** STABLE END *********
@ -7804,11 +7807,8 @@ void UI_func_eq_3(uint8_t param)
} }
} }
lcd_display_meter_float("EQ 220Hz", configuration.fx.eq_3, 0.1, 0.0, EQ_3_MIN, EQ_3_MAX, 1, 1, false, true, true); lcd_display_meter_float("EQ 220Hz", configuration.fx.eq_3, 0.1, 0.0, EQ_3_MIN, EQ_3_MAX, 1, 1, false, true, true);
sgtl5000.setEQGain(3, mapfloat(configuration.fx.eq_3, EQ_3_MIN, EQ_3_MAX, -9.9, 9.9)); sgtl5000.setEQGain(3, mapfloat(configuration.fx.eq_3, EQ_3_MIN, EQ_3_MAX, 0.0, 1.0));
sgtl5000.commitFilter(3); sgtl5000.commitFilter(3);
#ifdef DEBUG
sgtl5000.show_params(3);
#endif
} }
if (LCDML.FUNC_close()) // ****** STABLE END ********* if (LCDML.FUNC_close()) // ****** STABLE END *********
@ -7852,11 +7852,8 @@ void UI_func_eq_4(uint8_t param)
} }
} }
lcd_display_meter_float("EQ 1000Hz", configuration.fx.eq_4, 0.1, 0.0, EQ_4_MIN, EQ_4_MAX, 1, 1, false, true, true); lcd_display_meter_float("EQ 1000Hz", configuration.fx.eq_4, 0.1, 0.0, EQ_4_MIN, EQ_4_MAX, 1, 1, false, true, true);
sgtl5000.setEQGain(4, mapfloat(configuration.fx.eq_4, EQ_4_MIN, EQ_4_MAX, -9.9, 9.9)); sgtl5000.setEQGain(4, mapfloat(configuration.fx.eq_4, EQ_4_MIN, EQ_4_MAX, 0.0, 1.0));
sgtl5000.commitFilter(4); sgtl5000.commitFilter(4);
#ifdef DEBUG
sgtl5000.show_params(4);
#endif
} }
if (LCDML.FUNC_close()) // ****** STABLE END ********* if (LCDML.FUNC_close()) // ****** STABLE END *********
@ -7900,11 +7897,8 @@ void UI_func_eq_5(uint8_t param)
} }
} }
lcd_display_meter_float("EQ 2000Hz", configuration.fx.eq_5, 0.1, 0.0, EQ_5_MIN, EQ_5_MAX, 1, 1, false, true, true); lcd_display_meter_float("EQ 2000Hz", configuration.fx.eq_5, 0.1, 0.0, EQ_5_MIN, EQ_5_MAX, 1, 1, false, true, true);
sgtl5000.setEQGain(5, mapfloat(configuration.fx.eq_5, EQ_5_MIN, EQ_5_MAX, -9.9, 9.9)); sgtl5000.setEQGain(5, mapfloat(configuration.fx.eq_5, EQ_5_MIN, EQ_5_MAX, 0.0, 1.0));
sgtl5000.commitFilter(5); sgtl5000.commitFilter(5);
#ifdef DEBUG
sgtl5000.show_params(5);
#endif
} }
if (LCDML.FUNC_close()) // ****** STABLE END ********* if (LCDML.FUNC_close()) // ****** STABLE END *********
@ -7948,11 +7942,8 @@ void UI_func_eq_6(uint8_t param)
} }
} }
lcd_display_meter_float("EQ 7000Hz", configuration.fx.eq_6, 0.1, 0.0, EQ_6_MIN, EQ_6_MAX, 1, 1, false, true, true); lcd_display_meter_float("EQ 7000Hz", configuration.fx.eq_6, 0.1, 0.0, EQ_6_MIN, EQ_6_MAX, 1, 1, false, true, true);
sgtl5000.setEQGain(6, mapfloat(configuration.fx.eq_6, EQ_6_MIN, EQ_6_MAX, -9.9, 9.9)); sgtl5000.setEQGain(6, mapfloat(configuration.fx.eq_6, EQ_6_MIN, EQ_6_MAX, 0.0, 1.0));
sgtl5000.commitFilter(6); sgtl5000.commitFilter(6);
#ifdef DEBUG
sgtl5000.show_params(1);
#endif
} }
if (LCDML.FUNC_close()) // ****** STABLE END ********* if (LCDML.FUNC_close()) // ****** STABLE END *********
@ -7998,9 +7989,6 @@ void UI_func_eq_7(uint8_t param)
lcd_display_meter_float("EQ 10000Hz", configuration.fx.eq_7, 0.1, 0.0, EQ_7_MIN, EQ_7_MAX, 1, 1, false, true, true); lcd_display_meter_float("EQ 10000Hz", configuration.fx.eq_7, 0.1, 0.0, EQ_7_MIN, EQ_7_MAX, 1, 1, false, true, true);
sgtl5000.setEQGain(7, mapfloat(configuration.fx.eq_7, EQ_7_MIN, EQ_7_MAX, 0.0, 1.0)); sgtl5000.setEQGain(7, mapfloat(configuration.fx.eq_7, EQ_7_MIN, EQ_7_MAX, 0.0, 1.0));
sgtl5000.commitFilter(7); sgtl5000.commitFilter(7);
#ifdef DEBUG
sgtl5000.show_params(7);
#endif
} }
if (LCDML.FUNC_close()) // ****** STABLE END ********* if (LCDML.FUNC_close()) // ****** STABLE END *********

@ -602,34 +602,38 @@
#define VOICECONFIG_NUM_MAX MAX_VOICECONFIG #define VOICECONFIG_NUM_MAX MAX_VOICECONFIG
#define VOICECONFIG_NUM_DEFAULT -1 #define VOICECONFIG_NUM_DEFAULT -1
#define EQ_1_MIN -99 #define EQ_1_MIN -10
#define EQ_1_MAX 99 #define EQ_1_MAX 10
#define EQ_1_DEFAULT 0 #define EQ_1_DEFAULT 0
#define EQ_2_MIN -99 #define EQ_2_MIN -10
#define EQ_2_MAX 99 #define EQ_2_MAX 10
#define EQ_2_DEFAULT 0 #define EQ_2_DEFAULT 0
#define EQ_3_MIN -99 #define EQ_3_MIN -10
#define EQ_3_MAX 99 #define EQ_3_MAX 10
#define EQ_3_DEFAULT 0 #define EQ_3_DEFAULT 0
#define EQ_4_MIN -99 #define EQ_4_MIN -10
#define EQ_4_MAX 99 #define EQ_4_MAX 10
#define EQ_4_DEFAULT 0 #define EQ_4_DEFAULT 0
#define EQ_5_MIN -99 #define EQ_5_MIN -10
#define EQ_5_MAX 99 #define EQ_5_MAX 10
#define EQ_5_DEFAULT 0 #define EQ_5_DEFAULT 0
#define EQ_6_MIN -99 #define EQ_6_MIN -10
#define EQ_6_MAX 99 #define EQ_6_MAX 10
#define EQ65_DEFAULT 0 #define EQ65_DEFAULT 0
#define EQ_7_MIN -99 #define EQ_7_MIN -10
#define EQ_7_MAX 99 #define EQ_7_MAX 10
#define EQ_7_DEFAULT 0 #define EQ_7_DEFAULT 0
// Buffer-size define for load/save configuration as JSON
#define JSON_BUFFER_SIZE 8192
// Internal configuration structure // Internal configuration structure
typedef struct dexed_s { typedef struct dexed_s {
uint8_t lowest_note; uint8_t lowest_note;

@ -38,7 +38,7 @@ extern void check_configuration_dexed(uint8_t instance_id);
extern void check_configuration_performance(void); extern void check_configuration_performance(void);
extern void check_configuration_fx(void); extern void check_configuration_fx(void);
extern void sequencer(); extern void sequencer();
extern StaticJsonDocument<JSON_BUFFER> data_json; //extern StaticJsonDocument<JSON_BUFFER> data_json;
extern uint8_t seq_chain_lenght; extern uint8_t seq_chain_lenght;
extern uint8_t seq_data[10][16]; extern uint8_t seq_data[10][16];
extern uint8_t seq_vel[10][16]; extern uint8_t seq_vel[10][16];
@ -52,6 +52,7 @@ extern int seq_transpose;
extern int seq_tempo_ms ; extern int seq_tempo_ms ;
extern int seq_bpm; extern int seq_bpm;
extern bool arp_play_basenote; extern bool arp_play_basenote;
extern bool seq_running;
extern uint8_t arp_speed; extern uint8_t arp_speed;
extern uint8_t arp_lenght; extern uint8_t arp_lenght;
extern uint8_t arp_style; extern uint8_t arp_style;
@ -433,7 +434,7 @@ bool load_sd_voiceconfig_json(int8_t vc, uint8_t instance_id)
if (sd_card > 0) if (sd_card > 0)
{ {
File json; File json;
StaticJsonDocument<JSON_BUFFER_SIZE> data_json;
sprintf(filename, "/%s/%s%d.json", VOICE_CONFIG_PATH, VOICE_CONFIG_NAME, vc); sprintf(filename, "/%s/%s%d.json", VOICE_CONFIG_PATH, VOICE_CONFIG_NAME, vc);
// first check if file exists... // first check if file exists...
@ -525,7 +526,7 @@ bool save_sd_voiceconfig_json(uint8_t vc, uint8_t instance_id)
if (sd_card > 0) if (sd_card > 0)
{ {
File json; File json;
StaticJsonDocument<JSON_BUFFER_SIZE> data_json;
sprintf(filename, "/%s/%s%d.json", VOICE_CONFIG_PATH, VOICE_CONFIG_NAME, vc); sprintf(filename, "/%s/%s%d.json", VOICE_CONFIG_PATH, VOICE_CONFIG_NAME, vc);
#ifdef DEBUG #ifdef DEBUG
@ -612,6 +613,7 @@ bool load_sd_fx_json(int8_t fx)
if (sd_card > 0) if (sd_card > 0)
{ {
File json; File json;
StaticJsonDocument<JSON_BUFFER_SIZE> data_json;
char filename[FILENAME_LEN]; char filename[FILENAME_LEN];
sprintf(filename, "/%s/%s%d.json", FX_CONFIG_PATH, FX_CONFIG_NAME, fx); sprintf(filename, "/%s/%s%d.json", FX_CONFIG_PATH, FX_CONFIG_NAME, fx);
@ -704,7 +706,7 @@ bool save_sd_fx_json(uint8_t fx)
if (sd_card > 0) if (sd_card > 0)
{ {
File json; File json;
StaticJsonDocument<JSON_BUFFER_SIZE> data_json;
sprintf(filename, "/%s/%s%d.json", FX_CONFIG_PATH, FX_CONFIG_NAME, fx); sprintf(filename, "/%s/%s%d.json", FX_CONFIG_PATH, FX_CONFIG_NAME, fx);
#ifdef DEBUG #ifdef DEBUG
@ -781,6 +783,7 @@ bool load_sd_seq_drumsettings_json(uint8_t number)
if (sd_card > 0) if (sd_card > 0)
{ {
File json; File json;
StaticJsonDocument<JSON_BUFFER_SIZE> data_json;
char filename[FILENAME_LEN]; char filename[FILENAME_LEN];
sprintf(filename, "/%s/%s%d-d.json", SEQ_CONFIG_PATH, SEQ_CONFIG_NAME, number); sprintf(filename, "/%s/%s%d-d.json", SEQ_CONFIG_PATH, SEQ_CONFIG_NAME, number);
@ -849,7 +852,7 @@ bool save_sd_seq_drumsettings_json(uint8_t number)
if (sd_card > 0) if (sd_card > 0)
{ {
File json; File json;
StaticJsonDocument<JSON_BUFFER_SIZE> data_json;
sprintf(filename, "/%s/%s%d-d.json", SEQ_CONFIG_PATH, SEQ_CONFIG_NAME, number); sprintf(filename, "/%s/%s%d-d.json", SEQ_CONFIG_PATH, SEQ_CONFIG_NAME, number);
#ifdef DEBUG #ifdef DEBUG
@ -905,7 +908,7 @@ bool save_sd_seq_json(uint8_t seq_number)
if (sd_card > 0) if (sd_card > 0)
{ {
File json; File json;
StaticJsonDocument<JSON_BUFFER_SIZE> data_json;
sprintf(filename, "/%s/%s%d.json", SEQ_CONFIG_PATH, SEQ_CONFIG_NAME, seq_number); sprintf(filename, "/%s/%s%d.json", SEQ_CONFIG_PATH, SEQ_CONFIG_NAME, seq_number);
#ifdef DEBUG #ifdef DEBUG
@ -977,6 +980,7 @@ bool save_sd_seq_json(uint8_t seq_number)
data_json["chord_key_ammount"] = seq_chord_key_ammount; data_json["chord_key_ammount"] = seq_chord_key_ammount;
data_json["seq_oct_shift"] = seq_oct_shift; data_json["seq_oct_shift"] = seq_oct_shift;
data_json["seq_element_shift"] = seq_element_shift; data_json["seq_element_shift"] = seq_element_shift;
data_json["performance"] = configuration.sys.performance_number;
for (uint8_t i = 0; i < sizeof(seq_track_type); i++) { for (uint8_t i = 0; i < sizeof(seq_track_type); i++) {
data_json["track_type"][i] = seq_track_type[i]; data_json["track_type"][i] = seq_track_type[i];
@ -1023,6 +1027,7 @@ bool load_sd_seq_json(uint8_t seq_number)
if (sd_card > 0) if (sd_card > 0)
{ {
File json; File json;
StaticJsonDocument<JSON_BUFFER_SIZE> data_json;
char filename[FILENAME_LEN]; char filename[FILENAME_LEN];
sprintf(filename, "/%s/%s%d.json", SEQ_CONFIG_PATH, SEQ_CONFIG_NAME, seq_number); sprintf(filename, "/%s/%s%d.json", SEQ_CONFIG_PATH, SEQ_CONFIG_NAME, seq_number);
@ -1043,7 +1048,7 @@ bool load_sd_seq_json(uint8_t seq_number)
deserializeJson(data_json, json); deserializeJson(data_json, json);
json.close(); json.close();
AudioInterrupts();
#ifdef DEBUG #ifdef DEBUG
Serial.println(F("Read JSON data:")); Serial.println(F("Read JSON data:"));
@ -1090,7 +1095,6 @@ bool load_sd_seq_json(uint8_t seq_number)
for (uint8_t i = 0; i < sizeof(seq_inst_dexed); i++) { for (uint8_t i = 0; i < sizeof(seq_inst_dexed); i++) {
seq_inst_dexed[i] = data_json["seq_inst_dexed"][i]; seq_inst_dexed[i] = data_json["seq_inst_dexed"][i];
} }
count = 0; count = 0;
seq_tempo_ms = data_json["seq_tempo_ms"] ; seq_tempo_ms = data_json["seq_tempo_ms"] ;
seq_bpm = data_json["seq_bpm"]; seq_bpm = data_json["seq_bpm"];
@ -1105,10 +1109,15 @@ bool load_sd_seq_json(uint8_t seq_number)
seq_chord_key_ammount = data_json["chord_key_ammount"]; seq_chord_key_ammount = data_json["chord_key_ammount"];
seq_oct_shift = data_json["seq_oct_shift"]; seq_oct_shift = data_json["seq_oct_shift"];
seq_element_shift = data_json["seq_element_shift"]; seq_element_shift = data_json["seq_element_shift"];
configuration.sys.performance_number = data_json["performance"];
load_sd_performance_json(configuration.sys.performance_number);
if (seq_running)
timer1.begin(sequencer, seq_tempo_ms / 2);
else
timer1.begin(sequencer, seq_tempo_ms / 2, false);
return (true); return (true);
} }
#ifdef DEBUG #ifdef DEBUG
else else
@ -1135,7 +1144,7 @@ bool check_sd_seq_exists(uint8_t number)
return (false); return (false);
number = constrain(number, 0, 99); number = constrain(number, 0, 99);
AudioNoInterrupts();
if (sd_card > 0) if (sd_card > 0)
{ {
char filename[FILENAME_LEN]; char filename[FILENAME_LEN];
@ -1143,14 +1152,20 @@ bool check_sd_seq_exists(uint8_t number)
sprintf(filename, "/%s/%s%d.json", SEQ_CONFIG_PATH, SEQ_CONFIG_NAME, number); sprintf(filename, "/%s/%s%d.json", SEQ_CONFIG_PATH, SEQ_CONFIG_NAME, number);
// check if file exists... // check if file exists...
AudioNoInterrupts();
if (SD.exists(filename)) if (SD.exists(filename))
{ {
AudioInterrupts();
return (true); return (true);
} else return (false); } else
{
AudioInterrupts();
return (false);
}
} else } else
{ AudioInterrupts();
return (false); return (false);
AudioInterrupts(); }
} }
/****************************************************************************** /******************************************************************************
@ -1166,6 +1181,7 @@ bool load_sd_performance_json(int8_t p)
if (sd_card > 0) if (sd_card > 0)
{ {
File json; File json;
StaticJsonDocument<JSON_BUFFER_SIZE> data_json;
char filename[FILENAME_LEN]; char filename[FILENAME_LEN];
sprintf(filename, "/%s/%s%d.json", PERFORMANCE_CONFIG_PATH, PERFORMANCE_CONFIG_NAME, p); sprintf(filename, "/%s/%s%d.json", PERFORMANCE_CONFIG_PATH, PERFORMANCE_CONFIG_NAME, p);
@ -1239,11 +1255,12 @@ bool save_sd_performance_json(uint8_t p)
char filename[FILENAME_LEN]; char filename[FILENAME_LEN];
p = constrain(p, 0, MAX_PERFORMANCE); p = constrain(p, 0, MAX_PERFORMANCE);
sprintf(filename, "/%s/%s%d.json", PERFORMANCE_CONFIG_PATH, PERFORMANCE_CONFIG_NAME, p);
if (sd_card > 0) if (sd_card > 0)
{ {
File json; File json;
StaticJsonDocument<JSON_BUFFER_SIZE> data_json;
#ifdef DEBUG #ifdef DEBUG
Serial.print(F("Saving performance config as JSON")); Serial.print(F("Saving performance config as JSON"));
Serial.print(p); Serial.print(p);
@ -1262,7 +1279,8 @@ bool save_sd_performance_json(uint8_t p)
Serial.print(configuration.performance.fx_number); Serial.print(configuration.performance.fx_number);
Serial.println(F(" does not exists, creating one.")); Serial.println(F(" does not exists, creating one."));
#endif #endif
save_sd_performance_json(configuration.performance.fx_number); //save_sd_performance_json(configuration.performance.fx_number);
save_sd_fx_json(configuration.performance.fx_number);
} }
for (uint8_t i = 0; i < MAX_DEXED; i++) for (uint8_t i = 0; i < MAX_DEXED; i++)
{ {

Loading…
Cancel
Save