From 1b609896097a8bc5385375c3d32305b7fef5c906 Mon Sep 17 00:00:00 2001 From: positionhigh Date: Mon, 16 Aug 2021 18:57:44 +0200 Subject: [PATCH] =?UTF-8?q?Dateien=20hochladen=20nach=20=E2=80=9E=E2=80=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- UI_FX.h | 24 ++++++++------- UI_FX_T4.h | 26 ++++++++-------- UI_NO_FX.h | 23 +++++++------- dexed_sd.cpp | 85 +++++++++++++++++++++++++++++++++++++++++----------- 4 files changed, 107 insertions(+), 51 deletions(-) diff --git a/UI_FX.h b/UI_FX.h index 3db2fd5..4be55c0 100644 --- a/UI_FX.h +++ b/UI_FX.h @@ -128,15 +128,17 @@ LCDML_add(94, LCDML_0_5_5, 2, "Seq. Length", UI_func_seq_lenght); LCDML_add(95, LCDML_0_5_5, 3, "Track Setup", UI_func_seq_track_setup); LCDML_add(96, LCDML_0_5_5, 4, "Seq.Disp.Style", UI_func_seq_display_style); LCDML_add(97, LCDML_0_5_5, 5, "dexed assign", UI_func_dexed_assign); -LCDML_add(98, LCDML_0_5_5, 6, "L.Transp.Key", UI_func_seq_live_transpose_oct); -LCDML_add(99, LCDML_0_5, 6, "LOAD Seq.Data", UI_func_seq_pattern_load); -LCDML_add(100, LCDML_0_5, 7, "SAVE Seq.Data", UI_func_seq_pattern_save); -LCDML_add(101, LCDML_0, 6, "System", NULL); -LCDML_add(102, LCDML_0_6, 1, "Stereo/Mono", UI_func_stereo_mono); -LCDML_add(103, LCDML_0_6, 2, "MIDI Soft THRU", UI_func_midi_soft_thru); -LCDML_add(104, LCDML_0_6, 3, "Favorites", UI_func_favorites); -LCDML_add(105, LCDML_0_6, 4, "EEPROM Reset", UI_func_eeprom_reset); -LCDML_add(106, LCDML_0, 7, "Info", UI_func_information); -LCDML_addAdvanced(107, LCDML_0, 8, COND_hide, "Volume", UI_func_volume, 0, _LCDML_TYPE_default); -#define _LCDML_DISP_cnt 107 +LCDML_add(98, LCDML_0_5_5, 6, "shift&transp.", UI_func_arp_shift); +LCDML_add(99, LCDML_0_5_5, 8, "ChordTrack Keys", UI_func_seq_chord_keys_ammount); +LCDML_add(100, LCDML_0_5_5, 6, "L.Transp.Key", UI_func_seq_live_transpose_oct); +LCDML_add(101, LCDML_0_5, 6, "LOAD Seq.Data", UI_func_seq_state_load); +LCDML_add(102, LCDML_0_5, 7, "SAVE Seq.Data", UI_func_seq_state_save); +LCDML_add(103, LCDML_0, 6, "System", NULL); +LCDML_add(104, LCDML_0_6, 1, "Stereo/Mono", UI_func_stereo_mono); +LCDML_add(105, LCDML_0_6, 2, "MIDI Soft THRU", UI_func_midi_soft_thru); +LCDML_add(106, LCDML_0_6, 3, "Favorites", UI_func_favorites); +LCDML_add(107, LCDML_0_6, 4, "EEPROM Reset", UI_func_eeprom_reset); +LCDML_add(108, LCDML_0, 7, "Info", UI_func_information); +LCDML_addAdvanced(109, LCDML_0, 8, COND_hide, "Volume", UI_func_volume, 0, _LCDML_TYPE_default); +#define _LCDML_DISP_cnt 109 #endif diff --git a/UI_FX_T4.h b/UI_FX_T4.h index 990ff47..e2079d2 100644 --- a/UI_FX_T4.h +++ b/UI_FX_T4.h @@ -115,7 +115,7 @@ LCDML_add(81, LCDML_0_3, 5, "MIDI", NULL); LCDML_add(82, LCDML_0_3_5, 1, "MIDI Recv Bank", UI_func_sysex_receive_bank); LCDML_add(83, LCDML_0_3_5, 2, "MIDI Snd Bank", UI_func_sysex_send_bank); LCDML_add(84, LCDML_0_3_5, 3, "MIDI Snd Voice", UI_func_sysex_send_voice); -LCDML_add(85, LCDML_0, 4, "Drums", NULL); +LCDML_add(85, LCDML_0, 4, "Drums", NULL); LCDML_add(86, LCDML_0_4, 1, "Drums Main Vol", UI_func_drums_main_volume); LCDML_add(87, LCDML_0_4, 2, "Drum Volumes", UI_func_drum_volume); LCDML_add(88, LCDML_0_4, 3, "Drum Pan", UI_func_drum_pan); @@ -131,15 +131,17 @@ LCDML_add(97, LCDML_0_5_5, 2, "Seq. Length", UI_func_seq_lenght); LCDML_add(98, LCDML_0_5_5, 3, "Track Setup", UI_func_seq_track_setup); LCDML_add(99, LCDML_0_5_5, 4, "Seq.Disp.Style", UI_func_seq_display_style); LCDML_add(100, LCDML_0_5_5, 5, "dexed assign", UI_func_dexed_assign); -LCDML_add(101, LCDML_0_5_5, 6, "L.Transp.Key", UI_func_seq_live_transpose_oct); -LCDML_add(102, LCDML_0_5, 6, "LOAD Seq.Data", UI_func_seq_pattern_load); -LCDML_add(103, LCDML_0_5, 7, "SAVE Seq.Data", UI_func_seq_pattern_save); -LCDML_add(104, LCDML_0, 6, "System", NULL); -LCDML_add(105, LCDML_0_6, 1, "Stereo/Mono", UI_func_stereo_mono); -LCDML_add(106, LCDML_0_6, 2, "MIDI Soft THRU", UI_func_midi_soft_thru); -LCDML_add(107, LCDML_0_6, 3, "Favorites", UI_func_favorites); -LCDML_add(108, LCDML_0_6, 4, "EEPROM Reset", UI_func_eeprom_reset); -LCDML_add(109, LCDML_0, 7, "Info", UI_func_information); -LCDML_addAdvanced(110, LCDML_0, 8, COND_hide, "Volume", UI_func_volume, 0, _LCDML_TYPE_default); -#define _LCDML_DISP_cnt 110 +LCDML_add(101, LCDML_0_5_5, 6, "shift&transp.", UI_func_arp_shift); +LCDML_add(102, LCDML_0_5_5, 7, "L.Transp.Key", UI_func_seq_live_transpose_oct); +LCDML_add(103, LCDML_0_5_5, 8, "ChordTrack Keys", UI_func_seq_chord_keys_ammount); +LCDML_add(104, LCDML_0_5, 6, "LOAD Seq.Data", UI_func_seq_state_load); +LCDML_add(105, LCDML_0_5, 7, "SAVE Seq.Data", UI_func_seq_state_save); +LCDML_add(106, LCDML_0, 6, "System", NULL); +LCDML_add(107, LCDML_0_6, 1, "Stereo/Mono", UI_func_stereo_mono); +LCDML_add(108, LCDML_0_6, 2, "MIDI Soft THRU", UI_func_midi_soft_thru); +LCDML_add(109, LCDML_0_6, 3, "Favorites", UI_func_favorites); +LCDML_add(110, LCDML_0_6, 4, "EEPROM Reset", UI_func_eeprom_reset); +LCDML_add(111, LCDML_0, 7, "Info", UI_func_information); +LCDML_addAdvanced(112, LCDML_0, 8, COND_hide, "Volume", UI_func_volume, 0, _LCDML_TYPE_default); +#define _LCDML_DISP_cnt 112 #endif diff --git a/UI_NO_FX.h b/UI_NO_FX.h index f82d44d..cc75e6c 100644 --- a/UI_NO_FX.h +++ b/UI_NO_FX.h @@ -85,7 +85,7 @@ LCDML_add(51, LCDML_0_2, 4, "MIDI", NULL); LCDML_add(52, LCDML_0_2_4, 1, "MIDI Recv Bank", UI_func_sysex_receive_bank); LCDML_add(53, LCDML_0_2_4, 2, "MIDI Snd Bank", UI_func_sysex_send_bank); LCDML_add(54, LCDML_0_2_4, 3, "MIDI Snd Voice", UI_func_sysex_send_voice); -LCDML_add(55, LCDML_0, 4, "Drums", NULL); +LCDML_add(55, LCDML_0, 4, "Drums", NULL); LCDML_add(56, LCDML_0_4, 1, "Drums Main Vol", UI_func_drums_main_volume); LCDML_add(57, LCDML_0_4, 2, "Drum Volumes", UI_func_drum_volume); LCDML_add(58, LCDML_0_4, 3, "Drum Pan", UI_func_drum_pan); @@ -102,15 +102,16 @@ LCDML_add(68, LCDML_0_5_5, 3, "Track Setup", UI_func_seq_track_setup); LCDML_add(69, LCDML_0_5_5, 4, "Seq.Disp.Style", UI_func_seq_display_style); LCDML_add(70, LCDML_0_5_5, 5, "dexed assign", UI_func_dexed_assign); LCDML_add(71, LCDML_0_5_5, 6, "L.Transp.Key", UI_func_seq_live_transpose_oct); -LCDML_add(72, LCDML_0_5, 6, "LOAD Seq.Data", UI_func_seq_pattern_load); -LCDML_add(73, LCDML_0_5, 7, "SAVE Seq.Data", UI_func_seq_pattern_save); -LCDML_add(74, LCDML_0, 5, "System", NULL); -LCDML_add(75, LCDML_0_5, 1, "Stereo/Mono", UI_func_stereo_mono); -LCDML_add(76, LCDML_0_5, 2, "MIDI Soft THRU", UI_func_midi_soft_thru); -LCDML_add(77, LCDML_0_5, 3, "Favorites", UI_func_favorites); -LCDML_add(78, LCDML_0_5, 4, "EEPROM Reset", UI_func_eeprom_reset); -LCDML_add(79, LCDML_0, 6, "Info", UI_func_information); -LCDML_addAdvanced(80, LCDML_0, 5, COND_hide, "Volume", UI_func_volume, 0, _LCDML_TYPE_default); -#define _LCDML_DISP_cnt 80 +LCDML_add(72, LCDML_0_5_5, 8, "ChordTrack Keys", UI_func_seq_chord_keys_ammount); +LCDML_add(73, LCDML_0_5, 6, "LOAD Seq.Data", UI_func_seq_state_load); +LCDML_add(74, LCDML_0_5, 7, "SAVE Seq.Data", UI_func_seq_state_save); +LCDML_add(75, LCDML_0, 5, "System", NULL); +LCDML_add(76, LCDML_0_5, 1, "Stereo/Mono", UI_func_stereo_mono); +LCDML_add(77, LCDML_0_5, 2, "MIDI Soft THRU", UI_func_midi_soft_thru); +LCDML_add(78, LCDML_0_5, 3, "Favorites", UI_func_favorites); +LCDML_add(79, LCDML_0_5, 4, "EEPROM Reset", UI_func_eeprom_reset); +LCDML_add(80, LCDML_0, 6, "Info", UI_func_information); +LCDML_addAdvanced(81, LCDML_0, 5, COND_hide, "Volume", UI_func_volume, 0, _LCDML_TYPE_default); +#define _LCDML_DISP_cnt 81 #endif diff --git a/dexed_sd.cpp b/dexed_sd.cpp index 941ce2f..5bbc479 100644 --- a/dexed_sd.cpp +++ b/dexed_sd.cpp @@ -45,12 +45,15 @@ extern uint8_t seq_vel[10][16]; extern uint8_t seq_patternchain[4][4]; extern uint8_t seq_content_type[10]; extern uint8_t seq_track_type[4]; +extern uint8_t seq_chord_key_ammount; +extern uint8_t seq_element_shift; +extern int seq_oct_shift; extern int seq_transpose; extern int seq_tempo_ms ; extern int seq_bpm; extern bool arp_play_basenote; extern uint8_t arp_speed; -extern uint8_t arp_oct_usersetting; +extern uint8_t arp_lenght; extern uint8_t arp_style; extern uint8_t seq_chord_velocity; extern uint8_t seq_chord_dexed_inst; @@ -830,6 +833,8 @@ bool load_sd_seq_drumsettings_json(uint8_t number) } bool load_sd_seq_voicesettings_json(uint8_t number) { + uint8_t bank[MAX_DEXED]; + uint8_t voice[MAX_DEXED]; if (number < 0) return (false); @@ -870,8 +875,8 @@ bool load_sd_seq_voicesettings_json(uint8_t number) for (uint8_t i = 0; i < MAX_DEXED; i++) { - configuration.performance.bank[i] = data_json["bank"][i]; - configuration.performance.voice[i] = data_json["voice"][i]; + bank[i] = data_json["bank"][i]; + voice[i] = data_json["voice"][i]; configuration.fx.reverb_send[i] = data_json["rev_send"][i]; configuration.dexed[i].midi_channel = data_json["midi_ch"][i]; configuration.dexed[i].sound_intensity = data_json["vol"][i]; @@ -890,7 +895,7 @@ bool load_sd_seq_voicesettings_json(uint8_t number) for (uint8_t i = 0; i < NUM_DEXED; i++) { - load_sd_voice(configuration.performance.bank[i], configuration.performance.voice[i], i); + load_sd_voice(bank[i], voice[i], i); MicroDexed[i]->doRefreshVoice(); MicroDexed[i]->panic(); } @@ -945,14 +950,14 @@ bool save_sd_seq_drumsettings_json(uint8_t number) json = SD.open(filename, FILE_WRITE); if (json) { - data_json["drums_volume"] = drums_volume; + // data_json["drums_volume"] = drums_volume; for (uint8_t i = 0; i < 20; i++) // needs to be replaced by NUM_DRUMSET_CONFIG { - data_json["pan"][i] = drum_config[i].pan; - data_json["vol_max"][i] = drum_config[i].vol_max; - data_json["vol_min"][i] = drum_config[i].vol_min; - data_json["reverb_send"][i] = drum_config[i].reverb_send; + // data_json["pan"][i] = drum_config[i].pan; + // data_json["vol_max"][i] = drum_config[i].vol_max; + // data_json["vol_min"][i] = drum_config[i].vol_min; + // data_json["reverb_send"][i] = drum_config[i].reverb_send; } #ifdef DEBUG Serial.println(F("Write JSON data:")); @@ -1050,8 +1055,23 @@ bool save_sd_seq_json(uint8_t seq_number) int count = 0; seq_number = constrain(seq_number, 0, 99); + save_sd_seq_drumsettings_json(seq_number); + save_sd_seq_voicesettings_json(seq_number); + if (sd_card > 0) { + + sprintf(filename, "/%s/%s%d.json", SEQ_CONFIG_PATH, SEQ_CONFIG_NAME, seq_number); + + AudioNoInterrupts(); + + if (SD.exists(filename)) { + Serial.println("Remove"); + Serial.print(filename); + SD.remove(filename); + } + + AudioInterrupts(); File json; sprintf(filename, "/%s/%s%d.json", SEQ_CONFIG_PATH, SEQ_CONFIG_NAME, seq_number); @@ -1071,7 +1091,9 @@ bool save_sd_seq_json(uint8_t seq_number) Serial.print(" Columns: "); Serial.print(columns); Serial.print(F(" ")); + AudioNoInterrupts(); + json = SD.open(filename, FILE_WRITE); if (json) { @@ -1114,12 +1136,15 @@ bool save_sd_seq_json(uint8_t seq_number) data_json["seq_bpm"] = seq_bpm; data_json["arp_play_basenote"] = arp_play_basenote; data_json["arp_speed"] = arp_speed; - data_json["arp_oct_usersetting"] = arp_oct_usersetting; + data_json["arp_lenght"] = arp_lenght; data_json["arp_style"] = arp_style; data_json["seq_chord_velocity"] = seq_chord_velocity; data_json["seq_chord_dexed_inst"] = seq_chord_dexed_inst; data_json["seq_chain_lenght"] = seq_chain_lenght; data_json["seq_transpose"] = seq_transpose; + data_json["chord_key_ammount"] = seq_chord_key_ammount; + data_json["seq_oct_shift"] = seq_oct_shift; + data_json["seq_element_shift"] = seq_element_shift; for (uint8_t i = 0; i < sizeof(seq_track_type); i++) { data_json["track_type"][i] = seq_track_type[i]; @@ -1138,10 +1163,11 @@ bool save_sd_seq_json(uint8_t seq_number) #endif serializeJsonPretty(data_json, json); json.close(); - AudioInterrupts(); + return (true); } json.close(); + AudioInterrupts(); } else { @@ -1151,8 +1177,6 @@ bool save_sd_seq_json(uint8_t seq_number) Serial.println(F(" on SD.")); #endif } - save_sd_seq_drumsettings_json(seq_number); - save_sd_seq_voicesettings_json(seq_number); AudioInterrupts(); return (false); } @@ -1165,6 +1189,9 @@ bool load_sd_seq_json(uint8_t seq_number) seq_number = constrain(seq_number, 0, 99); + load_sd_seq_drumsettings_json(seq_number); + load_sd_seq_voicesettings_json(seq_number); + if (sd_card > 0) { File json; @@ -1243,12 +1270,15 @@ bool load_sd_seq_json(uint8_t seq_number) seq_bpm = data_json["seq_bpm"]; arp_play_basenote = data_json["arp_play_basenote"]; arp_speed = data_json["arp_speed"] ; - arp_oct_usersetting = data_json["arp_oct_usersetting"]; + arp_lenght = data_json["arp_lenght"]; arp_style = data_json["arp_style"]; seq_chord_velocity = data_json["seq_chord_velocity"]; seq_chord_dexed_inst = data_json["seq_chord_dexed_inst"] ; - seq_transpose = data_json["seq_transpose"]; seq_chain_lenght = data_json["seq_chain_lenght"]; + seq_transpose = data_json["seq_transpose"]; + seq_chord_key_ammount = data_json["chord_key_ammount"]; + seq_oct_shift = data_json["seq_oct_shift"]; + seq_element_shift = data_json["seq_element_shift"]; set_fx_params(); @@ -1270,12 +1300,33 @@ bool load_sd_seq_json(uint8_t seq_number) #endif } } - load_sd_seq_drumsettings_json(seq_number); - load_sd_seq_voicesettings_json(seq_number); + AudioInterrupts(); return (false); } +bool check_sd_seq_exists(uint8_t number) +{ + if (number < 0) + return (false); + number = constrain(number, 0, 99); + + if (sd_card > 0) + { + char filename[FILENAME_LEN]; + + sprintf(filename, "/%s/%s%d.json", SEQ_CONFIG_PATH, SEQ_CONFIG_NAME, number); + + // check if file exists... + AudioNoInterrupts(); + if (SD.exists(filename)) + { + return (true); + } else return (false); + } else + return (false); + AudioInterrupts(); +} /****************************************************************************** SD PERFORMANCE