Added UI functions for load/save performance/fx.

pull/32/head
Holger Wirtz 5 years ago
parent 862ed77428
commit 464668b518
  1. 1
      MicroDexed.ino
  2. 383
      UI.hpp
  3. 29
      UI_1_FX.h
  4. 7
      config.h

@ -1400,6 +1400,7 @@ void init_configuration(void)
configuration.sys.vol = VOLUME_DEFAULT;
configuration.sys.mono = MONO_DEFAULT;
configuration.sys.soft_midi_thru = SOFT_MIDI_THRU_DEFAULT;
configuration.sys.performance_number = PERFORMANCE_NUM_DEFAULT;
configuration.fx.checksum = 0xffff;
configuration.fx.reverb_roomsize = REVERB_ROOMSIZE_DEFAULT;

383
UI.hpp

@ -205,11 +205,14 @@ void UI_func_information(uint8_t param);
void UI_func_volume(uint8_t param);
void UI_func_load_performance(uint8_t param);
void UI_func_save_performance(uint8_t param);
void UI_func_save_config(uint8_t param);
void UI_func_save_config_default(uint8_t param);
void UI_func_load_voiceconfig(uint8_t param);
void UI_func_save_voiceconfig(uint8_t param);
void UI_func_save_voice(uint8_t param);
void UI_func_load_fx(uint8_t param);
void UI_func_save_fx(uint8_t param);
void UI_func_eeprom_reset(uint8_t param);
void UI_func_midi_soft_thru(uint8_t param);
void UI_func_velocity_level(uint8_t param);
void UI_func_eeprom_reset(uint8_t param);
void UI_func_voice_select(uint8_t param);
void UI_func_sysex_send_voice(uint8_t param);
void UI_func_sysex_receive_voice(uint8_t param);
@ -3172,7 +3175,14 @@ void UI_func_load_performance(uint8_t param)
lcd.setCursor(0, 0);
lcd.print(F("Load Perf. SD"));
lcd.setCursor(0, 1);
lcd.print(F("Not implemented."));
if (configuration.sys.performance_number == 0)
lcd.print(F("[DEFAULT]"));
else
{
char tmp[10];
sprintf(tmp, "[%7d]", configuration.sys.performance_number);
lcd.print(tmp);
}
}
if (LCDML.FUNC_loop()) // ****** LOOP *********
@ -3181,11 +3191,21 @@ void UI_func_load_performance(uint8_t param)
{
if (LCDML.BT_checkDown())
{
;
configuration.sys.performance_number = constrain(configuration.sys.performance_number + ENCODER[ENC_L].speed(), PERFORMANCE_NUM_MIN, PERFORMANCE_NUM_MAX);
}
else if (LCDML.BT_checkUp())
{
;
configuration.sys.performance_number = constrain(configuration.sys.performance_number - ENCODER[ENC_L].speed(), PERFORMANCE_NUM_MIN, PERFORMANCE_NUM_MAX);
}
lcd.setCursor(0, 1);
if (configuration.sys.performance_number == 0)
lcd.print(F("[DEFAULT]"));
else
{
char tmp[10];
sprintf(tmp, "[%7d]", configuration.sys.performance_number);
lcd.print(tmp);
}
}
}
@ -3193,45 +3213,125 @@ void UI_func_load_performance(uint8_t param)
if (LCDML.FUNC_close()) // ****** STABLE END *********
{
eeprom_write();
load_sd_performance(configuration.sys.performance_number);
lcd.setCursor(0, 1);
lcd.print("Done. ");
delay(500);
encoderDir[ENC_R].reset();
}
}
void UI_func_save_performance(uint8_t param)
{
static bool overwrite;
static bool yesno;
static uint8_t mode;
if (LCDML.FUNC_setup()) // ****** SETUP *********
{
yesno = false;
mode = 0;
encoderDir[ENC_R].reset();
lcd.setCursor(0, 0);
lcd.print(F("Save Perf. SD"));
lcd.setCursor(0, 1);
lcd.print(F("Not implemented."));
if (configuration.sys.performance_number == 0)
lcd.print(F("[DEFAULT]"));
else
{
char tmp[10];
sprintf(tmp, "[%7d]", configuration.sys.performance_number);
lcd.print(tmp);
}
char tmp[FILENAME_LEN];
sprintf(tmp, "/%s%d.syx", PERFORMANCE_CONFIG_NAME, configuration.sys.performance_number);
if (SD.exists(tmp))
overwrite = true;
else
overwrite = false;
}
if (LCDML.FUNC_loop()) // ****** LOOP *********
{
if ((LCDML.BT_checkDown() && encoderDir[ENC_R].Down()) || (LCDML.BT_checkUp() && encoderDir[ENC_R].Up()))
if ((LCDML.BT_checkDown() && encoderDir[ENC_R].Down()) || (LCDML.BT_checkUp() && encoderDir[ENC_R].Up()) || (LCDML.BT_checkEnter() && encoderDir[ENC_R].ButtonShort()))
{
if (LCDML.BT_checkDown())
{
;
if (mode == 0)
configuration.sys.performance_number = constrain(configuration.sys.performance_number + ENCODER[ENC_L].speed(), PERFORMANCE_NUM_MIN, PERFORMANCE_NUM_MAX);
else
yesno = true;
}
else if (LCDML.BT_checkUp())
{
;
if (mode == 0)
configuration.sys.performance_number = constrain(configuration.sys.performance_number - ENCODER[ENC_L].speed(), PERFORMANCE_NUM_MIN, PERFORMANCE_NUM_MAX);
else
yesno = false;
}
else if (LCDML.BT_checkEnter())
{
if (mode == 0 && overwrite == true)
{
mode = 1;
lcd.setCursor(0, 1);
lcd.print(F("Overwrite: [ ]"));
}
else
{
LCDML.BT_quit(); // does not help :(
}
}
if (mode == 0)
{
char tmp[FILENAME_LEN];
sprintf(tmp, "/%s%d.syx", PERFORMANCE_CONFIG_NAME, configuration.sys.performance_number);
if (SD.exists(tmp))
overwrite = true;
else
overwrite = false;
lcd.setCursor(0, 1);
if (configuration.sys.performance_number == 0)
lcd.print(F("[DEFAULT]"));
else
{
char tmp[10];
sprintf(tmp, "[%7d]", configuration.sys.performance_number);
lcd.print(tmp);
}
}
else
{
lcd.setCursor(12, 1);
if (yesno == true)
lcd.print(F("YES"));
else
lcd.print(F("NO "));
}
}
encoderDir[ENC_R].reset();
}
if (LCDML.FUNC_close()) // ****** STABLE END *********
{
eeprom_write();
if (overwrite == false || yesno == true)
{
save_sd_performance(configuration.sys.performance_number);
lcd.setCursor(0, 1);
lcd.print("Done. ");
delay(500);
}
encoderDir[ENC_R].reset();
}
}
void UI_func_save_config(uint8_t param)
void UI_func_load_voiceconfig(uint8_t param)
{
#if NUMDEXED > 1
static int8_t instance_id;
@ -3246,8 +3346,105 @@ void UI_func_save_config(uint8_t param)
encoderDir[ENC_R].reset();
lcd.setCursor(0, 0);
lcd.print(F("Load Config SD"));
#if NUMDEXED > 1
instance_id = -1;
chosen = 0;
lcd.setCursor(0, 1);
lcd.print(F("Instance [1]"));
#else
lcd.setCursor(0, 1);
lcd.print(F("[NO ]"));
#endif
yesno = false;
}
if (LCDML.FUNC_loop()) // ****** LOOP *********
{
if ((LCDML.BT_checkEnter() && encoderDir[ENC_R].ButtonShort()) || (LCDML.BT_checkDown() && encoderDir[ENC_R].Down()) || (LCDML.BT_checkUp() && encoderDir[ENC_R].Up()))
{
#if NUMDEXED > 1
if ((LCDML.BT_checkDown() || LCDML.BT_checkUp()) && instance_id < 0)
{
chosen = (chosen + 1) % 2;
}
else if (LCDML.BT_checkEnter() && instance_id < 0)
{
instance_id = chosen;
lcd.setCursor(0, 1);
lcd.print(F("[NO ] "));
}
else if ((LCDML.BT_checkDown() || LCDML.BT_checkUp()) && instance_id >= 0)
#else
if ((LCDML.BT_checkDown() || LCDML.BT_checkUp()))
#endif
{
yesno = !yesno;
}
#if NUMDEXED > 1
if (instance_id < 0)
{
lcd.setCursor(10, 1);
lcd.print(chosen + 1);
}
else
{
#endif
if (yesno == true)
{
lcd.setCursor(1, 1);
lcd.print(F("YES"));
}
else
{
lcd.setCursor(1, 1);
lcd.print(F("NO "));
}
#if NUMDEXED > 1
}
#endif
//encoderDir[ENC_R].reset();
}
}
if (LCDML.FUNC_close()) // ****** STABLE END *********
{
if (yesno == true)
{
LCDML.DISP_clear();
lcd.print(F("Save Cfg SD"));
load_sd_voiceconfig(configuration.performance.bank[instance_id], configuration.performance.voice[instance_id], instance_id);
lcd.setCursor(0, 1);
lcd.print(F("Done."));
delay(500);
}
encoderDir[ENC_R].reset();
}
}
void UI_func_save_voiceconfig(uint8_t param)
{
#if NUMDEXED > 1
static int8_t instance_id;
static uint8_t chosen;
#else
uint8_t instance_id = 0;
#endif
static bool yesno;
if (LCDML.FUNC_setup()) // ****** SETUP *********
{
encoderDir[ENC_R].reset();
lcd.setCursor(0, 0);
lcd.print(F("Save Config SD"));
#if NUMDEXED > 1
instance_id = -1;
chosen = 0;
@ -3328,7 +3525,7 @@ void UI_func_save_config(uint8_t param)
}
}
void UI_func_save_config_default(uint8_t param)
void UI_func_save_voice(uint8_t param)
{
static bool yesno;
@ -3337,7 +3534,7 @@ void UI_func_save_config_default(uint8_t param)
encoderDir[ENC_R].reset();
lcd.setCursor(0, 0);
lcd.print(F("Save Cfg default"));
lcd.print(F("Save Voice"));
lcd.setCursor(0, 1);
lcd.print(F("[NO ]"));
@ -3366,7 +3563,7 @@ void UI_func_save_config_default(uint8_t param)
LCDML.DISP_clear();
lcd.print(F("Save Cfg default"));
// EEPROM!!!
// Storing on inside bank TBD
lcd.setCursor(0, 1);
lcd.print(F("Done."));
@ -3378,16 +3575,23 @@ void UI_func_save_config_default(uint8_t param)
}
}
void UI_func_sysex_send_voice(uint8_t param)
void UI_func_load_fx(uint8_t param)
{
if (LCDML.FUNC_setup()) // ****** SETUP *********
{
encoderDir[ENC_R].reset();
lcd.setCursor(0, 0);
lcd.print(F("Send Voice"));
lcd.print(F("Load FX SD"));
lcd.setCursor(0, 1);
lcd.print(F("Not implemented."));
if (configuration.performance.fx_number == 0)
lcd.print(F("[DEFAULT]"));
else
{
char tmp[10];
sprintf(tmp, "[%7d]", configuration.performance.fx_number);
lcd.print(tmp);
}
}
if (LCDML.FUNC_loop()) // ****** LOOP *********
@ -3396,11 +3600,21 @@ void UI_func_sysex_send_voice(uint8_t param)
{
if (LCDML.BT_checkDown())
{
;
configuration.performance.fx_number = constrain(configuration.performance.fx_number + ENCODER[ENC_L].speed(), FX_NUM_MIN, FX_NUM_MAX);
}
else if (LCDML.BT_checkUp())
{
;
configuration.performance.fx_number = constrain(configuration.performance.fx_number - ENCODER[ENC_L].speed(), FX_NUM_MIN, FX_NUM_MAX);
}
lcd.setCursor(0, 1);
if (configuration.performance.fx_number == 0)
lcd.print(F("[DEFAULT]"));
else
{
char tmp[10];
sprintf(tmp, "[%7d]", configuration.performance.fx_number);
lcd.print(tmp);
}
}
}
@ -3408,18 +3622,132 @@ void UI_func_sysex_send_voice(uint8_t param)
if (LCDML.FUNC_close()) // ****** STABLE END *********
{
eeprom_write();
load_sd_fx(configuration.performance.fx_number);
lcd.setCursor(0, 1);
lcd.print("Done. ");
delay(500);
encoderDir[ENC_R].reset();
}
}
void UI_func_sysex_receive_voice(uint8_t param)
void UI_func_save_fx(uint8_t param)
{
static bool overwrite;
static bool yesno;
static uint8_t mode;
if (LCDML.FUNC_setup()) // ****** SETUP *********
{
yesno = false;
mode = 0;
encoderDir[ENC_R].reset();
lcd.setCursor(0, 0);
lcd.print(F("Receive Voice"));
lcd.print(F("Save FX SD"));
lcd.setCursor(0, 1);
if (configuration.performance.fx_number == 0)
lcd.print(F("[DEFAULT]"));
else
{
char tmp[10];
sprintf(tmp, "[%7d]", configuration.performance.fx_number);
lcd.print(tmp);
}
char tmp[FILENAME_LEN];
sprintf(tmp, "/%s%d.syx", FX_CONFIG_NAME, configuration.performance.fx_number);
if (SD.exists(tmp))
overwrite = true;
else
overwrite = false;
}
if (LCDML.FUNC_loop()) // ****** LOOP *********
{
if ((LCDML.BT_checkDown() && encoderDir[ENC_R].Down()) || (LCDML.BT_checkUp() && encoderDir[ENC_R].Up()) || (LCDML.BT_checkEnter() && encoderDir[ENC_R].ButtonShort()))
{
if (LCDML.BT_checkDown())
{
if (mode == 0)
configuration.performance.fx_number = constrain(configuration.performance.fx_number + ENCODER[ENC_L].speed(), FX_NUM_MIN, FX_NUM_MAX);
else
yesno = true;
}
else if (LCDML.BT_checkUp())
{
if (mode == 0)
configuration.performance.fx_number = constrain(configuration.performance.fx_number - ENCODER[ENC_L].speed(), FX_NUM_MIN, FX_NUM_MAX);
else
yesno = false;
}
else if (LCDML.BT_checkEnter())
{
if (mode == 0 && overwrite == true)
{
mode = 1;
lcd.setCursor(0, 1);
lcd.print(F("Overwrite: [ ]"));
}
else
{
LCDML.BT_quit(); // does not help :(
}
}
if (mode == 0)
{
char tmp[FILENAME_LEN];
sprintf(tmp, "/%s%d.syx", FX_CONFIG_NAME, configuration.performance.fx_number);
if (SD.exists(tmp))
overwrite = true;
else
overwrite = false;
lcd.setCursor(0, 1);
if (configuration.performance.fx_number == 0)
lcd.print(F("[DEFAULT]"));
else
{
char tmp[10];
sprintf(tmp, "[%7d]", configuration.performance.fx_number);
lcd.print(tmp);
}
}
else
{
lcd.setCursor(12, 1);
if (yesno == true)
lcd.print(F("YES"));
else
lcd.print(F("NO "));
}
}
encoderDir[ENC_R].reset();
}
if (LCDML.FUNC_close()) // ****** STABLE END *********
{
eeprom_write();
if (overwrite == false || yesno == true)
{
save_sd_fx(configuration.performance.fx_number);
lcd.setCursor(0, 1);
lcd.print("Done. ");
delay(500);
}
encoderDir[ENC_R].reset();
}
}
void UI_func_sysex_receive_bank(uint8_t param)
{
if (LCDML.FUNC_setup()) // ****** SETUP *********
{
encoderDir[ENC_R].reset();
lcd.setCursor(0, 0);
lcd.print(F("MIDI Recv Bank"));
lcd.setCursor(0, 1);
lcd.print(F("Not implemented."));
}
@ -3446,14 +3774,14 @@ void UI_func_sysex_receive_voice(uint8_t param)
}
}
void UI_func_save_voice(uint8_t param)
void UI_func_sysex_send_bank(uint8_t param)
{
if (LCDML.FUNC_setup()) // ****** SETUP *********
{
encoderDir[ENC_R].reset();
lcd.setCursor(0, 0);
lcd.print(F("Save Voice SD"));
lcd.print(F("MIDI Send Bank"));
lcd.setCursor(0, 1);
lcd.print(F("Not implemented."));
}
@ -3480,14 +3808,14 @@ void UI_func_save_voice(uint8_t param)
}
}
void UI_func_sysex_receive_bank(uint8_t param)
void UI_func_sysex_send_voice(uint8_t param)
{
if (LCDML.FUNC_setup()) // ****** SETUP *********
{
encoderDir[ENC_R].reset();
lcd.setCursor(0, 0);
lcd.print(F("MIDI Recv Bank"));
lcd.print(F("MIDI Send Voice"));
lcd.setCursor(0, 1);
lcd.print(F("Not implemented."));
}
@ -3514,14 +3842,14 @@ void UI_func_sysex_receive_bank(uint8_t param)
}
}
void UI_func_sysex_send_bank(uint8_t param)
void UI_func_sysex_receive_voice(uint8_t param)
{
if (LCDML.FUNC_setup()) // ****** SETUP *********
{
encoderDir[ENC_R].reset();
lcd.setCursor(0, 0);
lcd.print(F("MIDI Send Bank"));
lcd.print(F("MIDI Receive Voice"));
lcd.setCursor(0, 1);
lcd.print(F("Not implemented."));
}
@ -3548,6 +3876,7 @@ void UI_func_sysex_send_bank(uint8_t param)
}
}
void UI_function_not_enabled(void)
{
if (LCDML.FUNC_setup()) // ****** SETUP *********

@ -102,19 +102,22 @@ LCDML_add(73, LCDML_0_3, 1, "Performance", NULL);
LCDML_add(74, LCDML_0_3_1, 1, "Load Perf. SD", UI_func_load_performance);
LCDML_add(75, LCDML_0_3_1, 2, "Save Perf. SD", UI_func_save_performance);
LCDML_add(76, LCDML_0_3, 2, "Voice", NULL);
LCDML_add(77, LCDML_0_3_2, 1, "Save Cfg SD", UI_func_save_config);
LCDML_add(78, LCDML_0_3_2, 2, "Save Cfg default", UI_func_save_config_default);
LCDML_add(77, LCDML_0_3_2, 1, "Load Config SD", UI_func_load_voiceconfig);
LCDML_add(78, LCDML_0_3_2, 2, "Save Config SD", UI_func_save_voiceconfig);
LCDML_add(79, LCDML_0_3_2, 3, "Save Voice SD", UI_func_save_voice);
LCDML_add(80, LCDML_0_3, 3, "MIDI", NULL);
LCDML_add(81, LCDML_0_3_3, 1, "MIDI Recv Bank", UI_func_sysex_receive_bank);
LCDML_add(82, LCDML_0_3_3, 2, "MIDI Send Bank", UI_func_sysex_send_bank);
LCDML_add(83, LCDML_0_3, 6, "EEPROM Reset", UI_func_eeprom_reset);
LCDML_add(84, LCDML_0, 4, "System", NULL);
LCDML_add(85, LCDML_0_4, 3, "Volume", UI_func_volume);
LCDML_add(86, LCDML_0_4, 1, "Stereo/Mono", UI_func_stereo_mono);
LCDML_add(87, LCDML_0_4, 2, "MIDI Soft THRU", UI_func_midi_soft_thru);
LCDML_add(88, LCDML_0, 6, "Info", UI_func_information);
#define _LCDML_DISP_cnt 88
LCDML_add(80, LCDML_0_3, 3, "FX", NULL);
LCDML_add(81, LCDML_0_3_3, 1, "Load FX SD", UI_func_load_fx);
LCDML_add(82, LCDML_0_3_3, 2, "Save FX SD", UI_func_save_fx);
LCDML_add(83, LCDML_0_3, 4, "MIDI", NULL);
LCDML_add(84, LCDML_0_3_4, 1, "MIDI Recv Bank", UI_func_sysex_receive_bank);
LCDML_add(85, LCDML_0_3_4, 2, "MIDI Send Bank", UI_func_sysex_send_bank);
LCDML_add(86, LCDML_0_3, 5, "EEPROM Reset", UI_func_eeprom_reset);
LCDML_add(87, LCDML_0, 4, "System", NULL);
LCDML_add(88, LCDML_0_4, 3, "Volume", UI_func_volume);
LCDML_add(89, LCDML_0_4, 1, "Stereo/Mono", UI_func_stereo_mono);
LCDML_add(90, LCDML_0_4, 2, "MIDI Soft THRU", UI_func_midi_soft_thru);
LCDML_add(91, LCDML_0, 6, "Info", UI_func_information);
#define _LCDML_DISP_cnt 91
#define MENU_ID_OF_INSTANCE_2 58
#define VOLUME_MENU_ID 85
#define VOLUME_MENU_ID 88
#endif

@ -510,6 +510,13 @@ enum { DEXED, CHORUS, DELAY, REVERB};
#define VELOCITY_LEVEL_MAX 127
#define VELOCITY_LEVEL_DEFAULT 100
#define PERFORMANCE_NUM_MIN 0
#define PERFORMANCE_NUM_MAX MAX_PERFORMANCE
#define PERFORMANCE_NUM_DEFAULT 0
#define FX_NUM_MIN 0
#define FX_NUM_MAX MAX_FX
#define FX_NUM_DEFAULT 0
//
typedef struct {
uint32_t checksum;

Loading…
Cancel
Save