New handling for operator enable/disable.

pull/32/head
Holger Wirtz 5 years ago
parent d1e39ee359
commit 39609188a3
  1. 199
      UI.hpp
  2. 60
      UI_FX.h

199
UI.hpp

@ -97,7 +97,7 @@ extern char receive_bank_filename[FILENAME_LEN];
GLOBAL GLOBAL
************************************************************************/ ************************************************************************/
elapsedMillis back_from_volume; elapsedMillis back_from_volume;
uint8_t instance_num[2][8]; uint8_t instance_num[8][8];
#ifdef I2C_DISPLAY #ifdef I2C_DISPLAY
#include <LiquidCrystal_I2C.h> #include <LiquidCrystal_I2C.h>
@ -158,9 +158,15 @@ const uint8_t meter_bar[5][8] = {
{B00000, B00001, B00001, B00001, B00001, B00001, B00001, B00000} {B00000, B00001, B00001, B00001, B00001, B00001, B00001, B00000}
}; };
const uint8_t inverse_num[6][8] = { const uint8_t inverse_num[8][8] = {
{B11111, B11011, B10011, B11011, B11011, B11011, B11011, B11111}, // 1 invers {B11111, B11011, B10011, B11011, B11011, B11011, B11011, B11111}, // 1 small invers
{B11111, B11011, B10101, B11101, B11011, B10111, B10001, B11111} // 2 invers {B11111, B11011, B10101, B11101, B11011, B10111, B10001, B11111}, // 2 small invers
{B11111, B11011, B10011, B11011, B11011, B11011, B11011, B11111}, // 1 OP invers
{B11111, B11011, B10101, B11101, B11011, B10111, B10001, B11111}, // 2 OP invers
{B11111, B10001, B11101, B11011, B11101, B10101, B11011, B11111}, // 3 OP invers
{B11111, B10111, B10111, B10101, B10001, B11101, B11101, B11111}, // 4 OP invers
{B11111, B10001, B10111, B10011, B11101, B11101, B10011, B11111}, // 5 OP invers
{B11111, B11011, B10101, B10011, B10101, B10101, B11011, B11111} // 6 OP invers
}; };
enum { SCROLLBAR, BLOCKBAR, METERBAR }; enum { SCROLLBAR, BLOCKBAR, METERBAR };
@ -215,13 +221,7 @@ void UI_func_at_mode(uint8_t param);
void UI_func_portamento_mode(uint8_t param); void UI_func_portamento_mode(uint8_t param);
void UI_func_portamento_glissando(uint8_t param); void UI_func_portamento_glissando(uint8_t param);
void UI_func_portamento_time(uint8_t param); void UI_func_portamento_time(uint8_t param);
void UI_func_OP1(uint8_t param); void UI_handle_OP(uint8_t param);
void UI_func_OP2(uint8_t param);
void UI_func_OP3(uint8_t param);
void UI_func_OP4(uint8_t param);
void UI_func_OP5(uint8_t param);
void UI_func_OP6(uint8_t param);
void UI_handle_OP(uint8_t param, uint8_t op, uint8_t instance_id);
void UI_func_information(uint8_t param); void UI_func_information(uint8_t param);
void UI_func_volume(uint8_t param); void UI_func_volume(uint8_t param);
void UI_func_load_performance(uint8_t param); void UI_func_load_performance(uint8_t param);
@ -249,6 +249,7 @@ void lcd_display_bar_float(const char* title, float value, float factor, int32_t
void lcd_display_meter_int(const char* title, uint32_t value, float factor, float offset, int32_t min_value, int32_t max_value, uint8_t size, bool zeros, bool brackets, bool sign, bool init); void lcd_display_meter_int(const char* title, uint32_t value, float factor, float offset, int32_t min_value, int32_t max_value, uint8_t size, bool zeros, bool brackets, bool sign, bool init);
void lcd_display_meter_float(const char* title, float value, float factor, float offset, int32_t min_value, int32_t max_value, uint8_t size_number, uint8_t size_fraction, bool zeros, bool brackets, bool sign, bool init); void lcd_display_meter_float(const char* title, float value, float factor, float offset, int32_t min_value, int32_t max_value, uint8_t size_number, uint8_t size_fraction, bool zeros, bool brackets, bool sign, bool init);
void lcd_active_instance_number(uint8_t instance_id); void lcd_active_instance_number(uint8_t instance_id);
void lcd_OP_active_instance_number(uint8_t instance_id, uint8_t op);
void lcd_special_chars(uint8_t mode); void lcd_special_chars(uint8_t mode);
void eeprom_update_var(uint16_t pos, uint8_t val, const char* val_string); void eeprom_update_var(uint16_t pos, uint8_t val, const char* val_string);
@ -3405,96 +3406,82 @@ void UI_func_portamento_time(uint8_t param)
} }
} }
void UI_func_OP1(uint8_t param) void UI_handle_OP(uint8_t param)
{ {
uint8_t selected_instance_id = 0; static uint8_t op_selected;
UI_handle_OP(param, 0, selected_instance_id);
}
void UI_func_OP2(uint8_t param)
{
uint8_t selected_instance_id = 0;
UI_handle_OP(param, 1, selected_instance_id);
}
void UI_func_OP3(uint8_t param)
{
uint8_t selected_instance_id = 0;
UI_handle_OP(param, 2, selected_instance_id);
}
void UI_func_OP4(uint8_t param)
{
uint8_t selected_instance_id = 0;
UI_handle_OP(param, 3, selected_instance_id);
}
void UI_func_OP5(uint8_t param)
{
uint8_t selected_instance_id = 0;
UI_handle_OP(param, 4, selected_instance_id);
}
void UI_func_OP6(uint8_t param)
{
uint8_t selected_instance_id = 0;
UI_handle_OP(param, 5, selected_instance_id); lcd_OP_active_instance_number(selected_instance_id, configuration.dexed[selected_instance_id].op_enabled);
}
void UI_handle_OP(uint8_t param, uint8_t op, uint8_t selected_instance_id)
{
bool state = bitRead(configuration.dexed[selected_instance_id].op_enabled, op);
if (LCDML.FUNC_setup()) // ****** SETUP ********* if (LCDML.FUNC_setup()) // ****** SETUP *********
{ {
encoderDir[ENC_R].reset(); encoderDir[ENC_R].reset();
lcd.setCursor(0, 0); lcd.setCursor(0, 0);
lcd.print(F("Operator ")); lcd.print(F("Operator Enable"));
lcd.print(op + 1);
lcd.setCursor(0, 1); lcd.setCursor(0, 1);
if (state == true) for (uint8_t i = 2; i < 8; i++)
{ {
lcd.print(F("[ENABLED ]")); lcd.print(F(" "));
} lcd.write(i);
else
{
lcd.print(F("[DISABLED]"));
} }
lcd.setCursor(op_selected * 2, 1);
lcd.print(F("["));
lcd.setCursor(op_selected * 2 + 2, 1);
lcd.print(F("]"));
#if NUM_DEXED > 1
lcd.setCursor(15, 0);
lcd.write(0);
lcd.setCursor(15, 1);
lcd.write(1);
#endif
} }
if (LCDML.FUNC_loop()) // ****** LOOP ********* if (LCDML.FUNC_loop()) // ****** LOOP *********
{ {
if (LCDML.BT_checkUp() && state == true) uint8_t op_selected_old = op_selected;
if (LCDML.BT_checkUp() && encoderDir[ENC_R].Up())
{ {
bitClear(configuration.dexed[selected_instance_id].op_enabled, op); if (op_selected == 0)
state = false;
}
else if (LCDML.BT_checkDown() && state == false)
{ {
bitSet(configuration.dexed[selected_instance_id].op_enabled, op); selected_instance_id = !selected_instance_id;
state = true; op_selected = 5;
lcd_OP_active_instance_number(selected_instance_id, configuration.dexed[selected_instance_id].op_enabled);
} }
else
if ((LCDML.BT_checkDown() && encoderDir[ENC_R].Down()) || (LCDML.BT_checkUp() && encoderDir[ENC_R].Up())) op_selected = constrain(op_selected - 1, 0, 5);
}
else if (LCDML.BT_checkDown() && encoderDir[ENC_R].Down())
{ {
lcd.setCursor(0, 1); if (op_selected == 5)
if (state == true)
{ {
lcd.print(F("[ENABLED ]")); selected_instance_id = !selected_instance_id;
op_selected = 0;
lcd_OP_active_instance_number(selected_instance_id, configuration.dexed[selected_instance_id].op_enabled);
} }
else else
{ op_selected = constrain(op_selected + 1, 0, 5);
lcd.print(F("[DISABLED]"));
} }
else if (LCDML.BT_checkEnter() && encoderDir[ENC_R].ButtonShort())
{
if (bitRead(configuration.dexed[selected_instance_id].op_enabled, op_selected))
bitClear(configuration.dexed[selected_instance_id].op_enabled, op_selected);
else
bitSet(configuration.dexed[selected_instance_id].op_enabled, op_selected);
lcd_OP_active_instance_number(selected_instance_id, configuration.dexed[selected_instance_id].op_enabled);
} }
lcd.setCursor(op_selected_old * 2, 1);
lcd.print(F(" "));
lcd.setCursor(op_selected_old * 2 + 2, 1);
lcd.print(F(" "));
lcd.setCursor(op_selected * 2, 1);
lcd.print(F("["));
lcd.setCursor(op_selected * 2 + 2, 1);
lcd.print(F("]"));
MicroDexed[selected_instance_id]->setOPs(configuration.dexed[selected_instance_id].op_enabled); MicroDexed[selected_instance_id]->setOPs(configuration.dexed[selected_instance_id].op_enabled);
MicroDexed[selected_instance_id]->doRefreshVoice(); MicroDexed[selected_instance_id]->doRefreshVoice();
} }
@ -3502,10 +3489,8 @@ void UI_handle_OP(uint8_t param, uint8_t op, uint8_t selected_instance_id)
if (LCDML.FUNC_close()) // ****** STABLE END ********* if (LCDML.FUNC_close()) // ****** STABLE END *********
{ {
encoderDir[ENC_R].reset(); encoderDir[ENC_R].reset();
if (selected_instance_id == 0)
EEPROM.update(EEPROM_START_ADDRESS + offsetof(configuration_s, dexed[0].op_enabled), configuration.dexed[0].op_enabled); EEPROM.update(EEPROM_START_ADDRESS + offsetof(configuration_s, dexed[0].op_enabled), configuration.dexed[0].op_enabled);
#if NUM_DEXED > 1 #if NUM_DEXED > 1
else
EEPROM.update(EEPROM_START_ADDRESS + offsetof(configuration_s, dexed[1].op_enabled), configuration.dexed[1].op_enabled); EEPROM.update(EEPROM_START_ADDRESS + offsetof(configuration_s, dexed[1].op_enabled), configuration.dexed[1].op_enabled);
#endif #endif
} }
@ -5196,8 +5181,62 @@ void lcd_active_instance_number(uint8_t instance_id)
} }
} }
lcd.createChar(5, (uint8_t*)instance_num[0]); lcd.createChar(5, instance_num[0]);
lcd.createChar(6, (uint8_t*)instance_num[1]); lcd.createChar(6, instance_num[1]);
}
void lcd_OP_active_instance_number(uint8_t instance_id, uint8_t op)
{
uint8_t i, n;
for (n = 2; n < 8; n++)
{
for (i = 0; i < 8; i++)
{
if (bitRead(op, n - 2))
instance_num[n][i] = inverse_num[n][i];
else
instance_num[n][i] = ~inverse_num[n][i];
}
lcd.createChar(n, instance_num[n]);
}
for (i = 0; i < 8; i++)
{
if (instance_id == 0)
{
if (configuration.dexed[instance_id].polyphony == 0)
instance_num[0][i] = bit_reverse8(inverse_num[0][i]);
else
instance_num[0][i] = inverse_num[0][i];
if (configuration.dexed[!instance_id].polyphony == 0)
{
instance_num[1][i] = bit_reverse8(inverse_num[1][i]);
instance_num[1][i] = ~instance_num[1][i];
}
else
instance_num[1][i] = ~inverse_num[1][i];
}
else
{
if (configuration.dexed[!instance_id].polyphony == 0)
{
instance_num[0][i] = bit_reverse8(inverse_num[0][i]);
instance_num[0][i] = ~instance_num[0][i];
}
else
instance_num[0][i] = ~inverse_num[0][i];
if (configuration.dexed[instance_id].polyphony == 0)
instance_num[1][i] = bit_reverse8(inverse_num[1][i]);
else
instance_num[1][i] = inverse_num[1][i];
}
}
lcd.createChar(0, instance_num[0]);
lcd.createChar(1, instance_num[1]);
} }
void lcd_special_chars(uint8_t mode) void lcd_special_chars(uint8_t mode)

@ -83,37 +83,31 @@ LCDML_add(54, LCDML_0_1, 6, "Internal", NULL);
LCDML_add(55, LCDML_0_1_6, 1, "Note Refresh", UI_func_note_refresh); LCDML_add(55, LCDML_0_1_6, 1, "Note Refresh", UI_func_note_refresh);
LCDML_add(56, LCDML_0_1_6, 2, "Velocity Lvl", UI_func_velocity_level); LCDML_add(56, LCDML_0_1_6, 2, "Velocity Lvl", UI_func_velocity_level);
LCDML_add(57, LCDML_0_1_6, 3, "Engine", UI_func_engine); LCDML_add(57, LCDML_0_1_6, 3, "Engine", UI_func_engine);
LCDML_add(58, LCDML_0_1, 7, "Operator", NULL); LCDML_add(58, LCDML_0_1, 7, "Operator", UI_handle_OP);
LCDML_add(59, LCDML_0_1_7, 1, "OP1", UI_func_OP1); LCDML_add(59, LCDML_0_1, 8, "Save Voice", UI_func_save_voice);
LCDML_add(60, LCDML_0_1_7, 2, "OP2", UI_func_OP2); LCDML_add(60, LCDML_0, 2, "Master Effects", NULL);
LCDML_add(61, LCDML_0_1_7, 3, "OP3", UI_func_OP3); LCDML_add(61, LCDML_0_2, 1, "Reverb", NULL);
LCDML_add(62, LCDML_0_1_7, 4, "OP4", UI_func_OP4); LCDML_add(62, LCDML_0_2_1, 1, "Roomsize", UI_func_reverb_roomsize);
LCDML_add(63, LCDML_0_1_7, 5, "OP5", UI_func_OP5); LCDML_add(63, LCDML_0_2_1, 2, "Damping", UI_func_reverb_damping);
LCDML_add(64, LCDML_0_1_7, 6, "OP6", UI_func_OP6); LCDML_add(64, LCDML_0_2_1, 3, "Level", UI_func_reverb_level);
LCDML_add(65, LCDML_0_1, 8, "Save Voice", UI_func_save_voice); LCDML_add(65, LCDML_0, 3, "Load/Save", NULL);
LCDML_add(66, LCDML_0, 2, "Master Effects", NULL); LCDML_add(66, LCDML_0_3, 1, "Performance", NULL);
LCDML_add(67, LCDML_0_2, 1, "Reverb", NULL); LCDML_add(67, LCDML_0_3_1, 1, "Load Perf.", UI_func_load_performance);
LCDML_add(68, LCDML_0_2_1, 1, "Roomsize", UI_func_reverb_roomsize); LCDML_add(68, LCDML_0_3_1, 2, "Save Perf.", UI_func_save_performance);
LCDML_add(69, LCDML_0_2_1, 2, "Damping", UI_func_reverb_damping); LCDML_add(69, LCDML_0_3, 2, "Voice Config", NULL);
LCDML_add(70, LCDML_0_2_1, 3, "Level", UI_func_reverb_level); LCDML_add(70, LCDML_0_3_2, 1, "Load Voice Cfg", UI_func_load_voiceconfig);
LCDML_add(71, LCDML_0, 3, "Load/Save", NULL); LCDML_add(71, LCDML_0_3_2, 2, "Save Voice Cfg", UI_func_save_voiceconfig);
LCDML_add(72, LCDML_0_3, 1, "Performance", NULL); LCDML_add(72, LCDML_0_3, 3, "Effects", NULL);
LCDML_add(73, LCDML_0_3_1, 1, "Load Perf.", UI_func_load_performance); LCDML_add(73, LCDML_0_3_3, 1, "Load Effects", UI_func_load_fx);
LCDML_add(74, LCDML_0_3_1, 2, "Save Perf.", UI_func_save_performance); LCDML_add(74, LCDML_0_3_3, 2, "Save Effects", UI_func_save_fx);
LCDML_add(75, LCDML_0_3, 2, "Voice Config", NULL); LCDML_add(75, LCDML_0_3, 5, "MIDI", NULL);
LCDML_add(76, LCDML_0_3_2, 1, "Load Voice Cfg", UI_func_load_voiceconfig); LCDML_add(76, LCDML_0_3_5, 1, "MIDI Recv Bank", UI_func_sysex_receive_bank);
LCDML_add(77, LCDML_0_3_2, 2, "Save Voice Cfg", UI_func_save_voiceconfig); LCDML_add(77, LCDML_0_3_5, 2, "MIDI Send Bank", UI_func_sysex_send_bank);
LCDML_add(78, LCDML_0_3, 3, "Effects", NULL); LCDML_add(78, LCDML_0, 4, "System", NULL);
LCDML_add(79, LCDML_0_3_3, 1, "Load Effects", UI_func_load_fx); LCDML_add(79, LCDML_0_4, 1, "Volume", UI_func_volume);
LCDML_add(80, LCDML_0_3_3, 2, "Save Effects", UI_func_save_fx); LCDML_add(80, LCDML_0_4, 2, "Stereo/Mono", UI_func_stereo_mono);
LCDML_add(81, LCDML_0_3, 5, "MIDI", NULL); LCDML_add(81, LCDML_0_4, 3, "MIDI Soft THRU", UI_func_midi_soft_thru);
LCDML_add(82, LCDML_0_3_5, 1, "MIDI Recv Bank", UI_func_sysex_receive_bank); LCDML_add(82, LCDML_0_4, 4, "EEPROM Reset", UI_func_eeprom_reset);
LCDML_add(83, LCDML_0_3_5, 2, "MIDI Send Bank", UI_func_sysex_send_bank); LCDML_add(83, LCDML_0, 6, "Info", UI_func_information);
LCDML_add(84, LCDML_0, 4, "System", NULL); #define _LCDML_DISP_cnt 83
LCDML_add(85, LCDML_0_4, 1, "Volume", UI_func_volume);
LCDML_add(86, LCDML_0_4, 2, "Stereo/Mono", UI_func_stereo_mono);
LCDML_add(87, LCDML_0_4, 3, "MIDI Soft THRU", UI_func_midi_soft_thru);
LCDML_add(88, LCDML_0_4, 4, "EEPROM Reset", UI_func_eeprom_reset);
LCDML_add(89, LCDML_0, 6, "Info", UI_func_information);
#define _LCDML_DISP_cnt 89
#endif #endif

Loading…
Cancel
Save