Merge pull request 'Added first implementation of LOAD/SAVE to Sequencer, minor menu and display fixes' (#61) from positionhigh/MicroDexed:dev into dev

Reviewed-on: https://codeberg.org/dcoredump/MicroDexed/pulls/61
pull/62/head
Holger Wirtz 3 years ago
commit b65a40207f
  1. 202
      UI.hpp
  2. 4
      UI_FX.h
  3. 21
      UI_FX_T4.h
  4. 17
      UI_NO_FX.h
  5. 6
      config.h

202
UI.hpp

@ -139,7 +139,7 @@ uint8_t orig_attack_values[2][7];
uint8_t orig_release_values[2][7];
int temp_int;
bool menu_select_toggle;
float32_t temp_float;
float temp_float;
#ifdef I2C_DISPLAY
@ -266,6 +266,8 @@ void UI_func_sequencer(uint8_t param);
void UI_func_seq_live_transpose_oct(uint8_t param);
void UI_func_seq_lenght(uint8_t param);
void UI_func_seq_pat_chain(uint8_t param);
void UI_func_seq_pattern_load(uint8_t param);
void UI_func_seq_pattern_save(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);
@ -3701,7 +3703,7 @@ void UI_func_drum_volume(uint8_t param)
lcd.setCursor(1, 1);
sprintf(displayname, "%02d", activesample);
lcd.print(displayname);
lcd.show(1, 4, 6, basename(drum_config[activesample].filename));
lcd.show(1, 4, 7, basename(drum_config[activesample].filename));
sprintf(displayname, "%03d", (int)(drum_config[activesample].vol_max * 100) );
lcd.setCursor(12, 1);
lcd.print(displayname);
@ -3769,10 +3771,6 @@ void UI_func_drum_pan(uint8_t param)
menu_select_toggle = false;
} else
{ menu_select_toggle = true;
// if (drum_config[activesample].pan>0.00)
//temp_int=drum_config[activesample].pan*100;
//else
//temp_int=drum_config[activesample].pan*-100;
}
}
@ -3789,9 +3787,6 @@ void UI_func_drum_pan(uint8_t param)
sprintf(displayname, "%02d", activesample);
lcd.print(displayname);
lcd.show(1, 4, 6, basename(drum_config[activesample].filename));
sprintf(displayname, "%+f", drum_config[activesample].pan);
lcd.setCursor(12, 1);
lcd.print(displayname);
} else {
lcd.setCursor(0, 1);
lcd.print(" ");
@ -3801,11 +3796,23 @@ void UI_func_drum_pan(uint8_t param)
lcd.print("[");
lcd.setCursor(15, 1);
lcd.print("]");
sprintf(displayname, "%+03d", temp_int);
lcd.setCursor(12, 1);
lcd.print(displayname);
drum_config[activesample].pan = mapfloat(temp_int, -99, 99, -1.0, 1.0);
drum_config[activesample].pan = mapfloat(temp_int, -99, 99, -1.0, 1.0);
}
temp_int = mapfloat(drum_config[activesample].pan, -1.0, 1.0, -99, 99);
lcd.setCursor(12, 1);
if (temp_int > 1) {
lcd.print("R");
} else if (temp_int < 0) {
lcd.print("L");
}
else {
lcd.print("C");
}
sprintf(displayname, "%02d", temp_int);
lcd.setCursor(13, 1);
lcd.print( displayname);
}
if (LCDML.FUNC_close()) // ****** STABLE END *********
{
@ -4336,6 +4343,175 @@ void UI_func_seq_pat_chain(uint8_t param)
}
}
void UI_func_seq_pattern_load(uint8_t param)
{
static uint8_t mode;
if (LCDML.FUNC_setup()) // ****** SETUP *********
{
char tmp[10];
temp_int=param;
mode = 0;
encoderDir[ENC_R].reset();
lcd.setCursor(0, 0);
lcd.print(F("Load Patterns"));
lcd.setCursor(0, 1);
sprintf(tmp, "[%2d]", param);
lcd.print(tmp);
}
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())
{
temp_int = constrain(temp_int + ENCODER[ENC_L].speed(), 0, 99);
}
else if (LCDML.BT_checkUp())
{
temp_int = constrain(temp_int - ENCODER[ENC_L].speed(), 0, 99);
}
else if (LCDML.BT_checkEnter())
{
mode = 0xff;
lcd.setCursor(0, 1);
if (load_sd_seq_json(temp_int) == false)
lcd.print("Does not exist.");
else
{
load_sd_seq_json(temp_int);
lcd.print("Done. ");
}
delay(MESSAGE_WAIT_TIME);
LCDML.FUNC_goBackToMenu();
}
lcd.setCursor(0, 1);
char tmp[10];
sprintf(tmp, "[%2d]", temp_int);
lcd.print(tmp);
}
}
if (LCDML.FUNC_close()) // ****** STABLE END *********
{
if (mode < 0xff)
{
lcd.show(1, 0, 16, "Canceled.");
delay(MESSAGE_WAIT_TIME);
}
else
encoderDir[ENC_R].reset();
}
}
void UI_func_seq_pattern_save(uint8_t param)
{
static bool overwrite;
static bool yesno;
static uint8_t mode;
if (LCDML.FUNC_setup()) // ****** SETUP *********
{
char tmp[FILENAME_LEN];
yesno = false;
mode = 0;
encoderDir[ENC_R].reset();
lcd.setCursor(0, 0);
lcd.print(F("Save Patterns to:"));
lcd.setCursor(0, 1);
sprintf(tmp, "[%2d]", temp_int);
lcd.print(tmp);
sprintf(tmp, "/%s/%s%d.json", SEQ_CONFIG_PATH, SEQ_CONFIG_NAME, temp_int);
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)
temp_int = constrain(temp_int + ENCODER[ENC_L].speed(), 0, 99);
else
yesno = true;
}
else if (LCDML.BT_checkUp())
{
if (mode == 0)
temp_int = constrain(temp_int - ENCODER[ENC_L].speed(), 0, 99);
else
yesno = false;
}
else if (LCDML.BT_checkEnter())
{
if (mode == 0 && overwrite == true)
{
mode = 1;
lcd.setCursor(0, 1);
lcd.print(F("Overwrite: [ ]"));
}
else
{
mode = 0xff;
if (overwrite == false || yesno == true)
{
if (yesno == true)
{
char tmp[FILENAME_LEN];
sprintf(tmp, "/%s/%s%d.json", SEQ_CONFIG_PATH, SEQ_CONFIG_NAME, temp_int);
SD.remove(tmp);
}
save_sd_seq_json(temp_int);
lcd.show(1, 0, 16, "Done.");
delay(MESSAGE_WAIT_TIME);
LCDML.FUNC_goBackToMenu();
}
else if (overwrite == true && yesno == false)
{
char tmp[10];
mode = 0;
lcd.setCursor(0, 1);
sprintf(tmp, "[%2d] ", temp_int);
lcd.print(tmp);
}
}
}
if (mode == 0)
{
char tmp[FILENAME_LEN];
sprintf(tmp, "/%s/%s%d.json", SEQ_CONFIG_PATH, SEQ_CONFIG_NAME, temp_int);
if (SD.exists(tmp))
overwrite = true;
else
overwrite = false;
lcd.setCursor(0, 1);
sprintf(tmp, "[%2d]", temp_int);
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 *********
{
if (mode < 0xff)
{
lcd.show(1, 0, 16, "Canceled.");
delay(MESSAGE_WAIT_TIME);
}
encoderDir[ENC_R].reset();
}
}
void UI_func_information(uint8_t param)
{
if (LCDML.FUNC_setup()) // ****** SETUP *********

@ -121,8 +121,8 @@ LCDML_add(87, LCDML_0_5, 3, "Seq. Length", UI_func_seq_lenght);
LCDML_add(88, LCDML_0_5, 4, "Tempo", NULL);
LCDML_add(89, LCDML_0_5, 5, "L.Transp.Key", UI_func_seq_live_transpose_oct);
LCDML_add(90, LCDML_0_5, 6, "L.Trp.Offset", NULL);
LCDML_add(91, LCDML_0_5, 7, "Pattern load", NULL);
LCDML_add(92, LCDML_0_5, 8, "Pattern save", NULL);
LCDML_add(91, LCDML_0_5, 7, "LOAD Patterns", UI_func_seq_pattern_load);
LCDML_add(92, LCDML_0_5, 8, "SAVE Patterns", UI_func_seq_pattern_save);
LCDML_add(93, LCDML_0, 6, "System", NULL);
LCDML_add(94, LCDML_0_6, 1, "Stereo/Mono", UI_func_stereo_mono);
LCDML_add(95, LCDML_0_6, 2, "MIDI Soft THRU", UI_func_midi_soft_thru);

@ -123,15 +123,14 @@ LCDML_add(89, LCDML_0_5, 2, "Pattern Chain", UI_func_seq_pat_chain);
LCDML_add(90, LCDML_0_5, 3, "Seq. Length", UI_func_seq_lenght);
LCDML_add(91, LCDML_0_5, 4, "Tempo", NULL);
LCDML_add(92, LCDML_0_5, 5, "L.Transp.Key", UI_func_seq_live_transpose_oct);
LCDML_add(93, LCDML_0_5, 6, "L.Trp.Offset", NULL);
LCDML_add(94, LCDML_0_5, 7, "Pattern load", NULL);
LCDML_add(95, LCDML_0_5, 8, "Pattern save", NULL);
LCDML_add(96, LCDML_0, 6, "System", NULL);
LCDML_add(97, LCDML_0_6, 1, "Stereo/Mono", UI_func_stereo_mono);
LCDML_add(98, LCDML_0_6, 2, "MIDI Soft THRU", UI_func_midi_soft_thru);
LCDML_add(99, LCDML_0_6, 3, "Favorites", UI_func_favorites);
LCDML_add(100, LCDML_0_6, 4, "EEPROM Reset", UI_func_eeprom_reset);
LCDML_add(101, LCDML_0, 7, "Info", UI_func_information);
LCDML_addAdvanced(102, LCDML_0, 8, COND_hide, "Volume", UI_func_volume, 0, _LCDML_TYPE_default);
#define _LCDML_DISP_cnt 102
LCDML_add(93, LCDML_0_5, 6, "LOAD Patterns", UI_func_seq_pattern_load);
LCDML_add(94, LCDML_0_5, 7, "SAVE Patterns", UI_func_seq_pattern_save);
LCDML_add(95, LCDML_0, 6, "System", NULL);
LCDML_add(96, LCDML_0_6, 1, "Stereo/Mono", UI_func_stereo_mono);
LCDML_add(97, LCDML_0_6, 2, "MIDI Soft THRU", UI_func_midi_soft_thru);
LCDML_add(98, LCDML_0_6, 3, "Favorites", UI_func_favorites);
LCDML_add(99, LCDML_0_6, 4, "EEPROM Reset", UI_func_eeprom_reset);
LCDML_add(100, LCDML_0, 7, "Info", UI_func_information);
LCDML_addAdvanced(101, LCDML_0, 8, COND_hide, "Volume", UI_func_volume, 0, _LCDML_TYPE_default);
#define _LCDML_DISP_cnt 101
#endif

@ -92,17 +92,16 @@ LCDML_add(58, LCDML_0_3, 3, "Drum Pan", UI_func_drum_pan);
LCDML_add(59, LCDML_0, 4, "Sequencer", NULL);
LCDML_add(60, LCDML_0_4, 1, "Sequencer", UI_func_sequencer);
LCDML_add(61, LCDML_0_4, 2, "Pattern Chain", UI_func_seq_pat_chain);
LCDML_add(62, LCDML_0_4, 3, "Seq. Length", NULL);
LCDML_add(62, LCDML_0_4, 3, "Seq. Length", UI_func_seq_lenght);
LCDML_add(63, LCDML_0_4, 4, "Tempo", NULL);
LCDML_add(64, LCDML_0_4, 5, "L.Transp.Key", UI_func_seq_live_transpose_oct);
LCDML_add(65, LCDML_0_4, 6, "Live-Tr.Offset", NULL);
LCDML_add(66, LCDML_0_4, 7, "Pattern load", NULL);
LCDML_add(67, LCDML_0_4, 8, "Pattern save", NULL);
LCDML_add(68, LCDML_0, 5, "System", NULL);
LCDML_add(69, LCDML_0_5, 1, "Stereo/Mono", UI_func_stereo_mono);
LCDML_add(70, LCDML_0_5, 2, "MIDI Soft THRU", UI_func_midi_soft_thru);
LCDML_add(71, LCDML_0_5, 3, "Favorites", UI_func_favorites);
LCDML_add(72, LCDML_0_5, 4, "EEPROM Reset", UI_func_eeprom_reset);
LCDML_add(65, LCDML_0_4, 6, "LOAD Patterns", UI_func_seq_pattern_load);
LCDML_add(66, LCDML_0_4, 7, "SAVE Patterns", UI_func_seq_pattern_save);
LCDML_add(67, LCDML_0, 5, "System", NULL);
LCDML_add(68, LCDML_0_5, 1, "Stereo/Mono", UI_func_stereo_mono);
LCDML_add(69, LCDML_0_5, 2, "MIDI Soft THRU", UI_func_midi_soft_thru);
LCDML_add(70, LCDML_0_5, 3, "Favorites", UI_func_favorites);
LCDML_add(71, LCDML_0_5, 4, "EEPROM Reset", UI_func_eeprom_reset);
LCDML_add(72, LCDML_0, 6, "Info", UI_func_information);
LCDML_addAdvanced(73, LCDML_0, 5, COND_hide, "Volume", UI_func_volume, 0, _LCDML_TYPE_default);
#define _LCDML_DISP_cnt 73

@ -293,6 +293,9 @@
#define FAV_CONFIG_PATH "FAVCFG"
#define FAV_CONFIG_NAME "FAVCFG"
#define SEQ_CONFIG_PATH "SEQ"
#define SEQ_CONFIG_NAME "SEQ"
#define MAX_PERF_MOD 30
//*************************************************************************************************
@ -613,7 +616,8 @@
#define EQ_TREBLE_DEFAULT 0
// Buffer for load/save configuration as JSON
#define JSON_BUFFER 2048
#define JSON_BUFFER 6144
// Internal configuration structure
typedef struct dexed_s {

Loading…
Cancel
Save