|
|
|
@ -83,7 +83,7 @@ bool load_sd_voice(uint8_t b, uint8_t v, uint8_t instance_id) |
|
|
|
|
uint8_t data[128]; |
|
|
|
|
|
|
|
|
|
get_bank_name(b, bank_name, sizeof(bank_name)); |
|
|
|
|
sprintf(filename, "/%d/%s.syx", b, bank_name); |
|
|
|
|
snprintf_P(filename, strlen(filename), PSTR("/%d/%s.syx"), b, bank_name); |
|
|
|
|
|
|
|
|
|
AudioNoInterrupts(); |
|
|
|
|
sysex = SD.open(filename); |
|
|
|
@ -154,7 +154,7 @@ bool save_sd_voice(uint8_t b, uint8_t v, uint8_t instance_id) |
|
|
|
|
uint8_t data[128]; |
|
|
|
|
|
|
|
|
|
get_bank_name(b, bank_name, sizeof(bank_name)); |
|
|
|
|
sprintf(filename, "/%d/%s.syx", b, bank_name); |
|
|
|
|
snprintf_P(filename, strlen(filename), PSTR("/%d/%s.syx"), b, bank_name); |
|
|
|
|
|
|
|
|
|
AudioNoInterrupts(); |
|
|
|
|
sysex = SD.open(filename, FILE_WRITE); |
|
|
|
@ -369,7 +369,7 @@ bool save_sd_bank(const char* bank_filename, uint8_t* data) |
|
|
|
|
|
|
|
|
|
// first remove old bank
|
|
|
|
|
sscanf(bank_filename, "/%d/%s", &bank_number, tmp); |
|
|
|
|
sprintf(tmp, "/%d", bank_number); |
|
|
|
|
snprintf_P(tmp, strlen(tmp), PSTR("/%d"), bank_number); |
|
|
|
|
AudioNoInterrupts(); |
|
|
|
|
root = SD.open(tmp); |
|
|
|
|
while (42 == 42) |
|
|
|
@ -385,7 +385,7 @@ bool save_sd_bank(const char* bank_filename, uint8_t* data) |
|
|
|
|
Serial.print(F("/")); |
|
|
|
|
Serial.println(entry.name()); |
|
|
|
|
#endif |
|
|
|
|
sprintf(tmp2, "%s/%s", tmp, entry.name()); |
|
|
|
|
snprintf_P(tmp2, strlen(tmp2), PSTR("%s/%s"), tmp, entry.name()); |
|
|
|
|
entry.close(); |
|
|
|
|
#ifndef DEBUG |
|
|
|
|
SD.remove(tmp2); |
|
|
|
@ -444,7 +444,7 @@ bool load_sd_drumsettings_json(uint8_t number) |
|
|
|
|
StaticJsonDocument<JSON_BUFFER_SIZE> data_json; |
|
|
|
|
char filename[CONFIG_FILENAME_LEN]; |
|
|
|
|
|
|
|
|
|
sprintf(filename, "/%s/%d/%s.json", PERFORMANCE_CONFIG_PATH, number, DRUMS_CONFIG_NAME); |
|
|
|
|
snprintf_P(filename, strlen(filename), PSTR("/%s/%d/%s.json"), PERFORMANCE_CONFIG_PATH, number, DRUMS_CONFIG_NAME); |
|
|
|
|
|
|
|
|
|
// first check if file exists...
|
|
|
|
|
AudioNoInterrupts(); |
|
|
|
@ -518,7 +518,7 @@ bool save_sd_drumsettings_json(uint8_t number) |
|
|
|
|
|
|
|
|
|
if (check_performance_directory(number)) |
|
|
|
|
{ |
|
|
|
|
sprintf(filename, "/%s/%d/%s.json", PERFORMANCE_CONFIG_PATH, number, DRUMS_CONFIG_NAME); |
|
|
|
|
snprintf_P(filename, strlen(filename), PSTR("/%s/%d/%s.json"), PERFORMANCE_CONFIG_PATH, number, DRUMS_CONFIG_NAME); |
|
|
|
|
|
|
|
|
|
#ifdef DEBUG |
|
|
|
|
Serial.print(F("Saving drums config ")); |
|
|
|
@ -598,7 +598,7 @@ bool load_sd_voiceconfig_json(uint8_t vc, uint8_t instance_id) |
|
|
|
|
File json; |
|
|
|
|
StaticJsonDocument<JSON_BUFFER_SIZE> data_json; |
|
|
|
|
|
|
|
|
|
sprintf(filename, "/%s/%d/%s%d.json", PERFORMANCE_CONFIG_PATH, vc, VOICE_CONFIG_NAME, instance_id + 1); |
|
|
|
|
snprintf_P(filename, strlen(filename), PSTR("/%s/%d/%s%d.json"), PERFORMANCE_CONFIG_PATH, vc, VOICE_CONFIG_NAME, instance_id + 1); |
|
|
|
|
|
|
|
|
|
// first check if file exists...
|
|
|
|
|
AudioNoInterrupts(); |
|
|
|
@ -691,7 +691,7 @@ bool save_sd_voiceconfig_json(uint8_t vc, uint8_t instance_id) |
|
|
|
|
{ |
|
|
|
|
File json; |
|
|
|
|
StaticJsonDocument<JSON_BUFFER_SIZE> data_json; |
|
|
|
|
sprintf(filename, "/%s/%d/%s%d.json", PERFORMANCE_CONFIG_PATH, vc, VOICE_CONFIG_NAME, instance_id + 1); |
|
|
|
|
snprintf_P(filename, strlen(filename), PSTR("/%s/%d/%s%d.json"), PERFORMANCE_CONFIG_PATH, vc, VOICE_CONFIG_NAME, instance_id + 1); |
|
|
|
|
|
|
|
|
|
#ifdef DEBUG |
|
|
|
|
Serial.print(F("Saving voice config ")); |
|
|
|
@ -782,7 +782,7 @@ bool load_sd_fx_json(uint8_t number) |
|
|
|
|
File json; |
|
|
|
|
StaticJsonDocument<JSON_BUFFER_SIZE> data_json; |
|
|
|
|
char filename[CONFIG_FILENAME_LEN]; |
|
|
|
|
sprintf(filename, "/%s/%d/%s.json", PERFORMANCE_CONFIG_PATH, number, FX_CONFIG_NAME); |
|
|
|
|
snprintf_P(filename, strlen(filename), PSTR("/%s/%d/%s.json"), PERFORMANCE_CONFIG_PATH, number, FX_CONFIG_NAME); |
|
|
|
|
|
|
|
|
|
// first check if file exists...
|
|
|
|
|
AudioNoInterrupts(); |
|
|
|
@ -882,7 +882,7 @@ bool save_sd_fx_json(uint8_t number) |
|
|
|
|
{ |
|
|
|
|
File json; |
|
|
|
|
StaticJsonDocument<JSON_BUFFER_SIZE> data_json; |
|
|
|
|
sprintf(filename, "/%s/%d/%s.json", PERFORMANCE_CONFIG_PATH, number, FX_CONFIG_NAME); |
|
|
|
|
snprintf_P(filename, strlen(filename), PSTR("/%s/%d/%s.json"), PERFORMANCE_CONFIG_PATH, number, FX_CONFIG_NAME); |
|
|
|
|
|
|
|
|
|
#ifdef DEBUG |
|
|
|
|
Serial.print(F("Saving fx config ")); |
|
|
|
@ -968,7 +968,7 @@ bool load_sd_epiano_json(uint8_t number) |
|
|
|
|
File json; |
|
|
|
|
StaticJsonDocument<JSON_BUFFER_SIZE> data_json; |
|
|
|
|
char filename[CONFIG_FILENAME_LEN]; |
|
|
|
|
sprintf(filename, "/%s/%d/%s.json", PERFORMANCE_CONFIG_PATH, number, EPIANO_CONFIG_NAME); |
|
|
|
|
snprintf_P(filename, strlen(filename), PSTR("/%s/%d/%s.json"), PERFORMANCE_CONFIG_PATH, number, EPIANO_CONFIG_NAME); |
|
|
|
|
|
|
|
|
|
// first check if file exists...
|
|
|
|
|
AudioNoInterrupts(); |
|
|
|
@ -1048,7 +1048,7 @@ bool save_sd_epiano_json(uint8_t number) |
|
|
|
|
{ |
|
|
|
|
File json; |
|
|
|
|
StaticJsonDocument<JSON_BUFFER_SIZE> data_json; |
|
|
|
|
sprintf(filename, "/%s/%d/%s.json", PERFORMANCE_CONFIG_PATH, number, EPIANO_CONFIG_NAME); |
|
|
|
|
snprintf_P(filename, strlen(filename), PSTR("/%s/%d/%s.json"), PERFORMANCE_CONFIG_PATH, number, EPIANO_CONFIG_NAME); |
|
|
|
|
|
|
|
|
|
#ifdef DEBUG |
|
|
|
|
Serial.print(F("Saving epiano config ")); |
|
|
|
@ -1117,7 +1117,7 @@ bool load_sd_sys_json(void) |
|
|
|
|
File json; |
|
|
|
|
StaticJsonDocument<JSON_BUFFER_SIZE> data_json; |
|
|
|
|
char filename[CONFIG_FILENAME_LEN]; |
|
|
|
|
sprintf(filename, "/%s.json", SYS_CONFIG_NAME); |
|
|
|
|
snprintf_P(filename, strlen(filename), PSTR("/%s.json"), SYS_CONFIG_NAME); |
|
|
|
|
|
|
|
|
|
// first check if file exists...
|
|
|
|
|
AudioNoInterrupts(); |
|
|
|
@ -1182,7 +1182,7 @@ bool save_sd_sys_json(void) |
|
|
|
|
{ |
|
|
|
|
File json; |
|
|
|
|
StaticJsonDocument<JSON_BUFFER_SIZE> data_json; |
|
|
|
|
sprintf(filename, "/%s.json", SYS_CONFIG_NAME); |
|
|
|
|
snprintf_P(filename, strlen(filename), PSTR("/%s.json"), SYS_CONFIG_NAME); |
|
|
|
|
|
|
|
|
|
#ifdef DEBUG |
|
|
|
|
Serial.print(F("Saving sys config to ")); |
|
|
|
@ -1249,7 +1249,7 @@ bool save_sd_performance_json(uint8_t number) |
|
|
|
|
|
|
|
|
|
for (uint8_t i = 0; i < MAX_DEXED; i++) |
|
|
|
|
{ |
|
|
|
|
sprintf(filename, "/%s/%d/%s%d.json", PERFORMANCE_CONFIG_PATH, number, VOICE_CONFIG_NAME, i); |
|
|
|
|
snprintf_P(filename, strlen(filename), PSTR("/%s/%d/%s%d.json"), PERFORMANCE_CONFIG_PATH, number, VOICE_CONFIG_NAME, i); |
|
|
|
|
#ifdef DEBUG |
|
|
|
|
Serial.print(F("Write Voice-Config")); |
|
|
|
|
Serial.println(filename); |
|
|
|
@ -1261,7 +1261,7 @@ bool save_sd_performance_json(uint8_t number) |
|
|
|
|
{ |
|
|
|
|
File json; |
|
|
|
|
StaticJsonDocument<JSON_BUFFER_SIZE> data_json; |
|
|
|
|
sprintf(filename, "/%s/%d/%s.json", PERFORMANCE_CONFIG_PATH, number, PERFORMANCE_CONFIG_NAME); |
|
|
|
|
snprintf_P(filename, strlen(filename), PSTR("/%s/%d/%s.json"), PERFORMANCE_CONFIG_PATH, number, PERFORMANCE_CONFIG_NAME); |
|
|
|
|
#ifdef DEBUG |
|
|
|
|
Serial.print(F("Saving performance config ")); |
|
|
|
|
Serial.print(number); |
|
|
|
@ -1309,7 +1309,7 @@ bool check_performance_directory(uint8_t number) |
|
|
|
|
|
|
|
|
|
if (sd_card > 0) |
|
|
|
|
{ |
|
|
|
|
sprintf(dir, "/%s/%d", PERFORMANCE_CONFIG_PATH, number); |
|
|
|
|
snprintf_P(dir, strlen(dir), PSTR("/%s/%d"), PERFORMANCE_CONFIG_PATH, number); |
|
|
|
|
|
|
|
|
|
AudioNoInterrupts(); |
|
|
|
|
SD.begin(); |
|
|
|
@ -1353,7 +1353,7 @@ void get_sd_performance_name_json(uint8_t number) |
|
|
|
|
StaticJsonDocument<JSON_BUFFER_SIZE> data_json; |
|
|
|
|
char filename[CONFIG_FILENAME_LEN]; |
|
|
|
|
|
|
|
|
|
sprintf(filename, "/%s/%d/%s.json", PERFORMANCE_CONFIG_PATH, number, PERFORMANCE_CONFIG_NAME); |
|
|
|
|
snprintf_P(filename, strlen(filename), PSTR("/%s/%d/%s.json"), PERFORMANCE_CONFIG_PATH, number, PERFORMANCE_CONFIG_NAME); |
|
|
|
|
|
|
|
|
|
// first check if file exists...
|
|
|
|
|
AudioNoInterrupts(); |
|
|
|
@ -1439,7 +1439,7 @@ bool check_sd_performance_exists(uint8_t number) |
|
|
|
|
{ |
|
|
|
|
char filename[CONFIG_FILENAME_LEN]; |
|
|
|
|
|
|
|
|
|
sprintf(filename, "/%s/%d/%s.json", PERFORMANCE_CONFIG_PATH, number, PERFORMANCE_CONFIG_NAME); |
|
|
|
|
snprintf_P(filename, strlen(filename), PSTR("/%s/%d/%s.json"), PERFORMANCE_CONFIG_PATH, number, PERFORMANCE_CONFIG_NAME); |
|
|
|
|
|
|
|
|
|
// check if file exists...
|
|
|
|
|
if (SD.exists(filename)) |
|
|
|
@ -1647,7 +1647,7 @@ bool get_bank_name(uint8_t b, char* name, uint8_t len) |
|
|
|
|
|
|
|
|
|
memset(name, 0, len); |
|
|
|
|
|
|
|
|
|
sprintf(bankdir, "/%d", b); |
|
|
|
|
snprintf_P(bankdir, strlen(bankdir), PSTR("/%d"), b); |
|
|
|
|
|
|
|
|
|
// try to open directory
|
|
|
|
|
sysex = SD.open(bankdir); |
|
|
|
@ -1698,7 +1698,7 @@ bool get_voice_name(uint8_t b, uint8_t v, char* name, uint8_t len) |
|
|
|
|
v = constrain(v, 0, MAX_VOICES - 1); |
|
|
|
|
|
|
|
|
|
get_bank_name(b, bank_name, sizeof(bank_name)); |
|
|
|
|
sprintf(filename, "/%d/%s.syx", b, bank_name); |
|
|
|
|
snprintf_P(filename, strlen(filename), PSTR("/%d/%s.syx"), b, bank_name); |
|
|
|
|
#ifdef DEBUG |
|
|
|
|
Serial.print(F("Reading voice-name from [")); |
|
|
|
|
Serial.print(filename); |
|
|
|
@ -1742,7 +1742,7 @@ bool get_voice_by_bank_name(uint8_t b, const char* bank_name, uint8_t v, char* v |
|
|
|
|
{ |
|
|
|
|
char filename[FILENAME_LEN]; |
|
|
|
|
|
|
|
|
|
sprintf(filename, "/%d/%s.syx", b, bank_name); |
|
|
|
|
snprintf_P(filename, strlen(filename), PSTR("/%d/%s.syx"), b, bank_name); |
|
|
|
|
#ifdef DEBUG |
|
|
|
|
Serial.print(F("Reading voice-name from [")); |
|
|
|
|
Serial.print(filename); |
|
|
|
|