|
|
@ -81,6 +81,7 @@ extern void handleStop(void); |
|
|
|
extern void handleStart(void); |
|
|
|
extern void handleStart(void); |
|
|
|
extern void dac_mute(void); |
|
|
|
extern void dac_mute(void); |
|
|
|
extern void dac_unmute(void); |
|
|
|
extern void dac_unmute(void); |
|
|
|
|
|
|
|
extern void check_configuration_sys(void); |
|
|
|
extern uint8_t get_sample_note(uint8_t sample); |
|
|
|
extern uint8_t get_sample_note(uint8_t sample); |
|
|
|
extern float get_sample_pitch(uint8_t sample); |
|
|
|
extern float get_sample_pitch(uint8_t sample); |
|
|
|
extern float get_sample_p_offset(uint8_t sample); |
|
|
|
extern float get_sample_p_offset(uint8_t sample); |
|
|
@ -944,6 +945,129 @@ bool save_sd_fx_json(uint8_t fx) |
|
|
|
return (false); |
|
|
|
return (false); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/******************************************************************************
|
|
|
|
|
|
|
|
SD SYS |
|
|
|
|
|
|
|
******************************************************************************/ |
|
|
|
|
|
|
|
bool load_sd_sys_json(void) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
if (sd_card > 0) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
File json; |
|
|
|
|
|
|
|
StaticJsonDocument<JSON_BUFFER_SIZE> data_json; |
|
|
|
|
|
|
|
char filename[CONFIG_FILENAME_LEN]; |
|
|
|
|
|
|
|
sprintf(filename, "/%s.json", SYS_CONFIG_NAME); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// first check if file exists...
|
|
|
|
|
|
|
|
AudioNoInterrupts(); |
|
|
|
|
|
|
|
if (SD.exists(filename)) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
// ... and if: load
|
|
|
|
|
|
|
|
#ifdef DEBUG |
|
|
|
|
|
|
|
Serial.print(F("Found sys configuration")); |
|
|
|
|
|
|
|
#endif |
|
|
|
|
|
|
|
json = SD.open(filename); |
|
|
|
|
|
|
|
if (json) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
deserializeJson(data_json, json); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
json.close(); |
|
|
|
|
|
|
|
AudioInterrupts(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#ifdef DEBUG |
|
|
|
|
|
|
|
Serial.println(F("Read JSON data:")); |
|
|
|
|
|
|
|
serializeJsonPretty(data_json, Serial); |
|
|
|
|
|
|
|
Serial.println(); |
|
|
|
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
configuration.sys.instances = data_json["instances"]; |
|
|
|
|
|
|
|
configuration.sys.vol = data_json["vol"]; |
|
|
|
|
|
|
|
configuration.sys.mono = data_json["mono"]; |
|
|
|
|
|
|
|
configuration.sys.soft_midi_thru = data_json["soft_midi_thru"]; |
|
|
|
|
|
|
|
configuration.sys.performance_number = data_json["performance_number"]; |
|
|
|
|
|
|
|
configuration.sys.favorites = data_json["favorites"]; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
check_configuration_sys(); |
|
|
|
|
|
|
|
//set_sys_params(); //TODO
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return (true); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
#ifdef DEBUG |
|
|
|
|
|
|
|
else |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
Serial.print(F("E : Cannot open ")); |
|
|
|
|
|
|
|
Serial.print(filename); |
|
|
|
|
|
|
|
Serial.println(F(" on SD.")); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
else |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
Serial.print(F("No ")); |
|
|
|
|
|
|
|
Serial.print(filename); |
|
|
|
|
|
|
|
Serial.println(F(" available.")); |
|
|
|
|
|
|
|
#endif |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
AudioInterrupts(); |
|
|
|
|
|
|
|
return (false); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
bool save_sd_sys_json(void) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
char filename[CONFIG_FILENAME_LEN]; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (sd_card > 0) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
File json; |
|
|
|
|
|
|
|
StaticJsonDocument<JSON_BUFFER_SIZE> data_json; |
|
|
|
|
|
|
|
sprintf(filename, "/%s.json", SYS_CONFIG_NAME); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#ifdef DEBUG |
|
|
|
|
|
|
|
Serial.print(F("Saving sys config to ")); |
|
|
|
|
|
|
|
Serial.println(filename); |
|
|
|
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
AudioNoInterrupts(); |
|
|
|
|
|
|
|
SD.begin(); |
|
|
|
|
|
|
|
SD.remove(filename); |
|
|
|
|
|
|
|
json = SD.open(filename, FILE_WRITE); |
|
|
|
|
|
|
|
if (json) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
data_json["instances"] = configuration.sys.instances; |
|
|
|
|
|
|
|
data_json["vol"] = configuration.sys.vol; |
|
|
|
|
|
|
|
data_json["mono"] = configuration.sys.mono; |
|
|
|
|
|
|
|
data_json["soft_midi_thru"] = configuration.sys.soft_midi_thru; |
|
|
|
|
|
|
|
data_json["performance_number"] = configuration.sys.performance_number; |
|
|
|
|
|
|
|
data_json["favorites"] = configuration.sys.favorites; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#ifdef DEBUG |
|
|
|
|
|
|
|
Serial.println(F("Write JSON data:")); |
|
|
|
|
|
|
|
serializeJsonPretty(data_json, Serial); |
|
|
|
|
|
|
|
Serial.println(); |
|
|
|
|
|
|
|
#endif |
|
|
|
|
|
|
|
serializeJsonPretty(data_json, json); |
|
|
|
|
|
|
|
json.close(); |
|
|
|
|
|
|
|
AudioInterrupts(); |
|
|
|
|
|
|
|
return (true); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
json.close(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
else |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
#ifdef DEBUG |
|
|
|
|
|
|
|
Serial.print(F("E : Cannot open ")); |
|
|
|
|
|
|
|
Serial.print(filename); |
|
|
|
|
|
|
|
Serial.println(F(" on SD.")); |
|
|
|
|
|
|
|
#endif |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
AudioInterrupts(); |
|
|
|
|
|
|
|
return (false); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/******************************************************************************
|
|
|
|
|
|
|
|
SD SEQUENCER |
|
|
|
|
|
|
|
******************************************************************************/ |
|
|
|
bool save_sd_seq_sub_vel_json(uint8_t seq_number) |
|
|
|
bool save_sd_seq_sub_vel_json(uint8_t seq_number) |
|
|
|
{ |
|
|
|
{ |
|
|
|
char filename[CONFIG_FILENAME_LEN]; |
|
|
|
char filename[CONFIG_FILENAME_LEN]; |
|
|
@ -1383,6 +1507,7 @@ bool load_sd_performance_json(uint8_t seq_number) |
|
|
|
Serial.print(filename); |
|
|
|
Serial.print(filename); |
|
|
|
Serial.println(F("]... loading...")); |
|
|
|
Serial.println(F("]... loading...")); |
|
|
|
#endif |
|
|
|
#endif |
|
|
|
|
|
|
|
AudioNoInterrupts(); |
|
|
|
json = SD.open(filename); |
|
|
|
json = SD.open(filename); |
|
|
|
if (json) |
|
|
|
if (json) |
|
|
|
{ |
|
|
|
{ |
|
|
@ -1474,6 +1599,7 @@ bool load_sd_performance_json(uint8_t seq_number) |
|
|
|
#ifdef DEBUG |
|
|
|
#ifdef DEBUG |
|
|
|
else |
|
|
|
else |
|
|
|
{ |
|
|
|
{ |
|
|
|
|
|
|
|
AudioInterrupts(); |
|
|
|
Serial.print(F("E : Cannot open ")); |
|
|
|
Serial.print(F("E : Cannot open ")); |
|
|
|
Serial.print(filename); |
|
|
|
Serial.print(filename); |
|
|
|
Serial.println(F(" on SD.")); |
|
|
|
Serial.println(F(" on SD.")); |
|
|
|