|
|
|
@ -38,7 +38,7 @@ extern void check_configuration_dexed(uint8_t instance_id); |
|
|
|
|
extern void check_configuration_performance(void); |
|
|
|
|
extern void check_configuration_fx(void); |
|
|
|
|
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_data[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_bpm; |
|
|
|
|
extern bool arp_play_basenote; |
|
|
|
|
extern bool seq_running; |
|
|
|
|
extern uint8_t arp_speed; |
|
|
|
|
extern uint8_t arp_lenght; |
|
|
|
|
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) |
|
|
|
|
{ |
|
|
|
|
File json; |
|
|
|
|
|
|
|
|
|
StaticJsonDocument<JSON_BUFFER_SIZE> data_json; |
|
|
|
|
sprintf(filename, "/%s/%s%d.json", VOICE_CONFIG_PATH, VOICE_CONFIG_NAME, vc); |
|
|
|
|
|
|
|
|
|
// 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) |
|
|
|
|
{ |
|
|
|
|
File json; |
|
|
|
|
|
|
|
|
|
StaticJsonDocument<JSON_BUFFER_SIZE> data_json; |
|
|
|
|
sprintf(filename, "/%s/%s%d.json", VOICE_CONFIG_PATH, VOICE_CONFIG_NAME, vc); |
|
|
|
|
|
|
|
|
|
#ifdef DEBUG |
|
|
|
@ -612,6 +613,7 @@ bool load_sd_fx_json(int8_t fx) |
|
|
|
|
if (sd_card > 0) |
|
|
|
|
{ |
|
|
|
|
File json; |
|
|
|
|
StaticJsonDocument<JSON_BUFFER_SIZE> data_json; |
|
|
|
|
char filename[FILENAME_LEN]; |
|
|
|
|
|
|
|
|
|
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) |
|
|
|
|
{ |
|
|
|
|
File json; |
|
|
|
|
|
|
|
|
|
StaticJsonDocument<JSON_BUFFER_SIZE> data_json; |
|
|
|
|
sprintf(filename, "/%s/%s%d.json", FX_CONFIG_PATH, FX_CONFIG_NAME, fx); |
|
|
|
|
|
|
|
|
|
#ifdef DEBUG |
|
|
|
@ -781,6 +783,7 @@ bool load_sd_seq_drumsettings_json(uint8_t number) |
|
|
|
|
if (sd_card > 0) |
|
|
|
|
{ |
|
|
|
|
File json; |
|
|
|
|
StaticJsonDocument<JSON_BUFFER_SIZE> data_json; |
|
|
|
|
char filename[FILENAME_LEN]; |
|
|
|
|
|
|
|
|
|
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) |
|
|
|
|
{ |
|
|
|
|
File json; |
|
|
|
|
|
|
|
|
|
StaticJsonDocument<JSON_BUFFER_SIZE> data_json; |
|
|
|
|
sprintf(filename, "/%s/%s%d-d.json", SEQ_CONFIG_PATH, SEQ_CONFIG_NAME, number); |
|
|
|
|
|
|
|
|
|
#ifdef DEBUG |
|
|
|
@ -905,7 +908,7 @@ bool save_sd_seq_json(uint8_t seq_number) |
|
|
|
|
if (sd_card > 0) |
|
|
|
|
{ |
|
|
|
|
File json; |
|
|
|
|
|
|
|
|
|
StaticJsonDocument<JSON_BUFFER_SIZE> data_json; |
|
|
|
|
sprintf(filename, "/%s/%s%d.json", SEQ_CONFIG_PATH, SEQ_CONFIG_NAME, seq_number); |
|
|
|
|
|
|
|
|
|
#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["seq_oct_shift"] = seq_oct_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++) { |
|
|
|
|
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) |
|
|
|
|
{ |
|
|
|
|
File json; |
|
|
|
|
StaticJsonDocument<JSON_BUFFER_SIZE> data_json; |
|
|
|
|
char filename[FILENAME_LEN]; |
|
|
|
|
|
|
|
|
|
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); |
|
|
|
|
|
|
|
|
|
json.close(); |
|
|
|
|
|
|
|
|
|
AudioInterrupts(); |
|
|
|
|
|
|
|
|
|
#ifdef DEBUG |
|
|
|
|
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++) { |
|
|
|
|
seq_inst_dexed[i] = data_json["seq_inst_dexed"][i]; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
count = 0; |
|
|
|
|
seq_tempo_ms = data_json["seq_tempo_ms"] ; |
|
|
|
|
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_oct_shift = data_json["seq_oct_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); |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
#ifdef DEBUG |
|
|
|
|
else |
|
|
|
@ -1135,7 +1144,7 @@ bool check_sd_seq_exists(uint8_t number) |
|
|
|
|
return (false); |
|
|
|
|
|
|
|
|
|
number = constrain(number, 0, 99); |
|
|
|
|
|
|
|
|
|
AudioNoInterrupts(); |
|
|
|
|
if (sd_card > 0) |
|
|
|
|
{ |
|
|
|
|
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); |
|
|
|
|
|
|
|
|
|
// check if file exists...
|
|
|
|
|
AudioNoInterrupts(); |
|
|
|
|
|
|
|
|
|
if (SD.exists(filename)) |
|
|
|
|
{ |
|
|
|
|
AudioInterrupts(); |
|
|
|
|
return (true); |
|
|
|
|
} else return (false); |
|
|
|
|
} else |
|
|
|
|
return (false); |
|
|
|
|
{ |
|
|
|
|
AudioInterrupts(); |
|
|
|
|
return (false); |
|
|
|
|
} |
|
|
|
|
} else |
|
|
|
|
{ AudioInterrupts(); |
|
|
|
|
return (false); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/******************************************************************************
|
|
|
|
@ -1166,6 +1181,7 @@ bool load_sd_performance_json(int8_t p) |
|
|
|
|
if (sd_card > 0) |
|
|
|
|
{ |
|
|
|
|
File json; |
|
|
|
|
StaticJsonDocument<JSON_BUFFER_SIZE> data_json; |
|
|
|
|
char filename[FILENAME_LEN]; |
|
|
|
|
|
|
|
|
|
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]; |
|
|
|
|
|
|
|
|
|
p = constrain(p, 0, MAX_PERFORMANCE); |
|
|
|
|
sprintf(filename, "/%s/%s%d.json", PERFORMANCE_CONFIG_PATH, PERFORMANCE_CONFIG_NAME, p); |
|
|
|
|
|
|
|
|
|
if (sd_card > 0) |
|
|
|
|
{ |
|
|
|
|
File json; |
|
|
|
|
|
|
|
|
|
StaticJsonDocument<JSON_BUFFER_SIZE> data_json; |
|
|
|
|
#ifdef DEBUG |
|
|
|
|
Serial.print(F("Saving performance config as JSON")); |
|
|
|
|
Serial.print(p); |
|
|
|
@ -1262,7 +1279,8 @@ bool save_sd_performance_json(uint8_t p) |
|
|
|
|
Serial.print(configuration.performance.fx_number); |
|
|
|
|
Serial.println(F(" does not exists, creating one.")); |
|
|
|
|
#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++) |
|
|
|
|
{ |
|
|
|
|