Merge pull request 'conflict solve' (#87) from positionhigh/MicroDexed:dev into dev

Reviewed-on: https://codeberg.org/dcoredump/MicroDexed/pulls/87
pull/88/head^2
Holger Wirtz 3 years ago
commit 57e73859fb
  1. 35
      UI.hpp
  2. 4
      config.h
  3. 48
      dexed_sd.cpp

@ -6626,7 +6626,7 @@ void UI_func_save_performance(uint8_t param)
void UI_func_load_voiceconfig(uint8_t param)
{
#if NUMDEXED > 1
#if NUM_DEXED > 1
static int8_t selected_instance_id;
#else
uint8_t selected_instance_id = 0;
@ -6636,7 +6636,6 @@ void UI_func_load_voiceconfig(uint8_t param)
if (LCDML.FUNC_setup()) // ****** SETUP *********
{
char tmp[10];
selected_instance_id = 0;
@ -6644,7 +6643,7 @@ void UI_func_load_voiceconfig(uint8_t param)
lcd.setCursor(0, 0);
lcd.print(F("Load VoiceCfg SD"));
#if NUMDEXED > 1
#if NUM_DEXED > 1
mode = 0;
lcd.setCursor(0, 1);
lcd.print(F("Instance [0]"));
@ -6663,19 +6662,22 @@ void UI_func_load_voiceconfig(uint8_t param)
if (LCDML.BT_checkDown())
{
if (mode == 0)
selected_instance_id = (selected_instance_id + 1) % 2;
selected_instance_id = 1;
//selected_instance_id = (selected_instance_id + 1) % 2;
else if (mode == 1)
configuration.performance.voiceconfig_number[selected_instance_id] = constrain(configuration.performance.voiceconfig_number[selected_instance_id] + ENCODER[ENC_L].speed(), VOICECONFIG_NUM_MIN, VOICECONFIG_NUM_MAX);
}
else if (LCDML.BT_checkUp())
{
if (mode == 0)
selected_instance_id = (selected_instance_id - 1) % 2;
//selected_instance_id = (selected_instance_id - 1) % 2;
selected_instance_id = 0;
else if (mode == 1)
configuration.performance.voiceconfig_number[selected_instance_id] = constrain(configuration.performance.voiceconfig_number[selected_instance_id] - ENCODER[ENC_L].speed(), VOICECONFIG_NUM_MIN, VOICECONFIG_NUM_MAX);
}
else if (LCDML.BT_checkEnter())
{
if (mode > 0) {
mode = 0xff;
lcd.setCursor(0, 1);
if (load_sd_voiceconfig_json(configuration.performance.voiceconfig_number[selected_instance_id], selected_instance_id) == false)
@ -6686,6 +6688,7 @@ void UI_func_load_voiceconfig(uint8_t param)
delay(MESSAGE_WAIT_TIME);
LCDML.FUNC_goBackToMenu();
} else mode = 1;
}
if (mode == 0)
@ -6727,7 +6730,7 @@ void UI_func_load_voiceconfig(uint8_t param)
void UI_func_save_voiceconfig(uint8_t param)
{
#if NUMDEXED > 1
#if NUM_DEXED > 1
static int8_t selected_instance_id;
#else
uint8_t selected_instance_id = 0;
@ -6739,8 +6742,6 @@ void UI_func_save_voiceconfig(uint8_t param)
if (LCDML.FUNC_setup()) // ****** SETUP *********
{
char tmp[FILENAME_LEN];
yesno = false;
selected_instance_id = 0;
@ -6748,7 +6749,7 @@ void UI_func_save_voiceconfig(uint8_t param)
lcd.setCursor(0, 0);
lcd.print(F("Save VoiceCfg SD"));
#if NUMDEXED > 1
#if NUM_DEXED > 1
mode = 0;
lcd.setCursor(0, 1);
lcd.print(F("Instance [0]"));
@ -6773,7 +6774,8 @@ void UI_func_save_voiceconfig(uint8_t param)
if (LCDML.BT_checkDown())
{
if (mode == 0)
selected_instance_id = (selected_instance_id + 1) % 2;
selected_instance_id = 1;
// selected_instance_id = (selected_instance_id +1) % 2;
else if (mode == 1)
configuration.performance.voiceconfig_number[selected_instance_id] = constrain(configuration.performance.voiceconfig_number[selected_instance_id] + ENCODER[ENC_L].speed(), VOICECONFIG_NUM_MIN, VOICECONFIG_NUM_MAX);
else
@ -6782,7 +6784,8 @@ void UI_func_save_voiceconfig(uint8_t param)
else if (LCDML.BT_checkUp())
{
if (mode == 0)
selected_instance_id = (selected_instance_id - 1) % 2;
selected_instance_id = 0;
//selected_instance_id = (selected_instance_id - 1) % 2;
else if (mode == 1)
configuration.performance.voiceconfig_number[selected_instance_id] = constrain(configuration.performance.voiceconfig_number[selected_instance_id] - ENCODER[ENC_L].speed(), VOICECONFIG_NUM_MIN, VOICECONFIG_NUM_MAX);
else
@ -6796,7 +6799,7 @@ void UI_func_save_voiceconfig(uint8_t param)
lcd.setCursor(0, 1);
lcd.print(F("Overwrite: [ ]"));
}
else
else if (mode > 0 )
{
mode = 0xff;
if (overwrite == false || yesno == true)
@ -6822,12 +6825,18 @@ void UI_func_save_voiceconfig(uint8_t param)
lcd.print(tmp);
}
}
else {
mode = 1;
lcd.setCursor(4, 1);
lcd.print(" ");
}
}
if (mode == 0)
{
lcd.setCursor(10, 1);
lcd.print(configuration.performance.voiceconfig_number[selected_instance_id]);
//lcd.print(configuration.performance.voiceconfig_number[selected_instance_id]);
lcd.print(selected_instance_id);
}
else if (mode == 1)
{

@ -630,6 +630,10 @@
#define EQ_7_MAX 99
#define EQ_7_DEFAULT 0
// Buffer-size define for load/save configuration as JSON
#define JSON_BUFFER_SIZE 8192
// Internal configuration structure
typedef struct dexed_s {
uint8_t lowest_note;

@ -38,7 +38,7 @@ extern void check_configuration_dexed(uint8_t instance_id);
extern void check_configuration_performance(void);
extern void check_configuration_fx(void);
extern void sequencer();
extern StaticJsonDocument<JSON_BUFFER> data_json;
//extern StaticJsonDocument<JSON_BUFFER> data_json;
extern uint8_t seq_chain_lenght;
extern uint8_t seq_data[10][16];
extern uint8_t seq_vel[10][16];
@ -52,6 +52,7 @@ extern int seq_transpose;
extern int seq_tempo_ms ;
extern int seq_bpm;
extern bool arp_play_basenote;
extern bool seq_running;
extern uint8_t arp_speed;
extern uint8_t arp_lenght;
extern uint8_t arp_style;
@ -433,7 +434,7 @@ bool load_sd_voiceconfig_json(int8_t vc, uint8_t instance_id)
if (sd_card > 0)
{
File json;
StaticJsonDocument<JSON_BUFFER_SIZE> data_json;
sprintf(filename, "/%s/%s%d.json", VOICE_CONFIG_PATH, VOICE_CONFIG_NAME, vc);
// first check if file exists...
@ -525,7 +526,7 @@ bool save_sd_voiceconfig_json(uint8_t vc, uint8_t instance_id)
if (sd_card > 0)
{
File json;
StaticJsonDocument<JSON_BUFFER_SIZE> data_json;
sprintf(filename, "/%s/%s%d.json", VOICE_CONFIG_PATH, VOICE_CONFIG_NAME, vc);
#ifdef DEBUG
@ -612,6 +613,7 @@ bool load_sd_fx_json(int8_t fx)
if (sd_card > 0)
{
File json;
StaticJsonDocument<JSON_BUFFER_SIZE> data_json;
char filename[FILENAME_LEN];
sprintf(filename, "/%s/%s%d.json", FX_CONFIG_PATH, FX_CONFIG_NAME, fx);
@ -704,7 +706,7 @@ bool save_sd_fx_json(uint8_t fx)
if (sd_card > 0)
{
File json;
StaticJsonDocument<JSON_BUFFER_SIZE> data_json;
sprintf(filename, "/%s/%s%d.json", FX_CONFIG_PATH, FX_CONFIG_NAME, fx);
#ifdef DEBUG
@ -781,6 +783,7 @@ bool load_sd_seq_drumsettings_json(uint8_t number)
if (sd_card > 0)
{
File json;
StaticJsonDocument<JSON_BUFFER_SIZE> data_json;
char filename[FILENAME_LEN];
sprintf(filename, "/%s/%s%d-d.json", SEQ_CONFIG_PATH, SEQ_CONFIG_NAME, number);
@ -849,7 +852,7 @@ bool save_sd_seq_drumsettings_json(uint8_t number)
if (sd_card > 0)
{
File json;
StaticJsonDocument<JSON_BUFFER_SIZE> data_json;
sprintf(filename, "/%s/%s%d-d.json", SEQ_CONFIG_PATH, SEQ_CONFIG_NAME, number);
#ifdef DEBUG
@ -905,7 +908,7 @@ bool save_sd_seq_json(uint8_t seq_number)
if (sd_card > 0)
{
File json;
StaticJsonDocument<JSON_BUFFER_SIZE> data_json;
sprintf(filename, "/%s/%s%d.json", SEQ_CONFIG_PATH, SEQ_CONFIG_NAME, seq_number);
#ifdef DEBUG
@ -977,6 +980,7 @@ bool save_sd_seq_json(uint8_t seq_number)
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;
data_json["performance"] = configuration.sys.performance_number;
for (uint8_t i = 0; i < sizeof(seq_track_type); i++) {
data_json["track_type"][i] = seq_track_type[i];
@ -1023,6 +1027,7 @@ bool load_sd_seq_json(uint8_t seq_number)
if (sd_card > 0)
{
File json;
StaticJsonDocument<JSON_BUFFER_SIZE> data_json;
char filename[FILENAME_LEN];
sprintf(filename, "/%s/%s%d.json", SEQ_CONFIG_PATH, SEQ_CONFIG_NAME, seq_number);
@ -1043,7 +1048,7 @@ bool load_sd_seq_json(uint8_t seq_number)
deserializeJson(data_json, json);
json.close();
AudioInterrupts();
#ifdef DEBUG
Serial.println(F("Read JSON data:"));
@ -1090,7 +1095,6 @@ bool load_sd_seq_json(uint8_t seq_number)
for (uint8_t i = 0; i < sizeof(seq_inst_dexed); i++) {
seq_inst_dexed[i] = data_json["seq_inst_dexed"][i];
}
count = 0;
seq_tempo_ms = data_json["seq_tempo_ms"] ;
seq_bpm = data_json["seq_bpm"];
@ -1105,10 +1109,15 @@ bool load_sd_seq_json(uint8_t seq_number)
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"];
configuration.sys.performance_number = data_json["performance"];
load_sd_performance_json(configuration.sys.performance_number);
if (seq_running)
timer1.begin(sequencer, seq_tempo_ms / 2);
else
timer1.begin(sequencer, seq_tempo_ms / 2, false);
return (true);
}
#ifdef DEBUG
else
@ -1135,7 +1144,7 @@ bool check_sd_seq_exists(uint8_t number)
return (false);
number = constrain(number, 0, 99);
AudioNoInterrupts();
if (sd_card > 0)
{
char filename[FILENAME_LEN];
@ -1143,14 +1152,20 @@ bool check_sd_seq_exists(uint8_t number)
sprintf(filename, "/%s/%s%d.json", SEQ_CONFIG_PATH, SEQ_CONFIG_NAME, number);
// check if file exists...
AudioNoInterrupts();
if (SD.exists(filename))
{
AudioInterrupts();
return (true);
} else return (false);
} else
return (false);
{
AudioInterrupts();
return (false);
}
} else
{ AudioInterrupts();
return (false);
}
}
/******************************************************************************
@ -1166,6 +1181,7 @@ bool load_sd_performance_json(int8_t p)
if (sd_card > 0)
{
File json;
StaticJsonDocument<JSON_BUFFER_SIZE> data_json;
char filename[FILENAME_LEN];
sprintf(filename, "/%s/%s%d.json", PERFORMANCE_CONFIG_PATH, PERFORMANCE_CONFIG_NAME, p);
@ -1239,11 +1255,12 @@ bool save_sd_performance_json(uint8_t p)
char filename[FILENAME_LEN];
p = constrain(p, 0, MAX_PERFORMANCE);
sprintf(filename, "/%s/%s%d.json", PERFORMANCE_CONFIG_PATH, PERFORMANCE_CONFIG_NAME, p);
if (sd_card > 0)
{
File json;
StaticJsonDocument<JSON_BUFFER_SIZE> data_json;
#ifdef DEBUG
Serial.print(F("Saving performance config as JSON"));
Serial.print(p);
@ -1262,7 +1279,8 @@ bool save_sd_performance_json(uint8_t p)
Serial.print(configuration.performance.fx_number);
Serial.println(F(" does not exists, creating one."));
#endif
save_sd_performance_json(configuration.performance.fx_number);
//save_sd_performance_json(configuration.performance.fx_number);
save_sd_fx_json(configuration.performance.fx_number);
}
for (uint8_t i = 0; i < MAX_DEXED; i++)
{

Loading…
Cancel
Save