|
|
@ -54,7 +54,7 @@ extern uint8_t seq_chord_key_ammount; |
|
|
|
extern uint8_t seq_element_shift; |
|
|
|
extern uint8_t seq_element_shift; |
|
|
|
extern int seq_oct_shift; |
|
|
|
extern int seq_oct_shift; |
|
|
|
extern int seq_transpose; |
|
|
|
extern int seq_transpose; |
|
|
|
extern int seq_tempo_ms ; |
|
|
|
extern int seq_tempo_ms; |
|
|
|
extern int seq_bpm; |
|
|
|
extern int seq_bpm; |
|
|
|
extern bool arp_play_basenote; |
|
|
|
extern bool arp_play_basenote; |
|
|
|
extern bool seq_running; |
|
|
|
extern bool seq_running; |
|
|
@ -64,6 +64,8 @@ extern uint8_t arp_style; |
|
|
|
extern uint8_t seq_chord_velocity; |
|
|
|
extern uint8_t seq_chord_velocity; |
|
|
|
extern uint8_t seq_chord_dexed_inst; |
|
|
|
extern uint8_t seq_chord_dexed_inst; |
|
|
|
extern uint8_t seq_inst_dexed[NUM_SEQ_TRACKS]; |
|
|
|
extern uint8_t seq_inst_dexed[NUM_SEQ_TRACKS]; |
|
|
|
|
|
|
|
extern uint8_t seq_step; |
|
|
|
|
|
|
|
extern uint8_t seq_chain_active_step; |
|
|
|
extern char seq_name[FILENAME_LEN]; |
|
|
|
extern char seq_name[FILENAME_LEN]; |
|
|
|
extern char seq_name_temp[FILENAME_LEN]; |
|
|
|
extern char seq_name_temp[FILENAME_LEN]; |
|
|
|
extern PeriodicTimer timer1; |
|
|
|
extern PeriodicTimer timer1; |
|
|
@ -75,6 +77,10 @@ extern void set_sample_pan(uint8_t sample, float s_pan); |
|
|
|
extern void set_sample_vol_max(uint8_t sample, float s_max); |
|
|
|
extern void set_sample_vol_max(uint8_t sample, float s_max); |
|
|
|
extern void set_sample_vol_min(uint8_t sample, float s_min); |
|
|
|
extern void set_sample_vol_min(uint8_t sample, float s_min); |
|
|
|
extern void set_sample_reverb_send(uint8_t sample, float s_reverb); |
|
|
|
extern void set_sample_reverb_send(uint8_t sample, float s_reverb); |
|
|
|
|
|
|
|
extern void handleStop(void); |
|
|
|
|
|
|
|
extern void handleStart(void); |
|
|
|
|
|
|
|
extern void dac_mute(void); |
|
|
|
|
|
|
|
extern void dac_unmute(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); |
|
|
@ -1072,7 +1078,14 @@ bool save_sd_seq_json(uint8_t seq_number) |
|
|
|
{ |
|
|
|
{ |
|
|
|
char filename[FILENAME_LEN]; |
|
|
|
char filename[FILENAME_LEN]; |
|
|
|
int count = 0; |
|
|
|
int count = 0; |
|
|
|
|
|
|
|
bool seq_was_running = false; |
|
|
|
seq_number = constrain(seq_number, 0, 99); |
|
|
|
seq_number = constrain(seq_number, 0, 99); |
|
|
|
|
|
|
|
if (seq_running == true ) { |
|
|
|
|
|
|
|
seq_was_running = true; |
|
|
|
|
|
|
|
handleStop(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
dac_mute(); |
|
|
|
|
|
|
|
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-fx.json", SEQ_CONFIG_PATH, seq_number); |
|
|
|
sprintf(filename, "/%s/%d-fx.json", SEQ_CONFIG_PATH, seq_number); |
|
|
@ -1106,7 +1119,6 @@ bool save_sd_seq_json(uint8_t seq_number) |
|
|
|
int columns = sizeof(seq_patternchain[0]); |
|
|
|
int columns = sizeof(seq_patternchain[0]); |
|
|
|
int rows = total / columns; |
|
|
|
int rows = total / columns; |
|
|
|
Serial.print(F(" ")); |
|
|
|
Serial.print(F(" ")); |
|
|
|
AudioNoInterrupts(); |
|
|
|
|
|
|
|
SD.begin(); |
|
|
|
SD.begin(); |
|
|
|
SD.remove(filename); |
|
|
|
SD.remove(filename); |
|
|
|
json = SD.open(filename, FILE_WRITE); |
|
|
|
json = SD.open(filename, FILE_WRITE); |
|
|
@ -1164,6 +1176,9 @@ bool save_sd_seq_json(uint8_t seq_number) |
|
|
|
serializeJsonPretty(data_json, json); |
|
|
|
serializeJsonPretty(data_json, json); |
|
|
|
json.close(); |
|
|
|
json.close(); |
|
|
|
AudioInterrupts(); |
|
|
|
AudioInterrupts(); |
|
|
|
|
|
|
|
dac_unmute(); |
|
|
|
|
|
|
|
if (seq_was_running == true ) |
|
|
|
|
|
|
|
handleStart(); |
|
|
|
return (true); |
|
|
|
return (true); |
|
|
|
} |
|
|
|
} |
|
|
|
json.close(); |
|
|
|
json.close(); |
|
|
@ -1219,9 +1234,7 @@ bool load_sd_seq_sub_vel_json(uint8_t seq_number) |
|
|
|
{ |
|
|
|
{ |
|
|
|
if (seq_number < 0) |
|
|
|
if (seq_number < 0) |
|
|
|
return (false); |
|
|
|
return (false); |
|
|
|
|
|
|
|
|
|
|
|
seq_number = constrain(seq_number, 0, 99); |
|
|
|
seq_number = constrain(seq_number, 0, 99); |
|
|
|
|
|
|
|
|
|
|
|
if (sd_card > 0) |
|
|
|
if (sd_card > 0) |
|
|
|
{ |
|
|
|
{ |
|
|
|
File json; |
|
|
|
File json; |
|
|
@ -1289,9 +1302,7 @@ bool load_sd_seq_sub_patterns_json(uint8_t seq_number) |
|
|
|
{ |
|
|
|
{ |
|
|
|
if (seq_number < 0) |
|
|
|
if (seq_number < 0) |
|
|
|
return (false); |
|
|
|
return (false); |
|
|
|
|
|
|
|
|
|
|
|
seq_number = constrain(seq_number, 0, 99); |
|
|
|
seq_number = constrain(seq_number, 0, 99); |
|
|
|
|
|
|
|
|
|
|
|
if (sd_card > 0) |
|
|
|
if (sd_card > 0) |
|
|
|
{ |
|
|
|
{ |
|
|
|
File json; |
|
|
|
File json; |
|
|
@ -1359,14 +1370,20 @@ bool load_sd_seq_sub_patterns_json(uint8_t seq_number) |
|
|
|
|
|
|
|
|
|
|
|
bool load_sd_seq_json(uint8_t seq_number) |
|
|
|
bool load_sd_seq_json(uint8_t seq_number) |
|
|
|
{ |
|
|
|
{ |
|
|
|
|
|
|
|
bool seq_was_running = false; |
|
|
|
if (seq_number < 0) |
|
|
|
if (seq_number < 0) |
|
|
|
return (false); |
|
|
|
return (false); |
|
|
|
|
|
|
|
if (seq_running) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
seq_was_running = true; |
|
|
|
|
|
|
|
seq_running = false; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
dac_mute(); |
|
|
|
|
|
|
|
handleStop(); |
|
|
|
|
|
|
|
AudioNoInterrupts(); |
|
|
|
seq_number = constrain(seq_number, 0, 99); |
|
|
|
seq_number = constrain(seq_number, 0, 99); |
|
|
|
|
|
|
|
|
|
|
|
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, 1); |
|
|
|
|
|
|
|
|
|
|
|
if (sd_card > 0) |
|
|
|
if (sd_card > 0) |
|
|
@ -1374,11 +1391,8 @@ bool load_sd_seq_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[FILENAME_LEN]; |
|
|
|
|
|
|
|
|
|
|
|
sprintf(filename, "/%s/%d-S.json", SEQ_CONFIG_PATH, seq_number); |
|
|
|
sprintf(filename, "/%s/%d-S.json", SEQ_CONFIG_PATH, seq_number); |
|
|
|
|
|
|
|
|
|
|
|
// first check if file exists...
|
|
|
|
// first check if file exists...
|
|
|
|
AudioNoInterrupts(); |
|
|
|
|
|
|
|
if (SD.exists(filename)) |
|
|
|
if (SD.exists(filename)) |
|
|
|
{ |
|
|
|
{ |
|
|
|
// ... and if: load
|
|
|
|
// ... and if: load
|
|
|
@ -1392,10 +1406,8 @@ bool load_sd_seq_json(uint8_t seq_number) |
|
|
|
if (json) |
|
|
|
if (json) |
|
|
|
{ |
|
|
|
{ |
|
|
|
deserializeJson(data_json, json); |
|
|
|
deserializeJson(data_json, json); |
|
|
|
|
|
|
|
|
|
|
|
json.close(); |
|
|
|
json.close(); |
|
|
|
AudioInterrupts(); |
|
|
|
AudioInterrupts(); |
|
|
|
|
|
|
|
|
|
|
|
#ifdef DEBUG |
|
|
|
#ifdef DEBUG |
|
|
|
Serial.println(F("Read JSON data:")); |
|
|
|
Serial.println(F("Read JSON data:")); |
|
|
|
serializeJsonPretty(data_json, Serial); |
|
|
|
serializeJsonPretty(data_json, Serial); |
|
|
@ -1465,8 +1477,14 @@ bool load_sd_seq_json(uint8_t seq_number) |
|
|
|
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_voiceconfig_params(instance_id); |
|
|
|
set_fx_params(); |
|
|
|
set_fx_params(); |
|
|
|
if (seq_running) |
|
|
|
dac_unmute(); |
|
|
|
|
|
|
|
seq_step = 0; |
|
|
|
|
|
|
|
seq_chain_active_step = 0; |
|
|
|
|
|
|
|
if (seq_was_running) |
|
|
|
|
|
|
|
{ |
|
|
|
timer1.begin(sequencer, seq_tempo_ms / 2); |
|
|
|
timer1.begin(sequencer, seq_tempo_ms / 2); |
|
|
|
|
|
|
|
seq_running = true; |
|
|
|
|
|
|
|
} |
|
|
|
else |
|
|
|
else |
|
|
|
timer1.begin(sequencer, seq_tempo_ms / 2, false); |
|
|
|
timer1.begin(sequencer, seq_tempo_ms / 2, false); |
|
|
|
return (true); |
|
|
|
return (true); |
|
|
|