|
|
|
@ -43,6 +43,7 @@ extern void init_MIDI_send_CC(void); |
|
|
|
|
extern void check_configuration_dexed(uint8_t instance_id); |
|
|
|
|
extern void check_configuration_performance(void); |
|
|
|
|
extern void check_configuration_fx(void); |
|
|
|
|
extern void check_configuration_epiano(void); |
|
|
|
|
extern void sequencer(); |
|
|
|
|
extern sequencer_t seq; |
|
|
|
|
#ifdef USE_SEQUENCER |
|
|
|
@ -771,18 +772,18 @@ bool save_sd_voiceconfig_json(uint8_t vc, uint8_t instance_id) |
|
|
|
|
/******************************************************************************
|
|
|
|
|
SD FX |
|
|
|
|
******************************************************************************/ |
|
|
|
|
bool load_sd_fx_json(uint8_t fx) |
|
|
|
|
bool load_sd_fx_json(uint8_t number) |
|
|
|
|
{ |
|
|
|
|
fx = constrain(fx, FX_CONFIG_MIN, FX_CONFIG_MAX); |
|
|
|
|
number = constrain(number, PERFORMANCE_NUM_MIN, PERFORMANCE_NUM_MAX); |
|
|
|
|
|
|
|
|
|
load_sd_drumsettings_json(fx); |
|
|
|
|
load_sd_drumsettings_json(number); |
|
|
|
|
|
|
|
|
|
if (sd_card > 0) |
|
|
|
|
{ |
|
|
|
|
File json; |
|
|
|
|
StaticJsonDocument<JSON_BUFFER_SIZE> data_json; |
|
|
|
|
char filename[CONFIG_FILENAME_LEN]; |
|
|
|
|
sprintf(filename, "/%s/%d/%s.json", PERFORMANCE_CONFIG_PATH, fx, FX_CONFIG_NAME); |
|
|
|
|
sprintf(filename, "/%s/%d/%s.json", PERFORMANCE_CONFIG_PATH, number, FX_CONFIG_NAME); |
|
|
|
|
|
|
|
|
|
// first check if file exists...
|
|
|
|
|
AudioNoInterrupts(); |
|
|
|
@ -839,6 +840,11 @@ bool load_sd_fx_json(uint8_t fx) |
|
|
|
|
configuration.fx.eq_5 = data_json["eq_5"]; |
|
|
|
|
configuration.fx.eq_6 = data_json["eq_6"]; |
|
|
|
|
configuration.fx.eq_7 = data_json["eq_7"]; |
|
|
|
|
configuration.fx.ep_chorus_frequency = data_json["ep_chorus_frequency"]; |
|
|
|
|
configuration.fx.ep_chorus_waveform = data_json["ep_chorus_waveform"]; |
|
|
|
|
configuration.fx.ep_chorus_depth = data_json["ep_chorus_dept"]; |
|
|
|
|
configuration.fx.ep_chorus_level = data_json["ep_chorus_level"]; |
|
|
|
|
configuration.fx.ep_reverb_send = data_json["ep_reverb_send"]; |
|
|
|
|
|
|
|
|
|
check_configuration_fx(); |
|
|
|
|
set_fx_params(); |
|
|
|
@ -866,22 +872,22 @@ bool load_sd_fx_json(uint8_t fx) |
|
|
|
|
return (false); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
bool save_sd_fx_json(uint8_t fx) |
|
|
|
|
bool save_sd_fx_json(uint8_t number) |
|
|
|
|
{ |
|
|
|
|
char filename[CONFIG_FILENAME_LEN]; |
|
|
|
|
|
|
|
|
|
fx = constrain(fx, FX_CONFIG_MIN, FX_CONFIG_MAX); |
|
|
|
|
number = constrain(number, PERFORMANCE_NUM_MIN, PERFORMANCE_NUM_MAX); |
|
|
|
|
|
|
|
|
|
save_sd_drumsettings_json(fx); |
|
|
|
|
save_sd_drumsettings_json(number); |
|
|
|
|
if (sd_card > 0) |
|
|
|
|
{ |
|
|
|
|
File json; |
|
|
|
|
StaticJsonDocument<JSON_BUFFER_SIZE> data_json; |
|
|
|
|
sprintf(filename, "/%s/%d/%s.json", PERFORMANCE_CONFIG_PATH, fx, FX_CONFIG_NAME); |
|
|
|
|
sprintf(filename, "/%s/%d/%s.json", PERFORMANCE_CONFIG_PATH, number, FX_CONFIG_NAME); |
|
|
|
|
|
|
|
|
|
#ifdef DEBUG |
|
|
|
|
Serial.print(F("Saving fx config ")); |
|
|
|
|
Serial.print(fx); |
|
|
|
|
Serial.print(number); |
|
|
|
|
Serial.print(F(" to ")); |
|
|
|
|
Serial.println(filename); |
|
|
|
|
#endif |
|
|
|
@ -920,6 +926,163 @@ bool save_sd_fx_json(uint8_t fx) |
|
|
|
|
data_json["eq_5"] = configuration.fx.eq_5; |
|
|
|
|
data_json["eq_6"] = configuration.fx.eq_6; |
|
|
|
|
data_json["eq_7"] = configuration.fx.eq_7; |
|
|
|
|
data_json["ep_chorus_frequency"] = configuration.fx.ep_chorus_frequency; |
|
|
|
|
data_json["ep_chorus_waveform"] = configuration.fx.ep_chorus_waveform; |
|
|
|
|
data_json["ep_chorus_dept"] = configuration.fx.ep_chorus_depth; |
|
|
|
|
data_json["ep_chorus_level"] = configuration.fx.ep_chorus_level; |
|
|
|
|
data_json["ep_reverb_send"] = configuration.fx.ep_reverb_send; |
|
|
|
|
|
|
|
|
|
#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 EPIANO |
|
|
|
|
******************************************************************************/ |
|
|
|
|
bool load_sd_epiano_json(uint8_t number) |
|
|
|
|
{ |
|
|
|
|
number = constrain(number, PERFORMANCE_NUM_MIN, PERFORMANCE_NUM_MAX); |
|
|
|
|
|
|
|
|
|
if (sd_card > 0) |
|
|
|
|
{ |
|
|
|
|
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); |
|
|
|
|
|
|
|
|
|
// first check if file exists...
|
|
|
|
|
AudioNoInterrupts(); |
|
|
|
|
if (SD.exists(filename)) |
|
|
|
|
{ |
|
|
|
|
// ... and if: load
|
|
|
|
|
#ifdef DEBUG |
|
|
|
|
Serial.print(F("Found epiano configuration [")); |
|
|
|
|
Serial.print(filename); |
|
|
|
|
Serial.println(F("]... loading...")); |
|
|
|
|
#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.epiano.decay = data_json["decay"]; |
|
|
|
|
configuration.epiano.release = data_json["release"]; |
|
|
|
|
configuration.epiano.hardness = data_json["hardness"]; |
|
|
|
|
configuration.epiano.treble = data_json["trebl"]; |
|
|
|
|
configuration.epiano.pan_tremolo = data_json["pan_tremolo"]; |
|
|
|
|
configuration.epiano.pan_lfo = data_json["pan_lf"]; |
|
|
|
|
configuration.epiano.velocity_sense = data_json["velocity"]; |
|
|
|
|
configuration.epiano.stereo = data_json["stereo"]; |
|
|
|
|
configuration.epiano.polyphony = data_json["polyphony"]; |
|
|
|
|
configuration.epiano.tune = data_json["tune"]; |
|
|
|
|
configuration.epiano.detune = data_json["detune"]; |
|
|
|
|
configuration.epiano.overdrive = data_json["overdrive"]; |
|
|
|
|
configuration.epiano.lowest_note = data_json["lowest_note"]; |
|
|
|
|
configuration.epiano.highest_note = data_json["highest_note"]; |
|
|
|
|
configuration.epiano.transpose = data_json["transpo"]; |
|
|
|
|
configuration.epiano.sound_intensity = data_json["sound_int"]; |
|
|
|
|
configuration.epiano.pan = data_json["pa"]; |
|
|
|
|
configuration.epiano.midi_channel = data_json["midi_ch"]; |
|
|
|
|
|
|
|
|
|
check_configuration_epiano(); |
|
|
|
|
set_epiano_params(); |
|
|
|
|
|
|
|
|
|
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_epiano_json(uint8_t number) |
|
|
|
|
{ |
|
|
|
|
char filename[CONFIG_FILENAME_LEN]; |
|
|
|
|
|
|
|
|
|
number = constrain(number, PERFORMANCE_NUM_MIN, PERFORMANCE_NUM_MAX); |
|
|
|
|
|
|
|
|
|
if (sd_card > 0) |
|
|
|
|
{ |
|
|
|
|
File json; |
|
|
|
|
StaticJsonDocument<JSON_BUFFER_SIZE> data_json; |
|
|
|
|
sprintf(filename, "/%s/%d/%s.json", PERFORMANCE_CONFIG_PATH, number, EPIANO_CONFIG_NAME); |
|
|
|
|
|
|
|
|
|
#ifdef DEBUG |
|
|
|
|
Serial.print(F("Saving epiano config ")); |
|
|
|
|
Serial.print(number); |
|
|
|
|
Serial.print(F(" to ")); |
|
|
|
|
Serial.println(filename); |
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
AudioNoInterrupts(); |
|
|
|
|
SD.begin(); |
|
|
|
|
SD.remove(filename); |
|
|
|
|
json = SD.open(filename, FILE_WRITE); |
|
|
|
|
if (json) |
|
|
|
|
{ |
|
|
|
|
data_json["decay"] = configuration.epiano.decay; |
|
|
|
|
data_json["release"] = configuration.epiano.release; |
|
|
|
|
data_json["hardness"] = configuration.epiano.hardness; |
|
|
|
|
data_json["treble"] = configuration.epiano.treble; |
|
|
|
|
data_json["pan_tremolo"] = configuration.epiano.pan_tremolo; |
|
|
|
|
data_json["pan_lfo"] = configuration.epiano.pan_lfo; |
|
|
|
|
data_json["velocity_sense"] = configuration.epiano.velocity_sense; |
|
|
|
|
data_json["stereo"] = configuration.epiano.stereo; |
|
|
|
|
data_json["polyphony"] = configuration.epiano.polyphony; |
|
|
|
|
data_json["tune"] = configuration.epiano.tune; |
|
|
|
|
data_json["detune"] = configuration.epiano.detune; |
|
|
|
|
data_json["overdrive"] = configuration.epiano.overdrive; |
|
|
|
|
data_json["lowest_note"] = configuration.epiano.lowest_note; |
|
|
|
|
data_json["highest_note"] = configuration.epiano.highest_note; |
|
|
|
|
data_json["transpose"] = configuration.epiano.transpose; |
|
|
|
|
data_json["sound_intensity"] = configuration.epiano.sound_intensity; |
|
|
|
|
data_json["pan"] = configuration.epiano.pan; |
|
|
|
|
data_json["midi_channel"] = configuration.epiano.midi_channel; |
|
|
|
|
|
|
|
|
|
#ifdef DEBUG |
|
|
|
|
Serial.println(F("Write JSON data:")); |
|
|
|
|
serializeJsonPretty(data_json, Serial); |
|
|
|
@ -1205,6 +1368,8 @@ bool save_sd_performance_json(uint8_t seq_number) |
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
save_sd_fx_json(seq_number); |
|
|
|
|
save_sd_epiano_json(seq_number); |
|
|
|
|
|
|
|
|
|
for (uint8_t i = 0; i < MAX_DEXED; i++) |
|
|
|
|
{ |
|
|
|
|
sprintf(filename, "/%s/%d/%s%d.json", PERFORMANCE_CONFIG_PATH, seq_number, VOICE_CONFIG_NAME, i); |
|
|
|
@ -1533,6 +1698,7 @@ bool load_sd_performance_json(uint8_t seq_number) |
|
|
|
|
load_sd_seq_sub_patterns_json(seq_number); |
|
|
|
|
load_sd_seq_sub_vel_json(seq_number); |
|
|
|
|
load_sd_fx_json(seq_number); |
|
|
|
|
load_sd_epiano_json(seq_number); |
|
|
|
|
|
|
|
|
|
if (sd_card > 0) |
|
|
|
|
{ |
|
|
|
|