|
|
|
@ -93,7 +93,6 @@ extern uint8_t find_drum_number_from_note(uint8_t note); |
|
|
|
|
/******************************************************************************
|
|
|
|
|
SD BANK/VOICE LOADING |
|
|
|
|
******************************************************************************/ |
|
|
|
|
|
|
|
|
|
bool load_sd_voice(uint8_t b, uint8_t v, uint8_t instance_id) |
|
|
|
|
{ |
|
|
|
|
v = constrain(v, 0, MAX_VOICES - 1); |
|
|
|
@ -453,13 +452,12 @@ bool save_sd_bank(const char* bank_filename, uint8_t* data) |
|
|
|
|
/******************************************************************************
|
|
|
|
|
SD DRUMSETTINGS |
|
|
|
|
******************************************************************************/ |
|
|
|
|
|
|
|
|
|
bool load_sd_drumsettings_json(uint8_t number) |
|
|
|
|
{ |
|
|
|
|
if (number < 0) |
|
|
|
|
return (false); |
|
|
|
|
|
|
|
|
|
number = constrain(number, 0, 99); |
|
|
|
|
number = constrain(number, DRUMS_CONFIG_MIN, DRUMS_CONFIG_MAX); |
|
|
|
|
|
|
|
|
|
if (sd_card > 0) |
|
|
|
|
{ |
|
|
|
@ -496,8 +494,7 @@ bool load_sd_drumsettings_json(uint8_t number) |
|
|
|
|
{ |
|
|
|
|
uint8_t drumnumber = 0; |
|
|
|
|
drumnumber = find_drum_number_from_note( data_json["note"][i] ); |
|
|
|
|
if ( ( (int)data_json["note"][i] > 0 && find_drum_number_from_note( data_json["note"][i] ) > 0 ) || |
|
|
|
|
( i == 0 && (int)data_json["note"][i] == 210) ) |
|
|
|
|
if (((int)data_json["note"][i] > 0 && find_drum_number_from_note(data_json["note"][i]) > 0) || (i == 0 && (int)data_json["note"][i] == 210)) |
|
|
|
|
{ |
|
|
|
|
set_sample_pitch( drumnumber, data_json["pitch"][i] ); |
|
|
|
|
set_sample_p_offset ( drumnumber, data_json["p_offset"][i] ); |
|
|
|
@ -597,14 +594,14 @@ bool load_sd_voiceconfig_json(uint8_t vc, uint8_t instance_id) |
|
|
|
|
{ |
|
|
|
|
char filename[CONFIG_FILENAME_LEN]; |
|
|
|
|
|
|
|
|
|
vc = constrain(vc, 0, MAX_VOICECONFIG); |
|
|
|
|
vc = constrain(vc, VOICE_CONFIG_MIN, VOICE_CONFIG_MAX); |
|
|
|
|
|
|
|
|
|
if (sd_card > 0) |
|
|
|
|
{ |
|
|
|
|
File json; |
|
|
|
|
StaticJsonDocument<JSON_BUFFER_SIZE> data_json; |
|
|
|
|
|
|
|
|
|
sprintf(filename, "/%s/%d/%s%d.json", PERFORMANCE_CONFIG_PATH, vc, VOICE_CONFIG_NAME, instance_id); |
|
|
|
|
sprintf(filename, "/%s/%d/%s%d.json", PERFORMANCE_CONFIG_PATH, vc, VOICE_CONFIG_NAME, instance_id + 1); |
|
|
|
|
|
|
|
|
|
// first check if file exists...
|
|
|
|
|
AudioNoInterrupts(); |
|
|
|
@ -624,8 +621,6 @@ bool load_sd_voiceconfig_json(uint8_t vc, uint8_t instance_id) |
|
|
|
|
json.close(); |
|
|
|
|
AudioInterrupts(); |
|
|
|
|
|
|
|
|
|
check_configuration_dexed(instance_id); |
|
|
|
|
|
|
|
|
|
#ifdef DEBUG |
|
|
|
|
Serial.println(F("Read JSON data:")); |
|
|
|
|
serializeJsonPretty(data_json, Serial); |
|
|
|
@ -661,6 +656,7 @@ bool load_sd_voiceconfig_json(uint8_t vc, uint8_t instance_id) |
|
|
|
|
configuration.dexed[instance_id].op_enabled = data_json["op_enabled"]; |
|
|
|
|
configuration.dexed[instance_id].midi_channel = data_json["midi_channel"]; |
|
|
|
|
|
|
|
|
|
check_configuration_dexed(instance_id); |
|
|
|
|
set_voiceconfig_params(instance_id); |
|
|
|
|
|
|
|
|
|
return (true); |
|
|
|
@ -690,7 +686,7 @@ bool save_sd_voiceconfig_json(uint8_t vc, uint8_t instance_id) |
|
|
|
|
{ |
|
|
|
|
char filename[CONFIG_FILENAME_LEN]; |
|
|
|
|
|
|
|
|
|
vc = constrain(vc, 0, MAX_VOICECONFIG); |
|
|
|
|
vc = constrain(vc, VOICE_CONFIG_MIN, VOICE_CONFIG_MAX); |
|
|
|
|
|
|
|
|
|
if (sd_card > 0) |
|
|
|
|
{ |
|
|
|
@ -776,7 +772,7 @@ bool save_sd_voiceconfig_json(uint8_t vc, uint8_t instance_id) |
|
|
|
|
******************************************************************************/ |
|
|
|
|
bool load_sd_fx_json(uint8_t fx) |
|
|
|
|
{ |
|
|
|
|
fx = constrain(fx, FX_NUM_MIN, FX_NUM_MAX); |
|
|
|
|
fx = constrain(fx, FX_CONFIG_MIN, FX_CONFIG_MAX); |
|
|
|
|
|
|
|
|
|
load_sd_drumsettings_json(fx); |
|
|
|
|
|
|
|
|
@ -805,8 +801,6 @@ bool load_sd_fx_json(uint8_t fx) |
|
|
|
|
json.close(); |
|
|
|
|
AudioInterrupts(); |
|
|
|
|
|
|
|
|
|
check_configuration_fx(); |
|
|
|
|
|
|
|
|
|
#ifdef DEBUG |
|
|
|
|
Serial.println(F("Read JSON data:")); |
|
|
|
|
serializeJsonPretty(data_json, Serial); |
|
|
|
@ -845,6 +839,7 @@ bool load_sd_fx_json(uint8_t fx) |
|
|
|
|
configuration.fx.eq_6 = data_json["eq_6"]; |
|
|
|
|
configuration.fx.eq_7 = data_json["eq_7"]; |
|
|
|
|
|
|
|
|
|
check_configuration_fx(); |
|
|
|
|
set_fx_params(); |
|
|
|
|
|
|
|
|
|
return (true); |
|
|
|
@ -874,7 +869,7 @@ bool save_sd_fx_json(uint8_t fx) |
|
|
|
|
{ |
|
|
|
|
char filename[CONFIG_FILENAME_LEN]; |
|
|
|
|
|
|
|
|
|
fx = constrain(fx, FX_NUM_MIN, FX_NUM_MAX); |
|
|
|
|
fx = constrain(fx, FX_CONFIG_MIN, FX_CONFIG_MAX); |
|
|
|
|
|
|
|
|
|
save_sd_drumsettings_json(fx); |
|
|
|
|
if (sd_card > 0) |
|
|
|
@ -953,7 +948,7 @@ bool save_sd_seq_sub_vel_json(uint8_t seq_number) |
|
|
|
|
{ |
|
|
|
|
char filename[CONFIG_FILENAME_LEN]; |
|
|
|
|
int count = 0; |
|
|
|
|
seq_number = constrain(seq_number, VELOCITY_NUM_MIN, VELOCITY_NUM_MAX); |
|
|
|
|
seq_number = constrain(seq_number, VELOCITY_CONFIG_MIN, VELOCITY_CONFIG_MAX); |
|
|
|
|
|
|
|
|
|
if (sd_card > 0) |
|
|
|
|
{ |
|
|
|
@ -1009,7 +1004,7 @@ bool save_sd_seq_sub_patterns_json(uint8_t seq_number) |
|
|
|
|
{ |
|
|
|
|
char filename[CONFIG_FILENAME_LEN]; |
|
|
|
|
int count = 0; |
|
|
|
|
seq_number = constrain(seq_number, VELOCITY_NUM_MIN, VELOCITY_NUM_MAX); |
|
|
|
|
seq_number = constrain(seq_number, VELOCITY_CONFIG_MIN, VELOCITY_CONFIG_MAX); |
|
|
|
|
|
|
|
|
|
if (sd_card > 0) |
|
|
|
|
{ |
|
|
|
@ -1061,12 +1056,12 @@ bool save_sd_seq_sub_patterns_json(uint8_t seq_number) |
|
|
|
|
return (false); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
bool save_sd_seq_json(uint8_t seq_number) |
|
|
|
|
bool save_sd_performance_json(uint8_t seq_number) |
|
|
|
|
{ |
|
|
|
|
char filename[CONFIG_FILENAME_LEN]; |
|
|
|
|
int count = 0; |
|
|
|
|
bool seq_was_running = false; |
|
|
|
|
seq_number = constrain(seq_number, VELOCITY_NUM_MIN, VELOCITY_NUM_MAX); |
|
|
|
|
seq_number = constrain(seq_number, VELOCITY_CONFIG_MIN, VELOCITY_CONFIG_MAX); |
|
|
|
|
|
|
|
|
|
if (seq_running == true ) { |
|
|
|
|
seq_was_running = true; |
|
|
|
@ -1182,7 +1177,7 @@ bool save_sd_seq_json(uint8_t seq_number) |
|
|
|
|
return (false); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void get_sd_seq_name_json(uint8_t seq_number) |
|
|
|
|
void get_sd_performance_name_json(uint8_t seq_number) |
|
|
|
|
{ |
|
|
|
|
seq_number = constrain(seq_number, 0, 99); |
|
|
|
|
memset(seq_name_temp, 0, FILENAME_LEN); |
|
|
|
@ -1222,7 +1217,7 @@ bool load_sd_seq_sub_vel_json(uint8_t seq_number) |
|
|
|
|
{ |
|
|
|
|
if (seq_number < 0) |
|
|
|
|
return (false); |
|
|
|
|
seq_number = constrain(seq_number, 0, 99); |
|
|
|
|
seq_number = constrain(seq_number, SEQUENCE_CONFIG_MIN, SEQUENCE_CONFIG_MAX); |
|
|
|
|
if (sd_card > 0) |
|
|
|
|
{ |
|
|
|
|
File json; |
|
|
|
@ -1356,11 +1351,10 @@ bool load_sd_seq_sub_patterns_json(uint8_t seq_number) |
|
|
|
|
return (false); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
bool load_sd_seq_json(uint8_t seq_number) |
|
|
|
|
bool load_sd_performance_json(uint8_t seq_number) |
|
|
|
|
{ |
|
|
|
|
bool seq_was_running = false; |
|
|
|
|
if (seq_number < 0) |
|
|
|
|
return (false); |
|
|
|
|
|
|
|
|
|
if (seq_running) |
|
|
|
|
{ |
|
|
|
|
seq_was_running = true; |
|
|
|
@ -1385,10 +1379,9 @@ bool load_sd_seq_json(uint8_t seq_number) |
|
|
|
|
{ |
|
|
|
|
// ... and if: load
|
|
|
|
|
#ifdef DEBUG |
|
|
|
|
Serial.print(F("Found Sequencer configuration [")); |
|
|
|
|
Serial.print(F("Found Performance configuration [")); |
|
|
|
|
Serial.print(filename); |
|
|
|
|
Serial.println(F("]... loading...")); |
|
|
|
|
Serial.println(F(" ")); |
|
|
|
|
#endif |
|
|
|
|
json = SD.open(filename); |
|
|
|
|
if (json) |
|
|
|
@ -1456,15 +1449,16 @@ bool load_sd_seq_json(uint8_t seq_number) |
|
|
|
|
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(); |
|
|
|
|
#ifdef DEBUG |
|
|
|
|
Serial.print(F(" ")); |
|
|
|
|
Serial.print(F("Load Voice-Config for sequencer")); |
|
|
|
|
Serial.print(instance_id); |
|
|
|
|
Serial.print(F(" ")); |
|
|
|
|
Serial.print(F("Load Voice-Config ")); |
|
|
|
|
Serial.print(instance_id + 1); |
|
|
|
|
Serial.print(F(" for sequencer")); |
|
|
|
|
#endif |
|
|
|
|
} |
|
|
|
|
for (uint8_t instance_id = 0; instance_id < NUM_DEXED; instance_id++) |
|
|
|
|
/* for (uint8_t instance_id = 0; instance_id < NUM_DEXED; instance_id++)
|
|
|
|
|
set_voiceconfig_params(instance_id); |
|
|
|
|
set_fx_params(); |
|
|
|
|
|
|
|
|
|
set_fx_params();*/ |
|
|
|
|
|
|
|
|
|
dac_unmute(); |
|
|
|
|
seq_step = 0; |
|
|
|
|
seq_chain_active_step = 0; |
|
|
|
|