|
|
@ -301,7 +301,7 @@ bool get_sd_voice(File sysex, uint8_t voice_number, uint8_t* data) |
|
|
|
return (false); |
|
|
|
return (false); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
MicroDexed[0]->resetRenderTimeMax(); |
|
|
|
// MicroDexed[0]->resetRenderTimeMax(); // necessary?
|
|
|
|
|
|
|
|
|
|
|
|
return (true); |
|
|
|
return (true); |
|
|
|
} |
|
|
|
} |
|
|
@ -454,7 +454,7 @@ bool save_sd_bank(const char* bank_filename, uint8_t* data) |
|
|
|
SD DRUMSETTINGS |
|
|
|
SD DRUMSETTINGS |
|
|
|
******************************************************************************/ |
|
|
|
******************************************************************************/ |
|
|
|
|
|
|
|
|
|
|
|
bool load_sd_drumsettings_json(uint8_t number, uint8_t target) |
|
|
|
bool load_sd_drumsettings_json(uint8_t number) |
|
|
|
{ |
|
|
|
{ |
|
|
|
if (number < 0) |
|
|
|
if (number < 0) |
|
|
|
return (false); |
|
|
|
return (false); |
|
|
@ -465,11 +465,9 @@ bool load_sd_drumsettings_json(uint8_t number, uint8_t target) |
|
|
|
{ |
|
|
|
{ |
|
|
|
File json; |
|
|
|
File json; |
|
|
|
StaticJsonDocument<JSON_BUFFER_SIZE> data_json; |
|
|
|
StaticJsonDocument<JSON_BUFFER_SIZE> data_json; |
|
|
|
char filename[FILENAME_LEN]; |
|
|
|
char filename[CONFIG_FILENAME_LEN]; |
|
|
|
if (target == 0) |
|
|
|
|
|
|
|
sprintf(filename, "/%s/%d/%s%d.json", DRUM_CONFIG_PATH, number, DRUM_CONFIG_NAME, number); |
|
|
|
sprintf(filename, "/%s/%d/%s.json", PERFORMANCE_CONFIG_PATH, number, DRUMS_CONFIG_NAME); |
|
|
|
else |
|
|
|
|
|
|
|
sprintf(filename, "/%s/%d/%d-d.json", SEQ_CONFIG_PATH, number, number); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// first check if file exists...
|
|
|
|
// first check if file exists...
|
|
|
|
AudioNoInterrupts(); |
|
|
|
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_max( drumnumber, data_json["vol_max"][i]) ; |
|
|
|
set_sample_vol_min( drumnumber, data_json["vol_min"][i] ); |
|
|
|
set_sample_vol_min( drumnumber, data_json["vol_min"][i] ); |
|
|
|
set_sample_reverb_send( drumnumber, data_json["reverb_send"][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); |
|
|
|
return (true); |
|
|
@ -537,18 +528,18 @@ bool load_sd_drumsettings_json(uint8_t number, uint8_t target) |
|
|
|
return (false); |
|
|
|
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); |
|
|
|
number = constrain(number, 0, 99); |
|
|
|
|
|
|
|
|
|
|
|
if (sd_card > 0) |
|
|
|
if (sd_card > 0) |
|
|
|
{ |
|
|
|
{ |
|
|
|
File json; |
|
|
|
File json; |
|
|
|
StaticJsonDocument<JSON_BUFFER_SIZE> data_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); |
|
|
|
sprintf(filename, "/%s/%d/%s.json", PERFORMANCE_CONFIG_PATH, number, DRUMS_CONFIG_NAME); |
|
|
|
else |
|
|
|
|
|
|
|
sprintf(filename, "/%s/%d/%d-d.json", SEQ_CONFIG_PATH, number, number); |
|
|
|
|
|
|
|
#ifdef DEBUG |
|
|
|
#ifdef DEBUG |
|
|
|
Serial.print(F("Saving drums config ")); |
|
|
|
Serial.print(F("Saving drums config ")); |
|
|
|
Serial.print(number); |
|
|
|
Serial.print(number); |
|
|
@ -602,9 +593,9 @@ bool save_sd_drumsettings_json(uint8_t number, uint8_t target) |
|
|
|
/******************************************************************************
|
|
|
|
/******************************************************************************
|
|
|
|
SD VOICECONFIG |
|
|
|
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); |
|
|
|
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; |
|
|
|
File json; |
|
|
|
StaticJsonDocument<JSON_BUFFER_SIZE> data_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); |
|
|
|
sprintf(filename, "/%s/%d/%s%d.json", PERFORMANCE_CONFIG_PATH, vc, VOICE_CONFIG_NAME, instance_id); |
|
|
|
else |
|
|
|
|
|
|
|
sprintf(filename, "/%s/%d/%d-v%d.json", SEQ_CONFIG_PATH, vc, vc, instance_id); |
|
|
|
|
|
|
|
// first check if file exists...
|
|
|
|
// first check if file exists...
|
|
|
|
AudioNoInterrupts(); |
|
|
|
AudioNoInterrupts(); |
|
|
|
if (SD.exists(filename)) |
|
|
|
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); |
|
|
|
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); |
|
|
|
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; |
|
|
|
File json; |
|
|
|
StaticJsonDocument<JSON_BUFFER_SIZE> data_json; |
|
|
|
StaticJsonDocument<JSON_BUFFER_SIZE> data_json; |
|
|
|
if (target == 0) |
|
|
|
sprintf(filename, "/%s/%d/%s%d.json", PERFORMANCE_CONFIG_PATH, vc, VOICE_CONFIG_NAME, instance_id); |
|
|
|
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); |
|
|
|
|
|
|
|
#ifdef DEBUG |
|
|
|
#ifdef DEBUG |
|
|
|
Serial.print(F("Saving voice config ")); |
|
|
|
Serial.print(F("Saving voice config ")); |
|
|
|
Serial.print(vc); |
|
|
|
Serial.print(vc); |
|
|
@ -786,22 +774,19 @@ bool save_sd_voiceconfig_json(uint8_t vc, uint8_t instance_id, uint8_t target) |
|
|
|
/******************************************************************************
|
|
|
|
/******************************************************************************
|
|
|
|
SD FX |
|
|
|
SD FX |
|
|
|
******************************************************************************/ |
|
|
|
******************************************************************************/ |
|
|
|
bool load_sd_fx_json(uint8_t fx, uint8_t target) |
|
|
|
bool load_sd_fx_json(uint8_t fx) |
|
|
|
{ |
|
|
|
{ |
|
|
|
if (fx < 0) |
|
|
|
fx = constrain(fx, FX_NUM_MIN, FX_NUM_MAX); |
|
|
|
return (false); |
|
|
|
|
|
|
|
load_sd_drumsettings_json(fx, target); |
|
|
|
load_sd_drumsettings_json(fx); |
|
|
|
fx = constrain(fx, 0, MAX_FX); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (sd_card > 0) |
|
|
|
if (sd_card > 0) |
|
|
|
{ |
|
|
|
{ |
|
|
|
File json; |
|
|
|
File json; |
|
|
|
StaticJsonDocument<JSON_BUFFER_SIZE> data_json; |
|
|
|
StaticJsonDocument<JSON_BUFFER_SIZE> data_json; |
|
|
|
char filename[FILENAME_LEN]; |
|
|
|
char filename[CONFIG_FILENAME_LEN]; |
|
|
|
if (target == 0) |
|
|
|
sprintf(filename, "/%s/%d/%s.json", PERFORMANCE_CONFIG_PATH, fx, FX_CONFIG_NAME); |
|
|
|
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); |
|
|
|
|
|
|
|
// first check if file exists...
|
|
|
|
// first check if file exists...
|
|
|
|
AudioNoInterrupts(); |
|
|
|
AudioNoInterrupts(); |
|
|
|
if (SD.exists(filename)) |
|
|
|
if (SD.exists(filename)) |
|
|
@ -885,20 +870,19 @@ bool load_sd_fx_json(uint8_t fx, uint8_t target) |
|
|
|
return (false); |
|
|
|
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); |
|
|
|
save_sd_drumsettings_json(fx, target); |
|
|
|
|
|
|
|
if (sd_card > 0) |
|
|
|
if (sd_card > 0) |
|
|
|
{ |
|
|
|
{ |
|
|
|
File json; |
|
|
|
File json; |
|
|
|
StaticJsonDocument<JSON_BUFFER_SIZE> data_json; |
|
|
|
StaticJsonDocument<JSON_BUFFER_SIZE> data_json; |
|
|
|
if (target == 0) |
|
|
|
sprintf(filename, "/%s/%d/%s.json", PERFORMANCE_CONFIG_PATH, fx, FX_CONFIG_NAME); |
|
|
|
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); |
|
|
|
|
|
|
|
#ifdef DEBUG |
|
|
|
#ifdef DEBUG |
|
|
|
Serial.print(F("Saving fx config ")); |
|
|
|
Serial.print(F("Saving fx config ")); |
|
|
|
Serial.print(fx); |
|
|
|
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) |
|
|
|
bool save_sd_seq_sub_vel_json(uint8_t seq_number) |
|
|
|
{ |
|
|
|
{ |
|
|
|
char filename[FILENAME_LEN]; |
|
|
|
char filename[CONFIG_FILENAME_LEN]; |
|
|
|
int count = 0; |
|
|
|
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) |
|
|
|
if (sd_card > 0) |
|
|
|
{ |
|
|
|
{ |
|
|
|
File json; |
|
|
|
File json; |
|
|
|
StaticJsonDocument<JSON_BUFFER_SIZE> data_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 |
|
|
|
#ifdef DEBUG |
|
|
|
Serial.print(F("Saving sequencer velocity ")); |
|
|
|
Serial.print(F("Saving sequencer velocity ")); |
|
|
|
Serial.print(seq_number); |
|
|
|
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) |
|
|
|
bool save_sd_seq_sub_patterns_json(uint8_t seq_number) |
|
|
|
{ |
|
|
|
{ |
|
|
|
char filename[FILENAME_LEN]; |
|
|
|
char filename[CONFIG_FILENAME_LEN]; |
|
|
|
int count = 0; |
|
|
|
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) |
|
|
|
if (sd_card > 0) |
|
|
|
{ |
|
|
|
{ |
|
|
|
File json; |
|
|
|
File json; |
|
|
|
StaticJsonDocument<JSON_BUFFER_SIZE> data_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 |
|
|
|
#ifdef DEBUG |
|
|
|
Serial.print(F("Saving sequencer patterns ")); |
|
|
|
Serial.print(F("Saving sequencer patterns ")); |
|
|
|
Serial.print(seq_number); |
|
|
|
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) |
|
|
|
bool save_sd_seq_json(uint8_t seq_number) |
|
|
|
{ |
|
|
|
{ |
|
|
|
char filename[FILENAME_LEN]; |
|
|
|
char filename[CONFIG_FILENAME_LEN]; |
|
|
|
int count = 0; |
|
|
|
int count = 0; |
|
|
|
bool seq_was_running = false; |
|
|
|
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 ) { |
|
|
|
if (seq_running == true ) { |
|
|
|
seq_was_running = true; |
|
|
|
seq_was_running = true; |
|
|
|
handleStop(); |
|
|
|
handleStop(); |
|
|
@ -1089,29 +1076,29 @@ bool save_sd_seq_json(uint8_t seq_number) |
|
|
|
AudioNoInterrupts(); |
|
|
|
AudioNoInterrupts(); |
|
|
|
save_sd_seq_sub_vel_json(seq_number); |
|
|
|
save_sd_seq_sub_vel_json(seq_number); |
|
|
|
save_sd_seq_sub_patterns_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 |
|
|
|
#ifdef DEBUG |
|
|
|
Serial.print(F("write SEQ-FX-Config ")); |
|
|
|
Serial.print(F("Write performance config ")); |
|
|
|
Serial.print(seq_number); |
|
|
|
Serial.print(seq_number); |
|
|
|
Serial.print(F(" ")); |
|
|
|
Serial.print(F(" ")); |
|
|
|
#endif |
|
|
|
#endif |
|
|
|
save_sd_fx_json(seq_number, 1); |
|
|
|
save_sd_fx_json(seq_number); |
|
|
|
for (uint8_t i = 0; i < MAX_DEXED; i++) |
|
|
|
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 |
|
|
|
#ifdef DEBUG |
|
|
|
Serial.print(F("Write Voice-Config for sequencer")); |
|
|
|
Serial.print(F("Write Voice-Config for sequencer")); |
|
|
|
Serial.print(filename); |
|
|
|
Serial.print(filename); |
|
|
|
Serial.print(F(" ")); |
|
|
|
Serial.print(F(" ")); |
|
|
|
#endif |
|
|
|
#endif |
|
|
|
save_sd_voiceconfig_json(seq_number, i, 1); |
|
|
|
save_sd_voiceconfig_json(seq_number, i); |
|
|
|
} |
|
|
|
} |
|
|
|
if (sd_card > 0) |
|
|
|
if (sd_card > 0) |
|
|
|
{ |
|
|
|
{ |
|
|
|
File json; |
|
|
|
File json; |
|
|
|
StaticJsonDocument<JSON_BUFFER_SIZE> data_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 |
|
|
|
#ifdef DEBUG |
|
|
|
Serial.print(F("Saving sequencer config ")); |
|
|
|
Serial.print(F("Saving performance config ")); |
|
|
|
Serial.print(seq_number); |
|
|
|
Serial.print(seq_number); |
|
|
|
Serial.print(F(" to ")); |
|
|
|
Serial.print(F(" to ")); |
|
|
|
Serial.println(filename); |
|
|
|
Serial.println(filename); |
|
|
@ -1203,9 +1190,9 @@ void get_sd_seq_name_json(uint8_t seq_number) |
|
|
|
{ |
|
|
|
{ |
|
|
|
File json; |
|
|
|
File json; |
|
|
|
StaticJsonDocument<JSON_BUFFER_SIZE> data_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...
|
|
|
|
// first check if file exists...
|
|
|
|
AudioNoInterrupts(); |
|
|
|
AudioNoInterrupts(); |
|
|
@ -1240,9 +1227,9 @@ bool load_sd_seq_sub_vel_json(uint8_t seq_number) |
|
|
|
{ |
|
|
|
{ |
|
|
|
File json; |
|
|
|
File json; |
|
|
|
StaticJsonDocument<JSON_BUFFER_SIZE> data_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...
|
|
|
|
// first check if file exists...
|
|
|
|
AudioNoInterrupts(); |
|
|
|
AudioNoInterrupts(); |
|
|
@ -1308,9 +1295,9 @@ bool load_sd_seq_sub_patterns_json(uint8_t seq_number) |
|
|
|
{ |
|
|
|
{ |
|
|
|
File json; |
|
|
|
File json; |
|
|
|
StaticJsonDocument<JSON_BUFFER_SIZE> data_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...
|
|
|
|
// first check if file exists...
|
|
|
|
AudioNoInterrupts(); |
|
|
|
AudioNoInterrupts(); |
|
|
@ -1385,14 +1372,14 @@ bool load_sd_seq_json(uint8_t seq_number) |
|
|
|
AudioNoInterrupts(); |
|
|
|
AudioNoInterrupts(); |
|
|
|
load_sd_seq_sub_patterns_json(seq_number); |
|
|
|
load_sd_seq_sub_patterns_json(seq_number); |
|
|
|
load_sd_seq_sub_vel_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) |
|
|
|
if (sd_card > 0) |
|
|
|
{ |
|
|
|
{ |
|
|
|
File json; |
|
|
|
File json; |
|
|
|
StaticJsonDocument<JSON_BUFFER_SIZE> data_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...
|
|
|
|
// first check if file exists...
|
|
|
|
if (SD.exists(filename)) |
|
|
|
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.bank[instance_id] = data_json["bank"][instance_id]; |
|
|
|
configuration.performance.voice[instance_id] = data_json["voice"][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_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]->setGain(midi_volume_transform(map(configuration.dexed[instance_id].sound_intensity, SOUND_INTENSITY_MIN, SOUND_INTENSITY_MAX, 0, 127))); |
|
|
|
MicroDexed[instance_id]->panic(); |
|
|
|
MicroDexed[instance_id]->panic(); |
|
|
|
#ifdef DEBUG |
|
|
|
#ifdef DEBUG |
|
|
@ -1509,7 +1496,7 @@ bool load_sd_seq_json(uint8_t seq_number) |
|
|
|
return (false); |
|
|
|
return (false); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
bool check_sd_seq_exists(uint8_t number) |
|
|
|
bool check_sd_performance_exists(uint8_t number) |
|
|
|
{ |
|
|
|
{ |
|
|
|
if (number < 0) |
|
|
|
if (number < 0) |
|
|
|
return (false); |
|
|
|
return (false); |
|
|
@ -1518,9 +1505,9 @@ bool check_sd_seq_exists(uint8_t number) |
|
|
|
AudioNoInterrupts(); |
|
|
|
AudioNoInterrupts(); |
|
|
|
if (sd_card > 0) |
|
|
|
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...
|
|
|
|
// check if file exists...
|
|
|
|
if (SD.exists(filename)) |
|
|
|
if (SD.exists(filename)) |
|
|
@ -1543,6 +1530,7 @@ bool check_sd_seq_exists(uint8_t number) |
|
|
|
/******************************************************************************
|
|
|
|
/******************************************************************************
|
|
|
|
SD PERFORMANCE |
|
|
|
SD PERFORMANCE |
|
|
|
******************************************************************************/ |
|
|
|
******************************************************************************/ |
|
|
|
|
|
|
|
/*
|
|
|
|
bool load_sd_performance_json(uint8_t p) |
|
|
|
bool load_sd_performance_json(uint8_t p) |
|
|
|
{ |
|
|
|
{ |
|
|
|
if (p < 0) |
|
|
|
if (p < 0) |
|
|
@ -1553,8 +1541,8 @@ bool load_sd_performance_json(uint8_t p) |
|
|
|
{ |
|
|
|
{ |
|
|
|
File json; |
|
|
|
File json; |
|
|
|
StaticJsonDocument<JSON_BUFFER_SIZE> data_json; |
|
|
|
StaticJsonDocument<JSON_BUFFER_SIZE> data_json; |
|
|
|
char filename[FILENAME_LEN]; |
|
|
|
char filename[CONFIG_FILENAME_LEN]; |
|
|
|
sprintf(filename, "/%s/%d/%s%d.json", PERFORMANCE_CONFIG_PATH, p, PERFORMANCE_CONFIG_NAME, p); |
|
|
|
sprintf(filename, "/%s/%d/%s.json", PERFORMANCE_CONFIG_PATH, p, PERFORMANCE_CONFIG_NAME); |
|
|
|
// first check if file exists...
|
|
|
|
// first check if file exists...
|
|
|
|
AudioNoInterrupts(); |
|
|
|
AudioNoInterrupts(); |
|
|
|
if (SD.exists(filename)) |
|
|
|
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++) |
|
|
|
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_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]->ControllersRefresh(); |
|
|
|
MicroDexed[instance_id]->panic(); |
|
|
|
MicroDexed[instance_id]->panic(); |
|
|
|
} |
|
|
|
} |
|
|
@ -1621,9 +1609,9 @@ bool load_sd_performance_json(uint8_t p) |
|
|
|
|
|
|
|
|
|
|
|
bool save_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); |
|
|
|
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) |
|
|
|
if (sd_card > 0) |
|
|
|
{ |
|
|
|
{ |
|
|
|
File json; |
|
|
|
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); |
|
|
|
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); |
|
|
|
json = SD.open(filename, FILE_WRITE); |
|
|
|
if (json) |
|
|
|
if (json) |
|
|
|
{ |
|
|
|
{ |
|
|
@ -1696,6 +1684,7 @@ bool save_sd_performance_json(uint8_t p) |
|
|
|
AudioInterrupts(); |
|
|
|
AudioInterrupts(); |
|
|
|
return (false); |
|
|
|
return (false); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
|
|
|
|
/******************************************************************************
|
|
|
|
/******************************************************************************
|
|
|
|
HELPER FUNCTIONS |
|
|
|
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) |
|
|
|
void strip_extension(const char* s, char* target, uint8_t len) |
|
|
|
{ |
|
|
|
{ |
|
|
|
char tmp[FILENAME_LEN]; |
|
|
|
char tmp[CONFIG_FILENAME_LEN]; |
|
|
|
char* token; |
|
|
|
char* token; |
|
|
|
|
|
|
|
|
|
|
|
strcpy(tmp, s); |
|
|
|
strcpy(tmp, s); |
|
|
|