Cleanup in configuraton struct.

pull/112/head
Holger Wirtz 3 years ago
parent 9a78c14a76
commit 9180cd4758
  1. 63
      MicroDexed.ino
  2. 278
      UI.hpp
  3. 10
      addon/SD/PERFORMANCE/0/sequencer.json
  4. 4
      addon/SD/PERFORMANCE/0/voice1.json
  5. 4
      addon/SD/PERFORMANCE/0/voice2.json
  6. 10
      addon/SD/PERFORMANCE/1/sequencer.json
  7. 4
      addon/SD/PERFORMANCE/1/voice1.json
  8. 4
      addon/SD/PERFORMANCE/1/voice2.json
  9. 10
      addon/SD/PERFORMANCE/2/sequencer.json
  10. 4
      addon/SD/PERFORMANCE/2/voice1.json
  11. 4
      addon/SD/PERFORMANCE/2/voice2.json
  12. 10
      addon/SD/PERFORMANCE/3/sequencer.json
  13. 4
      addon/SD/PERFORMANCE/3/voice1.json
  14. 4
      addon/SD/PERFORMANCE/3/voice2.json
  15. 10
      addon/SD/PERFORMANCE/4/sequencer.json
  16. 4
      addon/SD/PERFORMANCE/4/voice1.json
  17. 4
      addon/SD/PERFORMANCE/4/voice2.json
  18. 10
      addon/SD/PERFORMANCE/5/sequencer.json
  19. 4
      addon/SD/PERFORMANCE/5/voice1.json
  20. 4
      addon/SD/PERFORMANCE/5/voice2.json
  21. 10
      addon/SD/PERFORMANCE/6/sequencer.json
  22. 4
      addon/SD/PERFORMANCE/6/voice1.json
  23. 4
      addon/SD/PERFORMANCE/6/voice2.json
  24. 10
      addon/SD/PERFORMANCE/7/sequencer.json
  25. 4
      addon/SD/PERFORMANCE/7/voice1.json
  26. 4
      addon/SD/PERFORMANCE/7/voice2.json
  27. 10
      addon/SD/PERFORMANCE/8/sequencer.json
  28. 4
      addon/SD/PERFORMANCE/8/voice1.json
  29. 4
      addon/SD/PERFORMANCE/8/voice2.json
  30. 14
      config.h
  31. 192
      dexed_sd.cpp

@ -391,16 +391,17 @@ void setup()
#endif
#endif
#ifdef DEBUG
#if defined(DEBUG) && defined(TEENSY_4)
Serial.println(F("-------------------------------------------------------------------------------"));
Serial.println(F("Latest crash report:"));
Serial.println(CrashReport);
Serial.println(F("-------------------------------------------------------------------------------"));
#endif
setup_debug_message();
generate_version_string(version_string, sizeof(version_string));
#ifdef DEBUG
Serial.println(F("MicroDexed based on https://github.com/asb2m10/dexed"));
Serial.println(F("(c)2018-2021 H. Wirtz <wirtz@parasitstudio.de>"));
Serial.println(F("https://codeberg.org/dcoredump/MicroDexed"));
@ -557,7 +558,7 @@ void setup()
for (uint8_t instance_id = 0; instance_id < NUM_DEXED; instance_id++)
{
// load default SYSEX data
//load_sd_voice(configuration.performance.bank[instance_id], configuration.performance.voice[instance_id], instance_id);
//load_sd_voice(configuration.dexed[instance_id].bank, configuration.dexed[instance_id].voice, instance_id);
memset(g_voice_name[instance_id], 0, VOICE_NAME_LEN);
memset(g_bank_name[instance_id], 0, BANK_NAME_LEN);
memset(receive_bank_filename, 0, FILENAME_LEN);
@ -586,9 +587,9 @@ void setup()
Serial.print(instance_id);
Serial.println(F(":"));
Serial.print(F("Bank/Voice ["));
Serial.print(configuration.performance.bank[instance_id], DEC);
Serial.print(configuration.dexed[instance_id].bank, DEC);
Serial.print(F("/"));
Serial.print(configuration.performance.voice[instance_id], DEC);
Serial.print(configuration.dexed[instance_id].voice, DEC);
Serial.println(F("]"));
Serial.print(F("Polyphony: "));
Serial.println(configuration.dexed[instance_id].polyphony, DEC);
@ -1028,8 +1029,8 @@ void handleControlChange(byte inChannel, byte inCtrl, byte inValue)
#ifdef DEBUG
Serial.println(F("BANK-SELECT MSB CC"));
#endif
configuration.performance.bank[instance_id] = constrain((inValue << 7)&configuration.performance.bank[instance_id], 0, MAX_BANKS - 1);
/* load_sd_voice(configuration.performance.bank[instance_id], configuration.performance.voice[instance_id], instance_id);
configuration.dexed[instance_id].bank = constrain((inValue << 7)&configuration.dexed[instance_id].bank, 0, MAX_BANKS - 1);
/* load_sd_voice(configuration.dexed[instance_id].bank, configuration.dexed[instance_id].voice, instance_id);
if (LCDML.FUNC_getID() == LCDML.OTHER_getIDFromFunction(UI_func_voice_select))
{
LCDML.OTHER_updateFunc();
@ -1089,8 +1090,8 @@ void handleControlChange(byte inChannel, byte inCtrl, byte inValue)
#ifdef DEBUG
Serial.println(F("BANK-SELECT LSB CC"));
#endif
configuration.performance.bank[instance_id] = constrain(inValue, 0, MAX_BANKS - 1);
/*load_sd_voice(configuration.performance.bank[instance_id], configuration.performance.voice[instance_id], instance_id);
configuration.dexed[instance_id].bank = constrain(inValue, 0, MAX_BANKS - 1);
/*load_sd_voice(configuration.dexed[instance_id].bank, configuration.dexed[instance_id].voice, instance_id);
if (LCDML.FUNC_getID() == LCDML.OTHER_getIDFromFunction(UI_func_voice_select))
{
LCDML.OTHER_updateFunc();
@ -1250,11 +1251,11 @@ void handleProgramChange(byte inChannel, byte inProgram)
{
if (checkMidiChannel(inChannel, instance_id))
{
configuration.performance.voice[instance_id] = constrain(inProgram, 0, MAX_VOICES - 1);
configuration.dexed[instance_id].voice = constrain(inProgram, 0, MAX_VOICES - 1);
#ifdef DISPLAY_LCD_SPI
change_disp_sd(false);
#endif
load_sd_voice(configuration.performance.bank[instance_id], configuration.performance.voice[instance_id], instance_id);
load_sd_voice(configuration.dexed[instance_id].bank, configuration.dexed[instance_id].voice, instance_id);
#ifdef DISPLAY_LCD_SPI
change_disp_sd(true);
#endif
@ -1975,7 +1976,6 @@ void check_configuration(void)
{
check_configuration_sys();
check_configuration_fx();
check_configuration_performance();
for (uint8_t instance_id = 0; instance_id < NUM_DEXED; instance_id++)
check_configuration_dexed(instance_id);
}
@ -2028,20 +2028,10 @@ void check_configuration_fx(void)
configuration.fx.eq_7 = constrain(configuration.fx.eq_7, EQ_7_MIN, EQ_7_MAX);
}
void check_configuration_performance(void)
{
configuration.performance.fx_number = constrain(configuration.performance.fx_number, FX_CONFIG_MIN, FX_CONFIG_MAX);
for (uint8_t instance_id = 0; instance_id < NUM_DEXED; instance_id++)
{
configuration.performance.bank[instance_id] = constrain(configuration.performance.bank[instance_id], 0, MAX_BANKS - 1);
configuration.performance.voice[instance_id] = constrain(configuration.performance.voice[instance_id], 0, MAX_VOICES - 1);
configuration.performance.voiceconfig_number[instance_id] = constrain(configuration.performance.voiceconfig_number[instance_id], VOICE_CONFIG_MIN, VOICE_CONFIG_MAX);
}
}
void check_configuration_dexed(uint8_t instance_id)
{
configuration.dexed[instance_id].bank = constrain(configuration.dexed[instance_id].bank, 0, MAX_BANKS - 1);
configuration.dexed[instance_id].voice = constrain(configuration.dexed[instance_id].voice, 0, MAX_VOICES - 1);
configuration.dexed[instance_id].midi_channel = constrain(configuration.dexed[instance_id].midi_channel, MIDI_CHANNEL_MIN, MIDI_CHANNEL_MAX);
configuration.dexed[instance_id].lowest_note = constrain(configuration.dexed[instance_id].lowest_note, INSTANCE_LOWEST_NOTE_MIN, INSTANCE_LOWEST_NOTE_MAX);
configuration.dexed[instance_id].highest_note = constrain(configuration.dexed[instance_id].highest_note, INSTANCE_HIGHEST_NOTE_MIN, INSTANCE_HIGHEST_NOTE_MAX);
@ -2097,14 +2087,10 @@ void init_configuration(void)
configuration.fx.reverb_roomsize = REVERB_ROOMSIZE_DEFAULT;
configuration.fx.reverb_level = REVERB_LEVEL_DEFAULT;
configuration.performance.fx_number = FX_CONFIG_DEFAULT;
for (uint8_t instance_id = 0; instance_id < NUM_DEXED; instance_id++)
{
configuration.performance.bank[instance_id] = SYSEXBANK_DEFAULT;
configuration.performance.voice[instance_id] = SYSEXSOUND_DEFAULT;
configuration.performance.voiceconfig_number[instance_id] = VOICE_CONFIG_DEFAULT;
configuration.dexed[instance_id].bank = SYSEXBANK_DEFAULT;
configuration.dexed[instance_id].voice = SYSEXSOUND_DEFAULT;
configuration.dexed[instance_id].midi_channel = DEFAULT_MIDI_CHANNEL;
configuration.dexed[instance_id].lowest_note = INSTANCE_LOWEST_NOTE_MIN;
configuration.dexed[instance_id].highest_note = INSTANCE_HIGHEST_NOTE_MAX;
@ -2147,11 +2133,6 @@ void init_configuration(void)
configuration.fx.delay_sync[instance_id] = DELAY_SYNC_DEFAULT;
configuration.fx.reverb_send[instance_id] = REVERB_SEND_DEFAULT;
configuration.performance.bank[instance_id] = SYSEXBANK_DEFAULT;
configuration.performance.voice[instance_id] = SYSEXSOUND_DEFAULT;
configuration.dexed[instance_id].polyphony = POLYPHONY_DEFAULT;
MicroDexed[instance_id]->ControllersRefresh();
}
@ -2806,7 +2787,7 @@ void show_configuration(void)
Serial.print(F(" Reverb Lowpass ")); Serial.println(configuration.fx.reverb_lowpass, DEC);
Serial.print(F(" Reverb Lodamp ")); Serial.println(configuration.fx.reverb_lodamp, DEC);
Serial.print(F(" Reverb Hidamp ")); Serial.println(configuration.fx.reverb_hidamp, DEC);
Serial.print(F(" Reverb Diffusion ")); Serial.println(configuration.fx.reverb_diffusion, DEC);
Serial.print(F(" Reverb Diffusion ")); Serial.println(configuration.fx.reverb_diffusion, DEC);
#else
Serial.print(F(" Reverb Damping ")); Serial.println(configuration.fx.reverb_damping, DEC);
#endif
@ -2815,6 +2796,8 @@ void show_configuration(void)
{
Serial.print(F("Dexed instance "));
Serial.println(instance_id, DEC);
Serial.print(F(" Bank ")); Serial.println(configuration.dexed[instance_id].bank, DEC);
Serial.print(F(" Voice ")); Serial.println(configuration.dexed[instance_id].voice, DEC);
Serial.print(F(" MIDI-Channel ")); Serial.println(configuration.dexed[instance_id].midi_channel, DEC);
Serial.print(F(" Lowest Note ")); Serial.println(configuration.dexed[instance_id].lowest_note, DEC);
Serial.print(F(" Highest Note ")); Serial.println(configuration.dexed[instance_id].highest_note, DEC);
@ -2857,14 +2840,6 @@ void show_configuration(void)
Serial.flush();
}
Serial.println(F("Performance"));
for (uint8_t instance_id = 0; instance_id < NUM_DEXED; instance_id++)
{
Serial.print(F(" Bank ")); Serial.print(instance_id, DEC); Serial.print(" "); Serial.println(configuration.performance.bank[instance_id], DEC);
Serial.print(F(" Voice ")); Serial.print(instance_id, DEC); Serial.print(" "); Serial.println(configuration.performance.voice[instance_id], DEC);
}
Serial.print(F(" FX-Number ")); Serial.println(configuration.performance.fx_number, DEC);
Serial.println();
Serial.flush();
}

278
UI.hpp

@ -898,7 +898,7 @@ void lcdml_menu_control(void)
// when in Voice select Menu, long left-press sets/unsets favorite
if (LCDML.FUNC_getID() == LCDML.OTHER_getIDFromFunction(UI_func_voice_select))
save_favorite(configuration.performance.bank[selected_instance_id], configuration.performance.voice[selected_instance_id], selected_instance_id);
save_favorite(configuration.dexed[selected_instance_id].bank, configuration.dexed[selected_instance_id].voice, selected_instance_id);
// when not in Voice select Menu, long left-press starts/stops sequencer
else if (LCDML.FUNC_getID() != LCDML.OTHER_getIDFromFunction(UI_func_voice_select))
toggle_sequencer_play_status();
@ -6266,7 +6266,7 @@ void UI_func_save_performance(uint8_t param)
lcd.setCursor(0, 1);
sprintf(tmp, "[%2d]", temp_int);
lcd.print(tmp);
sprintf(tmp, "/%s/%d/%s.json", PERFORMANCE_CONFIG_PATH, temp_int, PERFORMANCE_CONFIG_NAME);
sprintf(tmp, "/%s/%d/%s.json", PERFORMANCE_CONFIG_PATH, temp_int, SEQUENCER_CONFIG_NAME);
if (SD.exists(tmp))
overwrite = true;
else
@ -6314,7 +6314,7 @@ void UI_func_save_performance(uint8_t param)
if (yesno == true)
{
char tmp[FILENAME_LEN];
sprintf(tmp, "/%s/%d/%s.json", PERFORMANCE_CONFIG_PATH, temp_int, PERFORMANCE_CONFIG_NAME);
sprintf(tmp, "/%s/%d/%s.json", PERFORMANCE_CONFIG_PATH, temp_int, SEQUENCER_CONFIG_NAME);
SD.remove(tmp);
}
lcd.show(1, 0, 16, "Done.");
@ -6336,7 +6336,7 @@ void UI_func_save_performance(uint8_t param)
if (mode == 0)
{
char tmp[FILENAME_LEN];
sprintf(tmp, "/%s/%d/%s.json", PERFORMANCE_CONFIG_PATH, temp_int, PERFORMANCE_CONFIG_NAME);
sprintf(tmp, "/%s/%d/%s.json", PERFORMANCE_CONFIG_PATH, temp_int, SEQUENCER_CONFIG_NAME);
if (SD.exists(tmp))
overwrite = true;
else
@ -6555,9 +6555,9 @@ void UI_func_voice_select(uint8_t param)
char bank_name[BANK_NAME_LEN];
char voice_name[VOICE_NAME_LEN];
if (!get_bank_name(configuration.performance.bank[selected_instance_id], bank_name, sizeof(bank_name)))
if (!get_bank_name(configuration.dexed[selected_instance_id].bank, bank_name, sizeof(bank_name)))
strcpy(bank_name, "*ERROR*");
if (!get_voice_by_bank_name(configuration.performance.bank[selected_instance_id], bank_name, configuration.performance.voice[selected_instance_id], voice_name, sizeof(voice_name)))
if (!get_voice_by_bank_name(configuration.dexed[selected_instance_id].bank, bank_name, configuration.dexed[selected_instance_id].voice, voice_name, sizeof(voice_name)))
strcpy(voice_name, "*ERROR*");
UI_update_instance_icons();
@ -6597,36 +6597,36 @@ void UI_func_voice_select(uint8_t param)
{
case MENU_VOICE_BANK:
memset(g_bank_name[selected_instance_id], 0, BANK_NAME_LEN);
bank_tmp = constrain(configuration.performance.bank[selected_instance_id] - ENCODER[ENC_R].speed(), 0, MAX_BANKS - 1);
configuration.performance.bank[selected_instance_id] = bank_tmp;
bank_tmp = constrain(configuration.dexed[selected_instance_id].bank - ENCODER[ENC_R].speed(), 0, MAX_BANKS - 1);
configuration.dexed[selected_instance_id].bank = bank_tmp;
#ifdef DISPLAY_LCD_SPI
change_disp_sd(false);
#endif
load_sd_voice(configuration.performance.bank[selected_instance_id], configuration.performance.voice[selected_instance_id], selected_instance_id);
load_sd_voice(configuration.dexed[selected_instance_id].bank, configuration.dexed[selected_instance_id].voice, selected_instance_id);
#ifdef DISPLAY_LCD_SPI
change_disp_sd(true);
#endif
break;
case MENU_VOICE_SOUND:
memset(g_voice_name[selected_instance_id], 0, VOICE_NAME_LEN);
voice_tmp = configuration.performance.voice[selected_instance_id] - ENCODER[ENC_R].speed();
if (voice_tmp < 0 && configuration.performance.bank[selected_instance_id] - 1 >= 0)
voice_tmp = configuration.dexed[selected_instance_id].voice - ENCODER[ENC_R].speed();
if (voice_tmp < 0 && configuration.dexed[selected_instance_id].voice - 1 >= 0)
{
configuration.performance.bank[selected_instance_id]--;
configuration.performance.bank[selected_instance_id] = constrain(configuration.performance.bank[selected_instance_id], 0, MAX_BANKS - 1);
configuration.dexed[selected_instance_id].voice--;
configuration.dexed[selected_instance_id].voice = constrain(configuration.dexed[selected_instance_id].voice, 0, MAX_BANKS - 1);
}
else if (voice_tmp < 0 && configuration.performance.bank[selected_instance_id] - 1 <= 0)
else if (voice_tmp < 0 && configuration.dexed[selected_instance_id].voice - 1 <= 0)
{
voice_tmp = 0;
}
if (voice_tmp < 0)
voice_tmp = MAX_VOICES + voice_tmp;
configuration.performance.voice[selected_instance_id] = constrain(voice_tmp, 0, MAX_VOICES - 1);
configuration.dexed[selected_instance_id].voice = constrain(voice_tmp, 0, MAX_VOICES - 1);
#ifdef DISPLAY_LCD_SPI
change_disp_sd(false);
#endif
load_sd_voice(configuration.performance.bank[selected_instance_id], configuration.performance.voice[selected_instance_id], selected_instance_id);
load_sd_voice(configuration.dexed[selected_instance_id].bank, configuration.dexed[selected_instance_id].voice, selected_instance_id);
#ifdef DISPLAY_LCD_SPI
change_disp_sd(true);
#endif
@ -6640,7 +6640,7 @@ void UI_func_voice_select(uint8_t param)
#ifdef DISPLAY_LCD_SPI
change_disp_sd(false);
#endif
load_sd_voice(configuration.performance.bank[selected_instance_id], configuration.performance.voice[selected_instance_id], selected_instance_id);
load_sd_voice(configuration.dexed[selected_instance_id].bank, configuration.dexed[selected_instance_id].voice, selected_instance_id);
#ifdef DISPLAY_LCD_SPI
change_disp_sd(true);
#endif
@ -6652,7 +6652,7 @@ void UI_func_voice_select(uint8_t param)
#ifdef DISPLAY_LCD_SPI
change_disp_sd(false);
#endif
load_sd_voice(configuration.performance.bank[selected_instance_id], configuration.performance.voice[selected_instance_id], selected_instance_id);
load_sd_voice(configuration.dexed[selected_instance_id].bank, configuration.dexed[selected_instance_id].voice, selected_instance_id);
#ifdef DISPLAY_LCD_SPI
change_disp_sd(true);
#endif
@ -6666,7 +6666,7 @@ void UI_func_voice_select(uint8_t param)
#ifdef DISPLAY_LCD_SPI
change_disp_sd(false);
#endif
load_sd_voice(configuration.performance.bank[selected_instance_id], configuration.performance.voice[selected_instance_id], selected_instance_id);
load_sd_voice(configuration.dexed[selected_instance_id].bank, configuration.dexed[selected_instance_id].voice, selected_instance_id);
#ifdef DISPLAY_LCD_SPI
change_disp_sd(true);
#endif
@ -6681,35 +6681,35 @@ void UI_func_voice_select(uint8_t param)
{
case MENU_VOICE_BANK:
memset(g_bank_name[selected_instance_id], 0, BANK_NAME_LEN);
bank_tmp = constrain(configuration.performance.bank[selected_instance_id] + ENCODER[ENC_R].speed(), 0, MAX_BANKS - 1);
configuration.performance.bank[selected_instance_id] = bank_tmp;
bank_tmp = constrain(configuration.dexed[selected_instance_id].bank + ENCODER[ENC_R].speed(), 0, MAX_BANKS - 1);
configuration.dexed[selected_instance_id].bank = bank_tmp;
#ifdef DISPLAY_LCD_SPI
change_disp_sd(false);
#endif
load_sd_voice(configuration.performance.bank[selected_instance_id], configuration.performance.voice[selected_instance_id], selected_instance_id);
load_sd_voice(configuration.dexed[selected_instance_id].bank, configuration.dexed[selected_instance_id].voice, selected_instance_id);
#ifdef DISPLAY_LCD_SPI
change_disp_sd(true);
#endif
break;
case MENU_VOICE_SOUND:
memset(g_voice_name[selected_instance_id], 0, VOICE_NAME_LEN);
voice_tmp = configuration.performance.voice[selected_instance_id] + ENCODER[ENC_R].speed();
if (voice_tmp >= MAX_VOICES && configuration.performance.bank[selected_instance_id] + 1 < MAX_BANKS)
voice_tmp = configuration.dexed[selected_instance_id].voice + ENCODER[ENC_R].speed();
if (voice_tmp >= MAX_VOICES && configuration.dexed[selected_instance_id].voice + 1 < MAX_BANKS)
{
voice_tmp %= MAX_VOICES;
configuration.performance.bank[selected_instance_id]++;
configuration.performance.bank[selected_instance_id] = constrain(configuration.performance.bank[selected_instance_id], 0, MAX_BANKS - 1);
configuration.dexed[selected_instance_id].voice++;
configuration.dexed[selected_instance_id].voice = constrain(configuration.dexed[selected_instance_id].voice, 0, MAX_BANKS - 1);
}
else if (voice_tmp >= MAX_VOICES && configuration.performance.bank[selected_instance_id] + 1 >= MAX_BANKS)
else if (voice_tmp >= MAX_VOICES && configuration.dexed[selected_instance_id].voice + 1 >= MAX_BANKS)
{
voice_tmp = MAX_VOICES - 1;
}
configuration.performance.voice[selected_instance_id] = constrain(voice_tmp, 0, MAX_VOICES - 1);
configuration.dexed[selected_instance_id].voice = constrain(voice_tmp, 0, MAX_VOICES - 1);
#ifdef DISPLAY_LCD_SPI
change_disp_sd(false);
#endif
load_sd_voice(configuration.performance.bank[selected_instance_id], configuration.performance.voice[selected_instance_id], selected_instance_id);
load_sd_voice(configuration.dexed[selected_instance_id].bank, configuration.dexed[selected_instance_id].voice, selected_instance_id);
#ifdef DISPLAY_LCD_SPI
change_disp_sd(true);
#endif
@ -6725,7 +6725,7 @@ void UI_func_voice_select(uint8_t param)
#ifdef DISPLAY_LCD_SPI
change_disp_sd(false);
#endif
load_sd_voice(configuration.performance.bank[selected_instance_id], configuration.performance.voice[selected_instance_id], selected_instance_id);
load_sd_voice(configuration.dexed[selected_instance_id].bank, configuration.dexed[selected_instance_id].voice, selected_instance_id);
#ifdef DISPLAY_LCD_SPI
change_disp_sd(true);
#endif
@ -6738,7 +6738,7 @@ void UI_func_voice_select(uint8_t param)
#ifdef DISPLAY_LCD_SPI
change_disp_sd(false);
#endif
load_sd_voice(configuration.performance.bank[selected_instance_id], configuration.performance.voice[selected_instance_id], selected_instance_id);
load_sd_voice(configuration.dexed[selected_instance_id].bank, configuration.dexed[selected_instance_id].voice, selected_instance_id);
#ifdef DISPLAY_LCD_SPI
change_disp_sd(true);
#endif
@ -6750,7 +6750,7 @@ void UI_func_voice_select(uint8_t param)
#ifdef DISPLAY_LCD_SPI
change_disp_sd(false);
#endif
load_sd_voice(configuration.performance.bank[selected_instance_id], configuration.performance.voice[selected_instance_id], selected_instance_id);
load_sd_voice(configuration.dexed[selected_instance_id].bank, configuration.dexed[selected_instance_id].voice, selected_instance_id);
#ifdef DISPLAY_LCD_SPI
change_disp_sd(true);
#endif
@ -6780,7 +6780,7 @@ void UI_func_voice_select(uint8_t param)
}
else
{
if (!get_bank_name(configuration.performance.bank[selected_instance_id], bank_name, sizeof(bank_name)))
if (!get_bank_name(configuration.dexed[selected_instance_id].bank, bank_name, sizeof(bank_name)))
strcpy(bank_name, "*ERROR*");
}
@ -6790,12 +6790,12 @@ void UI_func_voice_select(uint8_t param)
}
else
{
if (!get_voice_by_bank_name(configuration.performance.bank[selected_instance_id], bank_name, configuration.performance.voice[selected_instance_id], voice_name, sizeof(voice_name)))
if (!get_voice_by_bank_name(configuration.dexed[selected_instance_id].bank, bank_name, configuration.dexed[selected_instance_id].voice, voice_name, sizeof(voice_name)))
strcpy(voice_name, "*ERROR*");
}
lcd.show(0, 0, 2, configuration.performance.bank[selected_instance_id]);
lcd.show(1, 0, 2, configuration.performance.voice[selected_instance_id] + 1);
lcd.show(0, 0, 2, configuration.dexed[selected_instance_id].bank);
lcd.show(1, 0, 2, configuration.dexed[selected_instance_id].voice + 1);
#ifdef TESTDISPLAY20x4
string_toupper(bank_name);
lcd.show(0, 4, 8, bank_name);
@ -6839,7 +6839,7 @@ void UI_func_voice_select(uint8_t param)
break;
}
#endif
draw_favorite_icon(configuration.performance.bank[selected_instance_id], configuration.performance.voice[selected_instance_id], selected_instance_id);
draw_favorite_icon(configuration.dexed[selected_instance_id].bank, configuration.dexed[selected_instance_id].voice, selected_instance_id);
}
if (LCDML.FUNC_close()) // ****** STABLE END *********
{
@ -7047,12 +7047,12 @@ void UI_func_save_voice(uint8_t param)
#if NUM_DEXED == 1
char bank_name[BANK_NAME_LEN];
if (!get_bank_name(configuration.performance.bank[selected_instance_id], bank_name, sizeof(bank_name)))
if (!get_bank_name(configuration.dexed[selected_instance_id].bank, bank_name, sizeof(bank_name)))
strcpy(bank_name, "*ERROR*");
lcd.setCursor(0, 0);
lcd.print(F("Save to Bank"));
lcd.show(1, 0, 2, configuration.performance.bank[selected_instance_id]);
lcd.show(1, 0, 2, configuration.dexed[selected_instance_id].bank);
lcd.show(1, 3, 10, bank_name);
lcd.show(1, 2, 1, "[");
lcd.show(1, 13, 1, "]");
@ -7088,28 +7088,28 @@ void UI_func_save_voice(uint8_t param)
break;
case 1: // Bank selection
if (LCDML.BT_checkDown())
configuration.performance.bank[selected_instance_id] = constrain(configuration.performance.bank[selected_instance_id] + ENCODER[ENC_R].speed(), 0, MAX_BANKS - 1);
else if (LCDML.BT_checkUp() && configuration.performance.bank[selected_instance_id] > 0)
configuration.performance.bank[selected_instance_id] = constrain(configuration.performance.bank[selected_instance_id] - ENCODER[ENC_R].speed(), 0, MAX_BANKS - 1);
configuration.dexed[selected_instance_id].bank = constrain(configuration.dexed[selected_instance_id].bank + ENCODER[ENC_R].speed(), 0, MAX_BANKS - 1);
else if (LCDML.BT_checkUp() && configuration.dexed[selected_instance_id].voice > 0)
configuration.dexed[selected_instance_id].bank = constrain(configuration.dexed[selected_instance_id].bank - ENCODER[ENC_R].speed(), 0, MAX_BANKS - 1);
if (!get_bank_name(configuration.performance.bank[selected_instance_id], bank_name, sizeof(bank_name)))
if (!get_bank_name(configuration.dexed[selected_instance_id].bank, bank_name, sizeof(bank_name)))
strcpy(bank_name, "*ERROR*");
lcd.show(1, 0, 2, configuration.performance.bank[selected_instance_id]);
lcd.show(1, 0, 2, configuration.dexed[selected_instance_id].bank);
lcd.show(1, 3, 10, bank_name);
break;
case 2: // Voice selection
if (LCDML.BT_checkDown() && configuration.performance.voice[selected_instance_id] < MAX_VOICES - 1)
configuration.performance.voice[selected_instance_id] = constrain(configuration.performance.voice[selected_instance_id] + ENCODER[ENC_R].speed(), 0, MAX_VOICES - 1);
else if (LCDML.BT_checkUp() && configuration.performance.voice[selected_instance_id] > 0)
configuration.performance.voice[selected_instance_id] = constrain(configuration.performance.voice[selected_instance_id] - ENCODER[ENC_R].speed(), 0, MAX_VOICES - 1);
if (LCDML.BT_checkDown() && configuration.dexed[selected_instance_id].voice < MAX_VOICES - 1)
configuration.dexed[selected_instance_id].voice = constrain(configuration.dexed[selected_instance_id].voice + ENCODER[ENC_R].speed(), 0, MAX_VOICES - 1);
else if (LCDML.BT_checkUp() && configuration.dexed[selected_instance_id].voice > 0)
configuration.dexed[selected_instance_id].voice = constrain(configuration.dexed[selected_instance_id].voice - ENCODER[ENC_R].speed(), 0, MAX_VOICES - 1);
if (!get_bank_name(configuration.performance.bank[selected_instance_id], bank_name, sizeof(bank_name)))
if (!get_bank_name(configuration.dexed[selected_instance_id].bank, bank_name, sizeof(bank_name)))
strncpy(bank_name, "*ERROR*", sizeof(bank_name));
if (!get_voice_by_bank_name(configuration.performance.bank[selected_instance_id], bank_name, configuration.performance.voice[selected_instance_id], voice_name, sizeof(voice_name)))
if (!get_voice_by_bank_name(configuration.dexed[selected_instance_id].bank, bank_name, configuration.dexed[selected_instance_id].voice, voice_name, sizeof(voice_name)))
strncpy(voice_name, "*ERROR*", sizeof(voice_name));
lcd.show(1, 0, 2, configuration.performance.voice[selected_instance_id] + 1);
lcd.show(1, 0, 2, configuration.dexed[selected_instance_id].voice + 1);
lcd.show(1, 3, 10, voice_name);
break;
case 3: // Yes/No selection
@ -7132,24 +7132,24 @@ void UI_func_save_voice(uint8_t param)
switch (mode)
{
case 1:
if (!get_bank_name(configuration.performance.bank[selected_instance_id], bank_name, sizeof(bank_name)))
if (!get_bank_name(configuration.dexed[selected_instance_id].bank, bank_name, sizeof(bank_name)))
strncpy(bank_name, "*ERROR*", sizeof(bank_name));
lcd.setCursor(0, 0);
lcd.print(F("Save to Bank"));
lcd.show(1, 0, 2, configuration.performance.bank[selected_instance_id]);
lcd.show(1, 0, 2, configuration.dexed[selected_instance_id].bank);
lcd.show(1, 3, 10, bank_name);
lcd.show(1, 2, 2, " [");
lcd.show(1, 14, 1, "]");
break;
case 2:
if (!get_bank_name(configuration.performance.bank[selected_instance_id], bank_name, sizeof(bank_name)))
if (!get_bank_name(configuration.dexed[selected_instance_id].bank, bank_name, sizeof(bank_name)))
strncpy(bank_name, "*ERROR*", sizeof(bank_name));
if (!get_voice_by_bank_name(configuration.performance.bank[selected_instance_id], bank_name, configuration.performance.voice[selected_instance_id], voice_name, sizeof(voice_name)))
if (!get_voice_by_bank_name(configuration.dexed[selected_instance_id].bank, bank_name, configuration.dexed[selected_instance_id].voice, voice_name, sizeof(voice_name)))
strncpy(voice_name, "*ERROR*", sizeof(voice_name));
lcd.show(0, 0, 16, "Save to Bank");
lcd.show(0, 13, 2, configuration.performance.bank[selected_instance_id]);
lcd.show(1, 0, 2, configuration.performance.voice[selected_instance_id] + 1);
lcd.show(0, 13, 2, configuration.dexed[selected_instance_id].bank);
lcd.show(1, 0, 2, configuration.dexed[selected_instance_id].voice + 1);
lcd.show(1, 3, 10, voice_name);
break;
case 3:
@ -7161,14 +7161,14 @@ void UI_func_save_voice(uint8_t param)
if (yesno == true)
{
#ifdef DEBUG
bool ret = save_sd_voice(configuration.performance.bank[selected_instance_id], configuration.performance.voice[selected_instance_id], selected_instance_id);
bool ret = save_sd_voice(configuration.dexed[selected_instance_id].bank, configuration.dexed[selected_instance_id].voice, selected_instance_id);
if (ret == true)
Serial.println(F("Saving voice OK."));
else
Serial.println(F("Error while saving voice."));
#else
save_sd_voice(configuration.performance.bank[selected_instance_id], configuration.performance.voice[selected_instance_id], selected_instance_id);
save_sd_voice(configuration.dexed[selected_instance_id].bank, configuration.dexed[selected_instance_id].voice, selected_instance_id);
#endif
lcd.show(1, 0, 16, "Done.");
@ -7209,7 +7209,7 @@ void UI_func_sysex_receive_bank(uint8_t param)
yesno = false;
mode = 0;
bank_number = configuration.performance.bank[selected_instance_id];
bank_number = configuration.dexed[selected_instance_id].bank;
memset(receive_bank_filename, 0, sizeof(receive_bank_filename));
lcd.setCursor(0, 0);
@ -7218,7 +7218,7 @@ void UI_func_sysex_receive_bank(uint8_t param)
lcd.print(F("["));
lcd.setCursor(14, 1);
lcd.print(F("]"));
if (!get_bank_name(configuration.performance.bank[selected_instance_id], receive_bank_filename, sizeof(receive_bank_filename)))
if (!get_bank_name(configuration.dexed[selected_instance_id].bank, receive_bank_filename, sizeof(receive_bank_filename)))
strcpy(receive_bank_filename, "*ERROR*");
lcd.show(1, 0, 2, bank_number);
lcd.show(1, 3, 10, receive_bank_filename);
@ -7440,14 +7440,14 @@ void UI_func_sysex_send_bank(uint8_t param)
if (LCDML.FUNC_setup()) // ****** SETUP *********
{
encoderDir[ENC_R].reset();
bank_number = configuration.performance.bank[selected_instance_id];
bank_number = configuration.dexed[selected_instance_id].bank;
lcd.setCursor(0, 0);
lcd.print(F("MIDI Send Bank"));
if (!get_bank_name(configuration.performance.bank[selected_instance_id], bank_name, sizeof(bank_name)))
if (!get_bank_name(configuration.dexed[selected_instance_id].bank, bank_name, sizeof(bank_name)))
strncpy(bank_name, "*ERROR*", sizeof(bank_name));
lcd.show(1, 2, 1, "[");
lcd.show(1, 14, 1, "]");
lcd.show(1, 0, 2, configuration.performance.bank[selected_instance_id]);
lcd.show(1, 0, 2, configuration.dexed[selected_instance_id].bank);
lcd.show(1, 3, 10, bank_name);
}
@ -7547,8 +7547,8 @@ void UI_func_sysex_send_voice(uint8_t param)
{
encoderDir[ENC_R].reset();
mode = 0;
bank_number = configuration.performance.bank[selected_instance_id];
voice_number = configuration.performance.voice[selected_instance_id];
bank_number = configuration.dexed[selected_instance_id].bank;
voice_number = configuration.dexed[selected_instance_id].voice;
char bank_name[BANK_NAME_LEN];
@ -8686,23 +8686,23 @@ void locate_previous_non_favorite()
lcd.print("<SEARCHING");
do
{
if (configuration.performance.voice[selected_instance_id] == 0)
if (configuration.dexed[selected_instance_id].voice == 0)
{
configuration.performance.voice[selected_instance_id] = 32; //+1
if (configuration.performance.bank[selected_instance_id] < 1 )
configuration.performance.bank[selected_instance_id] = MAX_BANKS - 1;
configuration.dexed[selected_instance_id].voice = 32; //+1
if (configuration.dexed[selected_instance_id].bank < 1 )
configuration.dexed[selected_instance_id].bank = MAX_BANKS - 1;
do
{ //seek for previous bank
configuration.performance.bank[selected_instance_id]--;
if (configuration.performance.bank[selected_instance_id] < 1 )
configuration.performance.bank[selected_instance_id] = MAX_BANKS - 1;
configuration.dexed[selected_instance_id].bank--;
if (configuration.dexed[selected_instance_id].bank < 1 )
configuration.dexed[selected_instance_id].bank = MAX_BANKS - 1;
favsearcher++;
} while (quick_check_favorites_in_bank(configuration.performance.bank[selected_instance_id], selected_instance_id) == true && favsearcher < 132);
} while (quick_check_favorites_in_bank(configuration.dexed[selected_instance_id].bank, selected_instance_id) == true && favsearcher < 132);
}
configuration.performance.voice[selected_instance_id]--;
configuration.dexed[selected_instance_id].voice--;
favsearcher++;
} while (check_favorite(configuration.performance.bank[selected_instance_id], configuration.performance.voice[selected_instance_id],
} while (check_favorite(configuration.dexed[selected_instance_id].bank, configuration.dexed[selected_instance_id].voice,
selected_instance_id) == true && favsearcher < 170);
favsearcher = 0;
}
@ -8711,64 +8711,64 @@ void locate_previous_favorite()
{
// worst case, nothing found below voice 0 / bank 0 - start loop at last bank
if ( configuration.performance.voice[selected_instance_id] < 2 &&
configuration.performance.bank[selected_instance_id] == 0 && favsearcher < 170)
if ( configuration.dexed[selected_instance_id].voice < 2 &&
configuration.dexed[selected_instance_id].bank == 0 && favsearcher < 170)
{
configuration.performance.bank[selected_instance_id] = MAX_BANKS - 1;
configuration.performance.voice[selected_instance_id] = 32;
configuration.dexed[selected_instance_id].bank = MAX_BANKS - 1;
configuration.dexed[selected_instance_id].voice = 32;
} else
if (configuration.performance.voice[selected_instance_id] == 0 && configuration.performance.bank[selected_instance_id] < MAX_BANKS - 1 )
if (configuration.dexed[selected_instance_id].voice == 0 && configuration.dexed[selected_instance_id].bank < MAX_BANKS - 1 )
{ //if at begin of any other bank
configuration.performance.bank[selected_instance_id]--;
configuration.performance.voice[selected_instance_id] = 32;
configuration.dexed[selected_instance_id].bank--;
configuration.dexed[selected_instance_id].voice = 32;
}
if (configuration.performance.voice[selected_instance_id] >= 0 && configuration.performance.bank[selected_instance_id] >= 0) {
if (configuration.dexed[selected_instance_id].voice >= 0 && configuration.dexed[selected_instance_id].bank >= 0) {
lcd.setCursor(3, 0);
lcd.print("<SEARCHING");
do { //first find previous fav in current bank
if (configuration.performance.voice[selected_instance_id] == 0) {
if (configuration.dexed[selected_instance_id].voice == 0) {
if (configuration.performance.bank[selected_instance_id] == 0) {
configuration.performance.bank[selected_instance_id] = MAX_BANKS - 1;
configuration.performance.voice[selected_instance_id] = 32;
if (configuration.dexed[selected_instance_id].bank == 0) {
configuration.dexed[selected_instance_id].bank = MAX_BANKS - 1;
configuration.dexed[selected_instance_id].voice = 32;
} else
configuration.performance.bank[selected_instance_id]--;
configuration.performance.voice[selected_instance_id] = 32;
configuration.dexed[selected_instance_id].bank--;
configuration.dexed[selected_instance_id].voice = 32;
} else
configuration.performance.voice[selected_instance_id]--;
configuration.dexed[selected_instance_id].voice--;
favsearcher++;
} while ( check_favorite(configuration.performance.bank[selected_instance_id], configuration.performance.voice[selected_instance_id],
selected_instance_id) == false && configuration.performance.voice[selected_instance_id] >= 1 && favsearcher < 36);
} while ( check_favorite(configuration.dexed[selected_instance_id].bank, configuration.dexed[selected_instance_id].voice,
selected_instance_id) == false && configuration.dexed[selected_instance_id].voice >= 1 && favsearcher < 36);
// if found, we are done. else quick check in previous banks
if ( check_favorite(configuration.performance.bank[selected_instance_id], configuration.performance.voice[selected_instance_id],
selected_instance_id) == false && configuration.performance.voice[selected_instance_id] >= 0 &&
configuration.performance.bank[selected_instance_id] >= 0 && favsearcher < 170)
if ( check_favorite(configuration.dexed[selected_instance_id].bank, configuration.dexed[selected_instance_id].voice,
selected_instance_id) == false && configuration.dexed[selected_instance_id].voice >= 0 &&
configuration.dexed[selected_instance_id].bank >= 0 && favsearcher < 170)
{
configuration.performance.voice[selected_instance_id] = 32;
configuration.dexed[selected_instance_id].voice = 32;
do { //seek for previous bank
configuration.performance.bank[selected_instance_id]--;
configuration.dexed[selected_instance_id].bank--;
favsearcher++;
} while (quick_check_favorites_in_bank(configuration.performance.bank[selected_instance_id], selected_instance_id) == false &&
favsearcher < 132 && configuration.performance.bank[selected_instance_id] >= 0);
} while (quick_check_favorites_in_bank(configuration.dexed[selected_instance_id].bank, selected_instance_id) == false &&
favsearcher < 132 && configuration.dexed[selected_instance_id].bank >= 0);
do { //last try to search if a bank with fav was found
configuration.performance.voice[selected_instance_id]--;
configuration.dexed[selected_instance_id].voice--;
favsearcher++;
} while ( check_favorite(configuration.performance.bank[selected_instance_id], configuration.performance.voice[selected_instance_id],
selected_instance_id) == false && configuration.performance.voice[selected_instance_id] >= 1 && favsearcher < 170);
} while ( check_favorite(configuration.dexed[selected_instance_id].bank, configuration.dexed[selected_instance_id].voice,
selected_instance_id) == false && configuration.dexed[selected_instance_id].voice >= 1 && favsearcher < 170);
}
}
favsearcher = 0;
@ -8779,59 +8779,59 @@ void locate_next_favorite()
{
bool RollOver = false;
if (configuration.performance.voice[selected_instance_id] > 30 && configuration.performance.bank[selected_instance_id] >= MAX_BANKS - 1 )
if (configuration.dexed[selected_instance_id].voice > 30 && configuration.dexed[selected_instance_id].bank >= MAX_BANKS - 1 )
{ //if at end of all banks
configuration.performance.bank[selected_instance_id] = 0;
configuration.performance.voice[selected_instance_id] = 0;
configuration.dexed[selected_instance_id].bank = 0;
configuration.dexed[selected_instance_id].voice = 0;
RollOver = true;
} else if (configuration.performance.voice[selected_instance_id] > 30 && configuration.performance.bank[selected_instance_id] < MAX_BANKS - 1 )
} else if (configuration.dexed[selected_instance_id].voice > 30 && configuration.dexed[selected_instance_id].bank < MAX_BANKS - 1 )
{ //if at end of any other bank
configuration.performance.bank[selected_instance_id]++;
configuration.performance.voice[selected_instance_id] = 0;
configuration.dexed[selected_instance_id].bank++;
configuration.dexed[selected_instance_id].voice = 0;
}
if (configuration.performance.voice[selected_instance_id] <= 30 && configuration.performance.bank[selected_instance_id] <= MAX_BANKS ) {
if (configuration.dexed[selected_instance_id].voice <= 30 && configuration.dexed[selected_instance_id].bank <= MAX_BANKS ) {
lcd.setCursor(3, 0);
lcd.print(">SEARCHING");
do { //first find next fav in current bank
if (RollOver == false) configuration.performance.voice[selected_instance_id]++; else RollOver = true;
if (RollOver == false) configuration.dexed[selected_instance_id].voice++; else RollOver = true;
favsearcher++;
} while ( check_favorite(configuration.performance.bank[selected_instance_id], configuration.performance.voice[selected_instance_id],
selected_instance_id) == false && configuration.performance.voice[selected_instance_id] <= 32 && favsearcher < 36);
} while ( check_favorite(configuration.dexed[selected_instance_id].bank, configuration.dexed[selected_instance_id].voice,
selected_instance_id) == false && configuration.dexed[selected_instance_id].voice <= 32 && favsearcher < 36);
// if found, we are done. else quick check in next banks
if ( check_favorite(configuration.performance.bank[selected_instance_id], configuration.performance.voice[selected_instance_id],
if ( check_favorite(configuration.dexed[selected_instance_id].bank, configuration.dexed[selected_instance_id].voice,
selected_instance_id) == false &&
configuration.performance.bank[selected_instance_id] < MAX_BANKS && favsearcher < 170)
configuration.dexed[selected_instance_id].bank < MAX_BANKS && favsearcher < 170)
{
configuration.performance.voice[selected_instance_id] = 0;
configuration.dexed[selected_instance_id].voice = 0;
do { //seek in next bank
configuration.performance.bank[selected_instance_id]++;
if ( configuration.performance.bank[selected_instance_id] > MAX_BANKS - 1 && favsearcher < 190)
configuration.dexed[selected_instance_id].bank++;
if ( configuration.dexed[selected_instance_id].bank > MAX_BANKS - 1 && favsearcher < 190)
{
configuration.performance.bank[selected_instance_id] = 0;
configuration.performance.voice[selected_instance_id] = 0;
configuration.dexed[selected_instance_id].bank = 0;
configuration.dexed[selected_instance_id].voice = 0;
}
favsearcher++;
} while (quick_check_favorites_in_bank(configuration.performance.bank[selected_instance_id], selected_instance_id) == false &&
} while (quick_check_favorites_in_bank(configuration.dexed[selected_instance_id].bank, selected_instance_id) == false &&
favsearcher < 132 );
if ( check_favorite(configuration.performance.bank[selected_instance_id], configuration.performance.voice[selected_instance_id],
selected_instance_id) == false && configuration.performance.voice[selected_instance_id] <= 32 && favsearcher < 190)
if ( check_favorite(configuration.dexed[selected_instance_id].bank, configuration.dexed[selected_instance_id].voice,
selected_instance_id) == false && configuration.dexed[selected_instance_id].voice <= 32 && favsearcher < 190)
{
do { //last bank to search if a fav can be found
configuration.performance.voice[selected_instance_id]++;
configuration.dexed[selected_instance_id].voice++;
favsearcher++;
} while ( check_favorite(configuration.performance.bank[selected_instance_id], configuration.performance.voice[selected_instance_id],
} while ( check_favorite(configuration.dexed[selected_instance_id].bank, configuration.dexed[selected_instance_id].voice,
selected_instance_id) == false && favsearcher < 170);
}
}
@ -8846,21 +8846,21 @@ void locate_next_non_favorite()
lcd.setCursor(3, 0);
lcd.print(">SEARCHING");
do {
configuration.performance.voice[selected_instance_id]++;
if (configuration.performance.voice[selected_instance_id] > 31) {
configuration.performance.voice[selected_instance_id] = 0;
//configuration.performance.bank[selected_instance_id]++;
if (configuration.performance.bank[selected_instance_id] > MAX_BANKS - 1)
configuration.performance.bank[selected_instance_id] = 0;
configuration.dexed[selected_instance_id].voice++;
if (configuration.dexed[selected_instance_id].voice > 31) {
configuration.dexed[selected_instance_id].voice = 0;
//configuration.dexed[selected_instance_id].bank++;
if (configuration.dexed[selected_instance_id].bank > MAX_BANKS - 1)
configuration.dexed[selected_instance_id].bank = 0;
do { //seek for next bank
configuration.performance.bank[selected_instance_id]++;
if (configuration.performance.bank[selected_instance_id] > MAX_BANKS - 1)
configuration.performance.bank[selected_instance_id] = 0;
configuration.dexed[selected_instance_id].bank++;
if (configuration.dexed[selected_instance_id].bank > MAX_BANKS - 1)
configuration.dexed[selected_instance_id].bank = 0;
favsearcher++;
} while (quick_check_favorites_in_bank(configuration.performance.bank[selected_instance_id], selected_instance_id) == true && favsearcher < 132);
} while (quick_check_favorites_in_bank(configuration.dexed[selected_instance_id].bank, selected_instance_id) == true && favsearcher < 132);
}
favsearcher++;
} while ( check_favorite(configuration.performance.bank[selected_instance_id], configuration.performance.voice[selected_instance_id],
} while ( check_favorite(configuration.dexed[selected_instance_id].bank, configuration.dexed[selected_instance_id].voice,
selected_instance_id) == true && favsearcher < 170);
favsearcher = 0;
}
@ -8870,10 +8870,10 @@ void locate_random_non_favorite()
//find random non-fav
do
{
configuration.performance.voice[selected_instance_id] = random(32);
configuration.performance.bank[selected_instance_id] = random(MAX_BANKS - 1);
configuration.dexed[selected_instance_id].voice = random(32);
configuration.dexed[selected_instance_id].bank = random(MAX_BANKS - 1);
favsearcher++;
} while ( check_favorite(configuration.performance.bank[selected_instance_id], configuration.performance.voice[selected_instance_id],
} while ( check_favorite(configuration.dexed[selected_instance_id].bank, configuration.dexed[selected_instance_id].voice,
selected_instance_id) == true && favsearcher < 100);
favsearcher = 0;
}

@ -38,14 +38,6 @@
"chord_key_ammount": 4,
"seq_oct_shift": 0,
"seq_element_shift": 0,
"bank": [
18,
63
],
"voice": [
11,
2
],
"track_type": [
0,
0,
@ -113,4 +105,4 @@
0,
0
]
}
}

@ -1,4 +1,6 @@
{
"bank": 18,
"voice": 11,
"lowest_note": 21,
"highest_note": 108,
"transpose": 24,
@ -28,4 +30,4 @@
"portamento_time": 0,
"op_enabled": 63,
"midi_channel": 6
}
}

@ -1,4 +1,6 @@
{
"bank": 63,
"voice": 2,
"lowest_note": 21,
"highest_note": 108,
"transpose": 12,
@ -28,4 +30,4 @@
"portamento_time": 0,
"op_enabled": 63,
"midi_channel": 5
}
}

@ -38,14 +38,6 @@
"chord_key_ammount": 6,
"seq_oct_shift": -1,
"seq_element_shift": 3,
"bank": [
90,
69
],
"voice": [
8,
30
],
"track_type": [
0,
0,
@ -113,4 +105,4 @@
0,
0
]
}
}

@ -1,4 +1,6 @@
{
"bank": 90,
"voice": 8,
"lowest_note": 21,
"highest_note": 108,
"transpose": 24,
@ -28,4 +30,4 @@
"portamento_time": 0,
"op_enabled": 63,
"midi_channel": 5
}
}

@ -1,4 +1,6 @@
{
"bank": 69,
"voice": 30,
"lowest_note": 21,
"highest_note": 108,
"transpose": 24,
@ -28,4 +30,4 @@
"portamento_time": 0,
"op_enabled": 63,
"midi_channel": 6
}
}

@ -38,14 +38,6 @@
"chord_key_ammount": 4,
"seq_oct_shift": -1,
"seq_element_shift": 3,
"bank": [
4,
90
],
"voice": [
7,
16
],
"track_type": [
0,
0,
@ -113,4 +105,4 @@
0,
0
]
}
}

@ -1,4 +1,6 @@
{
"bank": 4,
"voice": 7,
"lowest_note": 21,
"highest_note": 108,
"transpose": 36,
@ -28,4 +30,4 @@
"portamento_time": 0,
"op_enabled": 63,
"midi_channel": 5
}
}

@ -1,4 +1,6 @@
{
"bank": 90,
"voice": 16,
"lowest_note": 21,
"highest_note": 108,
"transpose": 24,
@ -28,4 +30,4 @@
"portamento_time": 0,
"op_enabled": 63,
"midi_channel": 6
}
}

@ -38,14 +38,6 @@
"chord_key_ammount": 4,
"seq_oct_shift": -1,
"seq_element_shift": 3,
"bank": [
30,
30
],
"voice": [
21,
21
],
"track_type": [
0,
0,
@ -113,4 +105,4 @@
0,
0
]
}
}

@ -1,4 +1,6 @@
{
"bank": 30,
"voice": 21,
"lowest_note": 21,
"highest_note": 108,
"transpose": 24,
@ -28,4 +30,4 @@
"portamento_time": 0,
"op_enabled": 63,
"midi_channel": 5
}
}

@ -1,4 +1,6 @@
{
"bank": 30,
"voice": 21,
"lowest_note": 21,
"highest_note": 108,
"transpose": 24,
@ -28,4 +30,4 @@
"portamento_time": 0,
"op_enabled": 63,
"midi_channel": 6
}
}

@ -38,14 +38,6 @@
"chord_key_ammount": 4,
"seq_oct_shift": 0,
"seq_element_shift": 0,
"bank": [
63,
25
],
"voice": [
2,
2
],
"track_type": [
0,
0,
@ -113,4 +105,4 @@
0,
0
]
}
}

@ -1,4 +1,6 @@
{
"bank": 63,
"voice": 2,
"lowest_note": 21,
"highest_note": 108,
"transpose": 24,
@ -28,4 +30,4 @@
"portamento_time": 0,
"op_enabled": 63,
"midi_channel": 2
}
}

@ -1,4 +1,6 @@
{
"bank": 25,
"voice": 2,
"lowest_note": 21,
"highest_note": 108,
"transpose": 24,
@ -28,4 +30,4 @@
"portamento_time": 0,
"op_enabled": 63,
"midi_channel": 3
}
}

@ -38,14 +38,6 @@
"chord_key_ammount": 4,
"seq_oct_shift": -1,
"seq_element_shift": 3,
"bank": [
32,
30
],
"voice": [
21,
25
],
"track_type": [
0,
0,
@ -113,4 +105,4 @@
0,
0
]
}
}

@ -1,4 +1,6 @@
{
"bank": 32,
"voice": 21,
"lowest_note": 21,
"highest_note": 108,
"transpose": 12,
@ -28,4 +30,4 @@
"portamento_time": 0,
"op_enabled": 63,
"midi_channel": 5
}
}

@ -1,4 +1,6 @@
{
"bank": 30,
"voice": 25,
"lowest_note": 21,
"highest_note": 108,
"transpose": 24,
@ -28,4 +30,4 @@
"portamento_time": 0,
"op_enabled": 63,
"midi_channel": 6
}
}

@ -38,14 +38,6 @@
"chord_key_ammount": 4,
"seq_oct_shift": 0,
"seq_element_shift": 0,
"bank": [
63,
91
],
"voice": [
2,
27
],
"track_type": [
0,
0,
@ -113,4 +105,4 @@
0,
0
]
}
}

@ -1,4 +1,6 @@
{
"bank": 63,
"voice": 2,
"lowest_note": 21,
"highest_note": 108,
"transpose": 24,
@ -28,4 +30,4 @@
"portamento_time": 0,
"op_enabled": 63,
"midi_channel": 5
}
}

@ -1,4 +1,6 @@
{
"bank": 91,
"voice": 27,
"lowest_note": 21,
"highest_note": 108,
"transpose": 24,
@ -28,4 +30,4 @@
"portamento_time": 0,
"op_enabled": 63,
"midi_channel": 6
}
}

@ -38,14 +38,6 @@
"chord_key_ammount": 4,
"seq_oct_shift": 0,
"seq_element_shift": 0,
"bank": [
86,
91
],
"voice": [
27,
27
],
"track_type": [
0,
0,
@ -113,4 +105,4 @@
0,
0
]
}
}

@ -1,4 +1,6 @@
{
"bank": 86,
"voice": 27,
"lowest_note": 21,
"highest_note": 108,
"transpose": 24,
@ -28,4 +30,4 @@
"portamento_time": 0,
"op_enabled": 63,
"midi_channel": 5
}
}

@ -1,4 +1,6 @@
{
"bank": 91,
"voice": 27,
"lowest_note": 21,
"highest_note": 108,
"transpose": 24,
@ -28,4 +30,4 @@
"portamento_time": 0,
"op_enabled": 63,
"midi_channel": 6
}
}

@ -38,14 +38,6 @@
"chord_key_ammount": 4,
"seq_oct_shift": 0,
"seq_element_shift": 0,
"bank": [
61,
91
],
"voice": [
27,
27
],
"track_type": [
0,
1,
@ -113,4 +105,4 @@
0,
0
]
}
}

@ -1,4 +1,6 @@
{
"bank": 61,
"voice": 27,
"lowest_note": 21,
"highest_note": 108,
"transpose": 24,
@ -28,4 +30,4 @@
"portamento_time": 0,
"op_enabled": 63,
"midi_channel": 5
}
}

@ -1,4 +1,6 @@
{
"bank": 91,
"voice": 27,
"lowest_note": 21,
"highest_note": 108,
"transpose": 24,
@ -28,4 +30,4 @@
"portamento_time": 0,
"op_enabled": 63,
"midi_channel": 6
}
}

@ -318,7 +318,7 @@
#define FAV_CONFIG_NAME "FAVCFG"
#define PERFORMANCE_CONFIG_PATH "PERFORMANCE"
#define PERFORMANCE_CONFIG_NAME "performance"
#define SEQUENCER_CONFIG_NAME "sequencer"
#define DRUMS_CONFIG_NAME "drums"
#define PATTERN_CONFIG_NAME "patterns"
#define VELOCITY_CONFIG_NAME "velocity"
@ -690,6 +690,8 @@
// Internal configuration structure
typedef struct dexed_s {
uint8_t bank;
uint8_t voice;
uint8_t lowest_note;
uint8_t highest_note;
uint8_t transpose;
@ -749,13 +751,6 @@ typedef struct fx_s {
uint8_t eq_7;
} fx_t;
typedef struct performance_s {
uint8_t bank[MAX_DEXED];
uint8_t voice[MAX_DEXED];
int8_t voiceconfig_number[MAX_DEXED];
int8_t fx_number;
} performance_t;
typedef struct sys_s {
uint8_t vol;
uint8_t mono;
@ -767,9 +762,8 @@ typedef struct sys_s {
typedef struct configuration_s {
sys_t sys;
fx_t fx;
performance_t performance;
dexed_t dexed[MAX_DEXED];
fx_t fx;
} config_t;
#if !defined(_MAPFLOAT)

@ -118,10 +118,12 @@ bool load_sd_voice(uint8_t b, uint8_t v, uint8_t instance_id)
show_patch(instance_id);
#endif
configuration.dexed[instance_id].transpose = MicroDexed[instance_id]->getTranspose();
AudioNoInterrupts();
sysex.close();
AudioInterrupts();
configuration.dexed[instance_id].transpose = MicroDexed[instance_id]->getTranspose();
configuration.dexed[instance_id].bank = b;
configuration.dexed[instance_id].voice = v;
uint8_t data_copy[155];
MicroDexed[instance_id]->getVoiceData(data_copy);
@ -619,6 +621,8 @@ bool load_sd_voiceconfig_json(uint8_t vc, uint8_t instance_id)
serializeJsonPretty(data_json, Serial);
Serial.println();
#endif
configuration.dexed[instance_id].bank = data_json["bank"];
configuration.dexed[instance_id].voice = data_json["voice"];
configuration.dexed[instance_id].lowest_note = data_json["lowest_note"];
configuration.dexed[instance_id].highest_note = data_json["highest_note"];
configuration.dexed[instance_id].transpose = data_json["transpose"];
@ -703,6 +707,8 @@ bool save_sd_voiceconfig_json(uint8_t vc, uint8_t instance_id)
json = SD.open(filename, FILE_WRITE);
if (json)
{
data_json["bank"] = configuration.dexed[instance_id].bank;
data_json["voice"] = configuration.dexed[instance_id].voice;
data_json["lowest_note"] = configuration.dexed[instance_id].lowest_note;
data_json["highest_note"] = configuration.dexed[instance_id].highest_note;
data_json["transpose"] = configuration.dexed[instance_id].transpose;
@ -1210,9 +1216,9 @@ bool save_sd_performance_json(uint8_t seq_number)
{
File json;
StaticJsonDocument<JSON_BUFFER_SIZE> data_json;
sprintf(filename, "/%s/%d/%s.json", PERFORMANCE_CONFIG_PATH, seq_number, PERFORMANCE_CONFIG_NAME);
sprintf(filename, "/%s/%d/%s.json", PERFORMANCE_CONFIG_PATH, seq_number, SEQUENCER_CONFIG_NAME);
#ifdef DEBUG
Serial.print(F("Saving performance config "));
Serial.print(F("Saving sequencer config "));
Serial.print(seq_number);
Serial.print(F(" to "));
Serial.println(filename);
@ -1252,11 +1258,6 @@ bool save_sd_performance_json(uint8_t seq_number)
data_json["chord_key_ammount"] = seq.seq_chord_key_ammount;
data_json["seq_oct_shift"] = seq.seq_oct_shift;
data_json["seq_element_shift"] = seq.seq_element_shift;
for (uint8_t i = 0; i < MAX_DEXED; i++)
{
data_json["bank"][i] = configuration.performance.bank[i];
data_json["voice"][i] = configuration.performance.voice[i];
}
for (uint8_t i = 0; i < sizeof(seq.seq_track_type); i++) {
data_json["track_type"][i] = seq.seq_track_type[i];
}
@ -1347,7 +1348,7 @@ void get_sd_performance_name_json(uint8_t seq_number)
StaticJsonDocument<JSON_BUFFER_SIZE> data_json;
char filename[CONFIG_FILENAME_LEN];
sprintf(filename, "/%s/%d/%s.json", PERFORMANCE_CONFIG_PATH, seq_number, PERFORMANCE_CONFIG_NAME);
sprintf(filename, "/%s/%d/%s.json", PERFORMANCE_CONFIG_PATH, seq_number, SEQUENCER_CONFIG_NAME);
// first check if file exists...
AudioNoInterrupts();
@ -1533,7 +1534,7 @@ bool load_sd_performance_json(uint8_t seq_number)
File json;
StaticJsonDocument<JSON_BUFFER_SIZE> data_json;
char filename[CONFIG_FILENAME_LEN];
sprintf(filename, "/%s/%d/%s.json", PERFORMANCE_CONFIG_PATH, seq_number, PERFORMANCE_CONFIG_NAME);
sprintf(filename, "/%s/%d/%s.json", PERFORMANCE_CONFIG_PATH, seq_number, SEQUENCER_CONFIG_NAME);
// first check if file exists...
if (SD.exists(filename))
{
@ -1603,17 +1604,15 @@ bool load_sd_performance_json(uint8_t seq_number)
seq.seq_element_shift = data_json["seq_element_shift"];
for (uint8_t instance_id = 0; instance_id < NUM_DEXED; instance_id++)
{
configuration.performance.bank[instance_id] = data_json["bank"][instance_id];
configuration.performance.voice[instance_id] = data_json["voice"][instance_id];
load_sd_voice(configuration.performance.bank[instance_id], configuration.performance.voice[instance_id], instance_id);
load_sd_voiceconfig_json(seq_number, instance_id);
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("Load Voice-Config "));
Serial.print(instance_id + 1);
Serial.print(F(" for sequencer"));
#endif
load_sd_voiceconfig_json(seq_number, instance_id);
load_sd_voice(configuration.dexed[instance_id].bank, configuration.dexed[instance_id].voice, instance_id);
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();
}
/* for (uint8_t instance_id = 0; instance_id < NUM_DEXED; instance_id++)
set_voiceconfig_params(instance_id);
@ -1663,7 +1662,7 @@ bool check_sd_performance_exists(uint8_t number)
{
char filename[CONFIG_FILENAME_LEN];
sprintf(filename, "/%s/%d/%s.json", PERFORMANCE_CONFIG_PATH, number, PERFORMANCE_CONFIG_NAME);
sprintf(filename, "/%s/%d/%s.json", PERFORMANCE_CONFIG_PATH, number, SEQUENCER_CONFIG_NAME);
// check if file exists...
if (SD.exists(filename))
@ -1683,165 +1682,6 @@ bool check_sd_performance_exists(uint8_t number)
}
}
/******************************************************************************
SD PERFORMANCE
******************************************************************************/
/*
bool load_sd_performance_json(uint8_t p)
{
if (p < 0)
return (false);
p = constrain(p, 0, MAX_PERFORMANCE);
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, p, PERFORMANCE_CONFIG_NAME);
// first check if file exists...
AudioNoInterrupts();
if (SD.exists(filename))
{
// ... and if: load
#ifdef DEBUG
Serial.print(F("Found performance configuration ["));
Serial.print(filename);
Serial.println(F("]... loading..."));
#endif
json = SD.open(filename);
if (json)
{
deserializeJson(data_json, json);
json.close();
AudioInterrupts();
check_configuration_performance();
#ifdef DEBUG
Serial.println(F("Read JSON data:"));
serializeJsonPretty(data_json, Serial);
Serial.println();
#endif
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];
configuration.performance.voiceconfig_number[i] = data_json["voiceconfig_number"][i];
}
configuration.performance.fx_number = data_json["fx_number"];
for (uint8_t instance_id = 0; instance_id < NUM_DEXED; instance_id++)
{
load_sd_voice(configuration.performance.bank[instance_id], configuration.performance.voice[instance_id], instance_id);
load_sd_voiceconfig_json(configuration.performance.voiceconfig_number[instance_id], instance_id);
MicroDexed[instance_id]->ControllersRefresh();
MicroDexed[instance_id]->panic();
}
load_sd_fx_json(configuration.performance.fx_number, 0);
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_performance_json(uint8_t p)
{
char filename[CONFIG_FILENAME_LEN];
p = constrain(p, 0, MAX_PERFORMANCE);
sprintf(filename, "/%s/%d/%s.json", PERFORMANCE_CONFIG_PATH, p, PERFORMANCE_CONFIG_NAME);
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);
Serial.print(F(" to "));
Serial.println(filename);
#endif
AudioNoInterrupts();
// Check if voice- and fx-config exist. If not, save the actual state
sprintf(filename, "/%s/%s%d.json", FX_CONFIG_PATH, FX_CONFIG_NAME, configuration.performance.fx_number);
if (!SD.exists(filename))
{
#ifdef DEBUG
Serial.print(F("FX-Config "));
Serial.print(configuration.performance.fx_number);
Serial.println(F(" does not exists, creating one."));
#endif
save_sd_fx_json(configuration.performance.fx_number, 0);
}
for (uint8_t i = 0; i < MAX_DEXED; i++)
{ sprintf(filename, "/%s/%s%d.json", VOICE_CONFIG_PATH, VOICE_CONFIG_NAME, configuration.performance.voiceconfig_number[i]);
if (!SD.exists(filename))
{
#ifdef DEBUG
Serial.print(F("Voice-Config "));
Serial.print(configuration.performance.voiceconfig_number[i]);
Serial.println(F(" does not exists, creating one."));
#endif
save_sd_voiceconfig_json(configuration.performance.voiceconfig_number[i], i, 0);
}
}
sprintf(filename, "/%s/%d/%s.json", PERFORMANCE_CONFIG_PATH, PERFORMANCE_CONFIG_NAME, p);
json = SD.open(filename, FILE_WRITE);
if (json)
{
for (uint8_t i = 0; i < MAX_DEXED; i++)
{
data_json["bank"][i] = configuration.performance.bank[i];
data_json["voice"][i] = configuration.performance.voice[i];
data_json["voiceconfig_number"][i] = configuration.performance.voiceconfig_number[i];
}
data_json["fx_number"] = configuration.performance.fx_number;
#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);
}
*/
/******************************************************************************
HELPER FUNCTIONS
******************************************************************************/

Loading…
Cancel
Save