|
|
|
@ -5,7 +5,7 @@ |
|
|
|
|
(https://github.com/asb2m10/dexed) for the Teensy-3.5/3.6 with audio shield.
|
|
|
|
|
Dexed ist heavily based on https://github.com/google/music-synthesizer-for-android
|
|
|
|
|
|
|
|
|
|
(c)2018,2019 H. Wirtz <wirtz@parasitstudio.de> |
|
|
|
|
(c)2018-2020 H. Wirtz <wirtz@parasitstudio.de> |
|
|
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify |
|
|
|
|
it under the terms of the GNU General Public License as published by |
|
|
|
@ -202,7 +202,7 @@ void UI_function_not_enabled(void); |
|
|
|
|
void UI_function_not_implemented(uint8_t param); |
|
|
|
|
void lcd_display_int(int16_t var, uint8_t size, bool zeros, bool brackets, bool sign); |
|
|
|
|
void lcd_display_float(float var, uint8_t size_number, uint8_t size_fraction, bool zeros, bool brackets, bool sign); |
|
|
|
|
void lcd_display_bar(const char* title, uint32_t value, uint32_t min_value, uint32_t max_value, bool init); |
|
|
|
|
void lcd_display_bar_int(const char* title, uint32_t value, uint32_t min_value, uint32_t max_value, uint8_t size, bool zeros, bool brackets, bool sign, bool init); |
|
|
|
|
void lcd_special_chars(uint8_t mode); |
|
|
|
|
|
|
|
|
|
// normal menu
|
|
|
|
@ -295,7 +295,6 @@ void lcdml_menu_control(void) |
|
|
|
|
{ |
|
|
|
|
lcd_special_chars(SCROLLBAR); |
|
|
|
|
UI_func_voice_selection(0); |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
//Volatile Variable
|
|
|
|
@ -2094,7 +2093,7 @@ void UI_func_pb_range(uint8_t param) |
|
|
|
|
{ |
|
|
|
|
// setup function
|
|
|
|
|
lcd_special_chars(BLOCKBAR); |
|
|
|
|
lcd_display_bar("PB Range", configuration.dexed[instance_id].pb_range, PB_RANGE_MIN, PB_RANGE_MAX, true); |
|
|
|
|
lcd_display_bar_int("PB Range", configuration.dexed[instance_id].pb_range, PB_RANGE_MIN, PB_RANGE_MAX, 2, false, false, false, true); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (LCDML.FUNC_loop()) // ****** LOOP *********
|
|
|
|
@ -2123,7 +2122,7 @@ void UI_func_pb_range(uint8_t param) |
|
|
|
|
MicroDexed[instance_id]->setPBController(configuration.dexed[instance_id].pb_range, configuration.dexed[instance_id].pb_step); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
lcd_display_bar("PB Range", configuration.dexed[instance_id].pb_range, PB_RANGE_MIN, PB_RANGE_MAX, false); |
|
|
|
|
lcd_display_bar_int("PB Range", configuration.dexed[instance_id].pb_range, PB_RANGE_MIN, PB_RANGE_MAX, 2, false, false, false, false); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (LCDML.FUNC_close()) // ****** STABLE END *********
|
|
|
|
@ -2144,7 +2143,7 @@ void UI_func_pb_step(uint8_t param) |
|
|
|
|
{ |
|
|
|
|
// setup function
|
|
|
|
|
lcd_special_chars(BLOCKBAR); |
|
|
|
|
lcd_display_bar("PB Step", configuration.dexed[instance_id].pb_step, PB_STEP_MIN, PB_STEP_MAX, true); |
|
|
|
|
lcd_display_bar_int("PB Step", configuration.dexed[instance_id].pb_step, PB_STEP_MIN, PB_STEP_MAX, 2, false, false, false, true); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (LCDML.FUNC_loop()) // ****** LOOP *********
|
|
|
|
@ -2173,7 +2172,7 @@ void UI_func_pb_step(uint8_t param) |
|
|
|
|
MicroDexed[instance_id]->setPBController(configuration.dexed[instance_id].pb_range, configuration.dexed[instance_id].pb_step); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
lcd_display_bar("PB Step", configuration.dexed[instance_id].pb_step, PB_STEP_MIN, PB_STEP_MAX, false); |
|
|
|
|
lcd_display_bar_int("PB Step", configuration.dexed[instance_id].pb_step, PB_STEP_MIN, PB_STEP_MAX, 2, false, false, false, false); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (LCDML.FUNC_close()) // ****** STABLE END *********
|
|
|
|
@ -2195,7 +2194,7 @@ void UI_func_mw_range(uint8_t param) |
|
|
|
|
{ |
|
|
|
|
// setup function
|
|
|
|
|
lcd_special_chars(BLOCKBAR); |
|
|
|
|
lcd_display_bar("MW Range", configuration.dexed[instance_id].mw_range, MW_RANGE_MIN, MW_RANGE_MAX, true); |
|
|
|
|
lcd_display_bar_int("MW Range", configuration.dexed[instance_id].mw_range, MW_RANGE_MIN, MW_RANGE_MAX, 2, false, false, false, true); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (LCDML.FUNC_loop()) // ****** LOOP *********
|
|
|
|
@ -2224,7 +2223,7 @@ void UI_func_mw_range(uint8_t param) |
|
|
|
|
MicroDexed[instance_id]->setMWController(configuration.dexed[instance_id].mw_range, configuration.dexed[instance_id].mw_assign); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
lcd_display_bar("MW Range", configuration.dexed[instance_id].mw_range, MW_RANGE_MIN, MW_RANGE_MAX, false); |
|
|
|
|
lcd_display_bar_int("MW Range", configuration.dexed[instance_id].mw_range, MW_RANGE_MIN, MW_RANGE_MAX, 2, false, false, false, false); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (LCDML.FUNC_close()) // ****** STABLE END *********
|
|
|
|
@ -2323,7 +2322,7 @@ void UI_func_fc_range(uint8_t param) |
|
|
|
|
{ |
|
|
|
|
// setup function
|
|
|
|
|
lcd_special_chars(BLOCKBAR); |
|
|
|
|
lcd_display_bar("FC Range", configuration.dexed[instance_id].fc_range, FC_RANGE_MIN, FC_RANGE_MAX, true); |
|
|
|
|
lcd_display_bar_int("FC Range", configuration.dexed[instance_id].fc_range, FC_RANGE_MIN, FC_RANGE_MAX, 2, false, false, false, true); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (LCDML.FUNC_loop()) // ****** LOOP *********
|
|
|
|
@ -2352,7 +2351,7 @@ void UI_func_fc_range(uint8_t param) |
|
|
|
|
MicroDexed[instance_id]->setFCController(configuration.dexed[instance_id].fc_range, configuration.dexed[instance_id].fc_assign); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
lcd_display_bar("FC Range", configuration.dexed[instance_id].fc_range, FC_RANGE_MIN, FC_RANGE_MAX, false); |
|
|
|
|
lcd_display_bar_int("FC Range", configuration.dexed[instance_id].fc_range, FC_RANGE_MIN, FC_RANGE_MAX, 2, false, false, false, false); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (LCDML.FUNC_close()) // ****** STABLE END *********
|
|
|
|
@ -2400,7 +2399,6 @@ void UI_func_fc_assign(uint8_t param) |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
MicroDexed[instance_id]->setFCController(configuration.dexed[instance_id].fc_range, configuration.dexed[instance_id].fc_assign); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -2452,7 +2450,7 @@ void UI_func_bc_range(uint8_t param) |
|
|
|
|
{ |
|
|
|
|
// setup function
|
|
|
|
|
lcd_special_chars(BLOCKBAR); |
|
|
|
|
lcd_display_bar("BC Range", configuration.dexed[instance_id].bc_range, BC_RANGE_MIN, BC_RANGE_MAX, true); |
|
|
|
|
lcd_display_bar_int("BC Range", configuration.dexed[instance_id].bc_range, BC_RANGE_MIN, BC_RANGE_MAX, 2, false, false, false, true); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (LCDML.FUNC_loop()) // ****** LOOP *********
|
|
|
|
@ -2481,7 +2479,7 @@ void UI_func_bc_range(uint8_t param) |
|
|
|
|
MicroDexed[instance_id]->setBCController(configuration.dexed[instance_id].bc_range, configuration.dexed[instance_id].bc_assign); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
lcd_display_bar("BC Range", configuration.dexed[instance_id].bc_range, BC_RANGE_MIN, BC_RANGE_MAX, false); |
|
|
|
|
lcd_display_bar_int("BC Range", configuration.dexed[instance_id].bc_range, BC_RANGE_MIN, BC_RANGE_MAX, 2, false, false, false, false); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (LCDML.FUNC_close()) // ****** STABLE END *********
|
|
|
|
@ -2580,7 +2578,7 @@ void UI_func_at_range(uint8_t param) |
|
|
|
|
{ |
|
|
|
|
// setup function
|
|
|
|
|
lcd_special_chars(BLOCKBAR); |
|
|
|
|
lcd_display_bar("AT Range", configuration.dexed[instance_id].at_range, AT_RANGE_MIN, AT_RANGE_MAX, true); |
|
|
|
|
lcd_display_bar_int("AT Range", configuration.dexed[instance_id].at_range, AT_RANGE_MIN, AT_RANGE_MAX, 2, false, false, false, true); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (LCDML.FUNC_loop()) // ****** LOOP *********
|
|
|
|
@ -2609,7 +2607,7 @@ void UI_func_at_range(uint8_t param) |
|
|
|
|
MicroDexed[instance_id]->setATController(configuration.dexed[instance_id].at_range, configuration.dexed[instance_id].at_assign); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
lcd_display_bar("AT Range", configuration.dexed[instance_id].at_range, AT_RANGE_MIN, AT_RANGE_MAX, false); |
|
|
|
|
lcd_display_bar_int("AT Range", configuration.dexed[instance_id].at_range, AT_RANGE_MIN, AT_RANGE_MAX, 2, false, false, false, false); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (LCDML.FUNC_close()) // ****** STABLE END *********
|
|
|
|
@ -2831,7 +2829,7 @@ void UI_func_portamento_time(uint8_t param) |
|
|
|
|
if (LCDML.FUNC_setup()) // ****** SETUP *********
|
|
|
|
|
{ |
|
|
|
|
lcd_special_chars(BLOCKBAR); |
|
|
|
|
lcd_display_bar("Portam. Time", configuration.dexed[instance_id].portamento_time, PORTAMENTO_TIME_MIN, PORTAMENTO_TIME_MAX, true); |
|
|
|
|
lcd_display_bar_int("Portam. Time", configuration.dexed[instance_id].portamento_time, PORTAMENTO_TIME_MIN, PORTAMENTO_TIME_MAX, 2, false, false, false, true); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (LCDML.FUNC_loop()) // ****** LOOP *********
|
|
|
|
@ -2860,7 +2858,7 @@ void UI_func_portamento_time(uint8_t param) |
|
|
|
|
MicroDexed[instance_id]->setPortamentoMode(configuration.dexed[instance_id].portamento_mode, configuration.dexed[instance_id].portamento_glissando, configuration.dexed[instance_id].portamento_time); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
lcd_display_bar("Portam. Time", configuration.dexed[instance_id].portamento_time, PORTAMENTO_TIME_MIN, PORTAMENTO_TIME_MAX, false); |
|
|
|
|
lcd_display_bar_int("Portam. Time", configuration.dexed[instance_id].portamento_time, PORTAMENTO_TIME_MIN, PORTAMENTO_TIME_MAX, 2, false, false, false, false); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (LCDML.FUNC_close()) // ****** STABLE END *********
|
|
|
|
@ -3129,15 +3127,14 @@ void UI_func_volume(uint8_t param) |
|
|
|
|
if (menu_state != MENU_VOLUME) |
|
|
|
|
{ |
|
|
|
|
lcd_special_chars(BLOCKBAR); |
|
|
|
|
lcd_display_bar("Volume", configuration.vol, VOLUME_MIN, VOLUME_MAX, true); |
|
|
|
|
lcd_display_bar_int("Volume", configuration.vol, VOLUME_MIN, VOLUME_MAX, 3, false, false, false, true); |
|
|
|
|
menu_state = MENU_VOLUME; |
|
|
|
|
} |
|
|
|
|
else |
|
|
|
|
lcd_display_bar("Volume", configuration.vol, VOLUME_MIN, VOLUME_MAX, false); |
|
|
|
|
lcd_display_bar_int("Volume", configuration.vol, VOLUME_MIN, VOLUME_MAX, 3, false, false, false, false); |
|
|
|
|
|
|
|
|
|
set_volume(configuration.vol, configuration.mono); |
|
|
|
|
eeprom_write(); |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void UI_func_load(uint8_t param) |
|
|
|
@ -3375,18 +3372,20 @@ void lcd_display_float(float var, uint8_t size_number, uint8_t size_fraction, bo |
|
|
|
|
lcd.print(F("]")); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void lcd_display_bar(const char* title, uint32_t value, uint32_t min_value, uint32_t max_value, bool init) |
|
|
|
|
void lcd_display_bar_int(const char* title, uint32_t value, uint32_t min_value, uint32_t max_value, uint8_t size, bool zeros, bool brackets, bool sign, bool init) |
|
|
|
|
{ |
|
|
|
|
float _v = float(value * LCD_cols) / (max_value - min_value); |
|
|
|
|
float _vi; |
|
|
|
|
uint8_t vf = uint8_t(modff(_v, &_vi) * 10.0); |
|
|
|
|
uint8_t vf = uint8_t(modff(_v, &_vi) * 10.0 + 0.5); |
|
|
|
|
uint8_t vi = uint8_t(_vi); |
|
|
|
|
|
|
|
|
|
if (init == true) |
|
|
|
|
{ |
|
|
|
|
// show initial title, value and bar
|
|
|
|
|
lcd.clear(); |
|
|
|
|
lcd.show(0, 0, LCD_cols, title); |
|
|
|
|
lcd.setCursor(strlen(title) + 1, 0); |
|
|
|
|
lcd_display_int(value, 3, true, false, false); |
|
|
|
|
lcd.setCursor(LCD_cols - (size + 1) + 1, 0); |
|
|
|
|
lcd_display_int(value, size, zeros, brackets, sign); |
|
|
|
|
lcd.setCursor(0, 1); |
|
|
|
|
|
|
|
|
|
if (vi == 0 && uint8_t(vf / 2) == 0) |
|
|
|
@ -3398,7 +3397,7 @@ void lcd_display_bar(const char* title, uint32_t value, uint32_t min_value, uint |
|
|
|
|
{ |
|
|
|
|
for (uint8_t i = 0; i < LCD_cols; i++) |
|
|
|
|
{ |
|
|
|
|
if (i < vi) |
|
|
|
|
if (i <= vi) |
|
|
|
|
lcd.write((uint8_t)4); // full block
|
|
|
|
|
else |
|
|
|
|
lcd.print(F(" ")); |
|
|
|
@ -3406,17 +3405,18 @@ void lcd_display_bar(const char* title, uint32_t value, uint32_t min_value, uint |
|
|
|
|
|
|
|
|
|
if (vf > 1) |
|
|
|
|
{ |
|
|
|
|
lcd.setCursor(vi - 1, 1); |
|
|
|
|
lcd.setCursor(vi, 1); |
|
|
|
|
lcd.write((uint8_t)int(vf / 2) - 1); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
else |
|
|
|
|
{ |
|
|
|
|
uint8_t ca = (float((LCD_cols) / (max_value - min_value)) + 0.5) + 1; |
|
|
|
|
// show only changed value and changed part of the bar
|
|
|
|
|
uint8_t ca = max((float((LCD_cols) / float(max_value - min_value)) + 0.5), 1); |
|
|
|
|
|
|
|
|
|
lcd.setCursor(strlen(title) + 1, 0); |
|
|
|
|
lcd_display_int(value, 3, true, false, false); |
|
|
|
|
lcd.setCursor(LCD_cols - (size + 1) + 1, 0); |
|
|
|
|
lcd_display_int(value, size, zeros, brackets, sign); |
|
|
|
|
|
|
|
|
|
if (vi == 0 && uint8_t(vf / 2) == 0) |
|
|
|
|
{ |
|
|
|
@ -3425,41 +3425,26 @@ void lcd_display_bar(const char* title, uint32_t value, uint32_t min_value, uint |
|
|
|
|
for (uint8_t n = 1; n <= ca; n++) |
|
|
|
|
lcd.print(F(" ")); |
|
|
|
|
} |
|
|
|
|
else if (vi == LCD_cols && uint8_t(vf / 2) == 0) |
|
|
|
|
else if (vi == LCD_cols - 1 && uint8_t(vf / 2) == 0) |
|
|
|
|
{ |
|
|
|
|
lcd.setCursor(LCD_cols - ca - 1, 1); |
|
|
|
|
lcd.write((uint8_t)4); // full block
|
|
|
|
|
for (uint8_t n = LCD_cols - ca; n < LCD_cols; n++) |
|
|
|
|
lcd.setCursor(LCD_cols - 1 - ca, 1); |
|
|
|
|
for (uint8_t n = LCD_cols - 1 - ca; n < LCD_cols; n++) |
|
|
|
|
lcd.write((uint8_t)4); // full block
|
|
|
|
|
} |
|
|
|
|
else |
|
|
|
|
{ |
|
|
|
|
uint8_t b, e; |
|
|
|
|
|
|
|
|
|
if (vi - ca < 0) |
|
|
|
|
b = 0; |
|
|
|
|
else |
|
|
|
|
b = vi - ca; |
|
|
|
|
if (vi + ca >= LCD_cols) |
|
|
|
|
e = LCD_cols; |
|
|
|
|
else |
|
|
|
|
e = vi + ca; |
|
|
|
|
|
|
|
|
|
Serial.print("ca="); |
|
|
|
|
Serial.print(ca); |
|
|
|
|
Serial.print(" b="); |
|
|
|
|
Serial.print(b); |
|
|
|
|
Serial.print(" e="); |
|
|
|
|
Serial.print(e); |
|
|
|
|
Serial.println(); |
|
|
|
|
b = max(0, vi - ca); |
|
|
|
|
e = min(LCD_cols - 1, vi + ca); |
|
|
|
|
|
|
|
|
|
lcd.setCursor(b - 1, 1); |
|
|
|
|
lcd.setCursor(b, 1); |
|
|
|
|
for (uint8_t n = b; n <= e; n++) |
|
|
|
|
{ |
|
|
|
|
if (n < vi) |
|
|
|
|
lcd.write((uint8_t)4); // full block
|
|
|
|
|
else if (n == vi && uint8_t(vf / 2) != 0) |
|
|
|
|
lcd.write((uint8_t)uint8_t(vf / 2) - 1); |
|
|
|
|
lcd.write(uint8_t(vf / 2) - 1); |
|
|
|
|
else |
|
|
|
|
lcd.print(F(" ")); |
|
|
|
|
} |
|
|
|
|