You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
MicroDexed/UI.hpp

3404 lines
104 KiB

/*
MicroDexed
MicroDexed is a port of the Dexed sound engine
(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-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
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software Foundation,
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifdef ENABLE_LCD_UI
#ifndef _UI_HPP_
#define _UI_HPP_
#include "config.h"
5 years ago
#include "Disp_Plus.h"
#include "effect_modulated_delay.h"
#include "effect_stereo_mono.h"
#include "dexed.h"
#include <LCDMenuLib2.h>
//#include <Encoder.h>
#include <MD_REncoder.h>
#define _LCDML_DISP_cols LCD_cols
#define _LCDML_DISP_rows LCD_rows
#ifdef I2C_DISPLAY
#define _LCDML_DISP_cfg_cursor 0x7E // cursor Symbol
#else
#define _LCDML_DISP_cfg_cursor 0x8d // cursor Symbol
#endif
#define _LCDML_DISP_cfg_scrollbar 1 // enable a scrollbar
extern config_t configuration;
extern uint8_t dexed_setup_number;
extern void set_volume(uint8_t v, uint8_t m);
extern char bank_names[NUM_DEXED][MAX_BANKS][BANK_NAME_LEN];
extern char bank_name[NUM_DEXED][BANK_NAME_LEN];
extern char voice_name[NUM_DEXED][VOICE_NAME_LEN];
extern char voice_names[NUM_DEXED][MAX_VOICES][VOICE_NAME_LEN];
extern void strip_extension(char* s, char *target);
extern void eeprom_write(void);
extern bool get_voice_names_from_bank(uint8_t b, uint8_t instance_id);
extern bool load_sysex(uint8_t b, uint8_t v);
extern void generate_version_string(char* buffer, uint8_t len);
#ifdef DISPLAY_LCD_SPI
extern void change_disp_sd(bool d);
#endif
#ifdef USE_FX
extern AudioEffectDelay delay_r;
extern AudioEffectDelay delay_l;
extern AudioEffectFreeverb freeverb_r;
extern AudioEffectFreeverb freeverb_l;
extern AudioMixer4 reverb_send_mixer_r;
extern AudioMixer4 reverb_send_mixer_l;
extern AudioEffectModulatedDelay modchorus_r;
extern AudioEffectModulatedDelay modchorus_l;
extern AudioSynthWaveform chorus_modulator;
extern AudioMixer4 chorus_send_mixer_r;
extern AudioMixer4 chorus_send_mixer_l;
extern AudioMixer4 delay_send_mixer_r;
extern AudioMixer4 delay_send_mixer_l;
extern AudioMixer4 delay_fb_mixer_r;
extern AudioMixer4 delay_fb_mixer_l;
#endif
extern AudioMixer4 master_mixer_r;
extern AudioMixer4 master_mixer_l;
extern AudioAmplifier volume_r;
extern AudioAmplifier volume_l;
extern AudioEffectStereoMono stereo2mono;
extern AudioSourceMicroDexed* MicroDexed[NUM_DEXED];
extern AudioAmplifier* dexed_level[NUM_DEXED];
extern AudioEffectMonoStereo* mono2stereo[NUM_DEXED];
extern AudioSynthWaveformDc* pan[NUM_DEXED];
extern uint8_t selected_dexed_instance;
/***********************************************************************
GLOBAL
************************************************************************/
elapsedMillis back_from_volume;
#ifdef I2C_DISPLAY
5 years ago
#include <LiquidCrystal_I2C.h>
Disp_Plus<LiquidCrystal_I2C> lcd(LCD_I2C_ADDRESS, _LCDML_DISP_cols, _LCDML_DISP_rows);
#endif
#ifdef U8X8_DISPLAY
5 years ago
#include <U8x8lib.h>
#ifdef U8X8_HAVE_HW_SPI
#include <SPI.h>
#endif
#ifdef U8X8_HAVE_HW_I2C
#include <Wire.h>
#endif
Disp_Plus<U8X8_DISPLAY_CLASS> lcd(/* cs=*/ U8X8_CS_PIN, /* dc=*/ U8X8_DC_PIN, /* reset=*/ U8X8_RESET_PIN);
//Disp_Plus<U8X8_DISPLAY_CLASS> lcd(U8X8_PIN_NONE);
#endif
const uint8_t scroll_bar[5][8] = {
{B10001, B10001, B10001, B10001, B10001, B10001, B10001, B10001}, // scrollbar top
{B11111, B11111, B10001, B10001, B10001, B10001, B10001, B10001}, // scroll state 1
{B10001, B10001, B11111, B11111, B10001, B10001, B10001, B10001}, // scroll state 2
{B10001, B10001, B10001, B10001, B11111, B11111, B10001, B10001}, // scroll state 3
{B10001, B10001, B10001, B10001, B10001, B10001, B11111, B11111} // scrollbar bottom
};
const uint8_t block_bar[5][8] = {
{B10000, B10000, B10000, B10000, B10000, B10000, B10000, B10000},
{B11000, B11000, B11000, B11000, B11000, B11000, B11000, B11000},
{B11100, B11100, B11100, B11100, B11100, B11100, B11100, B11100},
{B11110, B11110, B11110, B11110, B11110, B11110, B11110, B11110},
{B11111, B11111, B11111, B11111, B11111, B11111, B11111, B11111}
};
const uint8_t meter_bar[5][8] = {
{B10000, B10000, B10000, B10000, B10000, B10000, B10000, B10000},
{B01000, B01000, B01000, B01000, B01000, B01000, B01000, B01000},
{B00100, B00100, B00100, B00100, B00100, B00100, B00100, B00100},
{B00010, B00010, B00010, B00010, B00010, B00010, B00010, B00010},
{B00001, B00001, B00001, B00001, B00001, B00001, B00001, B00001}
};
enum { SCROLLBAR, BLOCKBAR, METERBAR };
enum { ENC_R, ENC_L };
enum { MENU_START, MENU_VOICE, MENU_EDIT, MENU_VOLUME };
enum {MENU_VOICE_BANK, MENU_VOICE_SOUND};
uint8_t menu_state = MENU_START;
uint8_t menu_voice = MENU_VOICE_SOUND;
void lcdml_menu_display(void);
void lcdml_voice_menu_display(void);
void lcdml_menu_clear(void);
void lcdml_menu_control(void);
void encoder_right_up(void);
void encoder_right_down(void);
void encoder_right_button_long(void);
void encoder_right_button_short(void);
void encoder_left_up(void);
void encoder_left_down(void);
void encoder_left_button_long(void);
void encoder_left_button_short(void);
void lcdml_voice_menu_control(void);
void UI_func_sound(uint8_t param);
#ifdef USE_FX
void UI_func_reverb_roomsize(uint8_t param);
void UI_func_reverb_damping(uint8_t param);
void UI_func_reverb_send(uint8_t param);
void UI_func_reverb_level(uint8_t param);
void UI_func_chorus_frequency(uint8_t param);
void UI_func_chorus_waveform(uint8_t param);
void UI_func_chorus_depth(uint8_t param);
void UI_func_chorus_send(uint8_t param);
void UI_func_chorus_level(uint8_t param);
void UI_func_delay_time(uint8_t param);
void UI_func_delay_feedback(uint8_t param);
void UI_func_delay_send(uint8_t param);
void UI_func_delay_level(uint8_t param);
void UI_func_filter_cutoff(uint8_t param);
void UI_func_filter_resonance(uint8_t param);
#endif
void UI_func_transpose(uint8_t param);
void UI_func_tune(uint8_t param);
void UI_func_midi_channel(uint8_t param);
void UI_func_sound_intensity(uint8_t param);
void UI_func_panorama(uint8_t param);
void UI_func_stereo_mono(uint8_t param);
void UI_func_note_refresh(uint8_t param);
void UI_func_polyphony(uint8_t param);
void UI_func_engine(uint8_t param);
void UI_func_mono_poly(uint8_t param);
void UI_func_pb_range(uint8_t param);
void UI_func_pb_step(uint8_t param);
void UI_func_mw_range(uint8_t param);
void UI_func_mw_assign(uint8_t param);
void UI_func_mw_mode(uint8_t param);
void UI_func_fc_range(uint8_t param);
void UI_func_fc_assign(uint8_t param);
void UI_func_fc_mode(uint8_t param);
void UI_func_bc_range(uint8_t param);
void UI_func_bc_assign(uint8_t param);
void UI_func_bc_mode(uint8_t param);
void UI_func_at_range(uint8_t param);
void UI_func_at_assign(uint8_t param);
void UI_func_at_mode(uint8_t param);
void UI_func_portamento_mode(uint8_t param);
void UI_func_portamento_glissando(uint8_t param);
void UI_func_portamento_time(uint8_t param);
void UI_func_OP1(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_voice_selection(uint8_t param);
void UI_func_volume(uint8_t param);
void UI_func_load(uint8_t param);
void UI_func_save(uint8_t param);
void UI_func_midi_soft_thru(uint8_t param);
void UI_func_velocity_level(uint8_t param);
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_int(const char* title, uint32_t value, float factor, int32_t min_value, int32_t max_value, uint8_t size, bool zeros, bool brackets, bool sign, bool init);
void lcd_display_bar_float(const char* title, float value, float factor, 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_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_special_chars(uint8_t mode);
// normal menu
LCDMenuLib2_menu LCDML_0(255, 0, 0, NULL, NULL); // normal root menu element (do not change)
LCDMenuLib2 LCDML(LCDML_0, _LCDML_DISP_rows, _LCDML_DISP_cols, lcdml_menu_display, lcdml_menu_clear, lcdml_menu_control);
#if defined(NUM_DEXED)>1 && defined(USE_FX)
#include "UI_2_FX.h"
#elif defined(NUM_DEXED)==1 && defined(USE_FX)
#include "UI_1_FX.h"
#elif defined(NUM_DEXED)==2 && !defined(USE_FX)
#include "UI_2.h"
#else
#include "UI_1.h"
#endif
// create menu
LCDML_createMenu(_LCDML_DISP_cnt);
/***********************************************************************
CONTROL
***********************************************************************/
#define g_LCDML_CONTROL_button_long_press LONG_BUTTON_PRESS
#define g_LCDML_CONTROL_button_short_press BUT_DEBOUNCE_MS
//Encoder ENCODER[NUM_ENCODER] = {Encoder(ENC_R_PIN_B, ENC_R_PIN_A), Encoder(ENC_L_PIN_B, ENC_L_PIN_A)};
MD_REncoder ENCODER[NUM_ENCODER] = {MD_REncoder(ENC_R_PIN_B, ENC_R_PIN_A), MD_REncoder(ENC_L_PIN_B, ENC_L_PIN_A)};
long g_LCDML_CONTROL_button_press_time[NUM_ENCODER] = {0, 0};
bool g_LCDML_CONTROL_button_prev[NUM_ENCODER] = {HIGH, HIGH};
uint8_t g_LCDML_CONTROL_prev[NUM_ENCODER] = {0, 0};
5 years ago
#ifdef U8X8_DISPLAY
const uint8_t * flipped_scroll_bar[5];
const uint8_t * flipped_block_bar[5];
uint8_t * rotTile(const uint8_t * tile) {
uint8_t * newt = new uint8_t[8];
for (int x = 0; x < 8; x++) {
uint8_t newb = 0;
for (int y = 0 ; y < 8; y++) {
newb |= (tile[y] << x) & 0x80;
newb >>= 1;
}
newt[x] = newb;
}
return newt;
}
#endif
void setup_ui(void) {
// LCD Begin
#ifdef I2C_DISPLAY
lcd.init();
lcd.backlight();
lcd.clear();
lcd.blink_off();
lcd.cursor_off();
lcd.backlight();
#else
lcd.begin();
lcd.clear();
lcd.setFont(u8x8_font_amstrad_cpc_extended_f);
#endif
lcd.setCursor(3, 0);
lcd.print(F("MicroDexed"));
lcd.setCursor(0, 1);
lcd.print(F("(c)parasiTstudio"));
lcd_special_chars(SCROLLBAR);
// LCDMenuLib Setup
LCDML_setup(_LCDML_DISP_cnt);
// Enable Menu Rollover
//LCDML.MENU_enRollover();
// Enable Screensaver (screensaver menu function, time to activate in ms)
//LCDML.SCREEN_enable(UI_func_voice_selection, VOICE_SELECTION_MS); // set to 10 seconds
}
#ifdef DEBUG
void setup_debug_message(void) {
// LCD Begin
lcd.clear();
lcd.setCursor(1, 0);
lcd.print(F("* DEBUG MODE *"));
lcd.setCursor(1, 1);
lcd.print(F("ENABLE CONSOLE"));
}
#endif
5 years ago
void lcdml_menu_control(void)
{
// If something must init, put in in the setup condition
if (LCDML.BT_setup())
5 years ago
{
pinMode(BUT_R_PIN, INPUT_PULLUP);
5 years ago
pinMode(BUT_L_PIN, INPUT_PULLUP);
ENCODER[ENC_L].begin();
ENCODER[ENC_R].begin();
5 years ago
}
if (back_from_volume > BACK_FROM_VOLUME_MS && menu_state == MENU_VOLUME)
{
lcd_special_chars(SCROLLBAR);
UI_func_voice_selection(0);
}
5 years ago
//Volatile Variable
long g_LCDML_CONTROL_Encoder_position[NUM_ENCODER] = {ENCODER[ENC_R].read(), ENCODER[ENC_L].read()};
bool button[NUM_ENCODER] = {digitalRead(BUT_R_PIN), digitalRead(BUT_L_PIN)};
5 years ago
/************************************************************************************
Basic encoder handlying (from LCDMenuLib2)
************************************************************************************/
// RIGHT
if (g_LCDML_CONTROL_Encoder_position[ENC_R] <= -3)
{
if (!button[ENC_R])
5 years ago
{
LCDML.BT_right();
5 years ago
g_LCDML_CONTROL_button_prev[ENC_R] = LOW;
g_LCDML_CONTROL_button_press_time[ENC_R] = -1;
}
else
{
encoder_right_up();
5 years ago
}
ENCODER[ENC_R].write(g_LCDML_CONTROL_Encoder_position[ENC_R] + 4);
5 years ago
}
else if (g_LCDML_CONTROL_Encoder_position[ENC_R] >= 3)
5 years ago
{
if (!button[ENC_R])
5 years ago
{
LCDML.BT_right();
g_LCDML_CONTROL_button_prev[ENC_R] = LOW;
g_LCDML_CONTROL_button_press_time[ENC_R] = -1;
}
else
{
encoder_right_down();
5 years ago
}
ENCODER[ENC_R].write(g_LCDML_CONTROL_Encoder_position[ENC_R] - 4);
5 years ago
}
else
{
if (!button[ENC_R] && g_LCDML_CONTROL_button_prev[ENC_R]) // falling edge, button[ENC_R] pressed
5 years ago
{
g_LCDML_CONTROL_button_prev[ENC_R] = LOW;
g_LCDML_CONTROL_button_press_time[ENC_R] = millis();
}
else if (button[ENC_R] && !g_LCDML_CONTROL_button_prev[ENC_R]) // rising edge, button[ENC_R] not active
{
g_LCDML_CONTROL_button_prev[ENC_R] = HIGH;
if (g_LCDML_CONTROL_button_press_time[ENC_R] < 0)
{
g_LCDML_CONTROL_button_press_time[ENC_R] = millis();
//Reset for left right action
}
else if ((millis() - g_LCDML_CONTROL_button_press_time[ENC_R]) >= g_LCDML_CONTROL_button_long_press)
{
encoder_right_button_long();
}
else if ((millis() - g_LCDML_CONTROL_button_press_time[ENC_R]) >= g_LCDML_CONTROL_button_short_press)
{
encoder_right_button_short();
}
}
}
// LEFT
5 years ago
if (g_LCDML_CONTROL_Encoder_position[ENC_L] <= -3)
{
if (!button[ENC_L])
{
//LCDML.BT_left();
g_LCDML_CONTROL_button_prev[ENC_L] = LOW;
g_LCDML_CONTROL_button_press_time[ENC_L] = -1;
}
else
{
encoder_left_up();
5 years ago
}
ENCODER[ENC_L].write(g_LCDML_CONTROL_Encoder_position[ENC_L] + 4);
}
else if (g_LCDML_CONTROL_Encoder_position[ENC_L] >= 3)
{
if (!button[ENC_L])
{
//LCDML.BT_right();
g_LCDML_CONTROL_button_prev[ENC_L] = LOW;
g_LCDML_CONTROL_button_press_time[ENC_L] = -1;
}
else
{
encoder_left_down();
5 years ago
}
ENCODER[ENC_L].write(g_LCDML_CONTROL_Encoder_position[ENC_L] - 4);
}
else
{
if (!button[ENC_L] && g_LCDML_CONTROL_button_prev[ENC_L]) // falling edge, button[ENC_L] pressed
{
5 years ago
g_LCDML_CONTROL_button_prev[ENC_L] = LOW;
g_LCDML_CONTROL_button_press_time[ENC_L] = millis();
}
else if (button[ENC_L] && !g_LCDML_CONTROL_button_prev[ENC_L]) // rising edge, button[ENC_L] not active
5 years ago
{
g_LCDML_CONTROL_button_prev[ENC_L] = HIGH;
if (g_LCDML_CONTROL_button_press_time[ENC_L] < 0)
{
5 years ago
g_LCDML_CONTROL_button_press_time[ENC_L] = millis();
//Reset for left right action
}
5 years ago
else if ((millis() - g_LCDML_CONTROL_button_press_time[ENC_L]) >= g_LCDML_CONTROL_button_long_press)
{
5 years ago
//LCDML.BT_quit();
encoder_left_button_long();
}
5 years ago
else if ((millis() - g_LCDML_CONTROL_button_press_time[ENC_L]) >= g_LCDML_CONTROL_button_short_press)
{
//LCDML.BT_enter();
encoder_left_button_short();
}
}
}
}
/************************************************************************************
RIGHT Encoder functions
************************************************************************************/
void encoder_right_up(void)
{
uint8_t instance_id = 0;
int8_t voice_tmp;
uint8_t bank_tmp;
if (LCDML.FUNC_getID() > MENU_ID_OF_INSTANCE_2 && LCDML.FUNC_getID() != 255)
instance_id = 1;
switch (menu_state)
{
case MENU_EDIT:
case MENU_VOLUME:
menu_state = MENU_EDIT;
LCDML.BT_down();
break;
case MENU_VOICE:
5 years ago
#ifdef DEBUG
Serial.println(F("State: MENU_VOICE, Encoder right up"));
5 years ago
#endif
switch (menu_voice)
{
case MENU_VOICE_BANK:
bank_tmp = constrain(configuration.dexed[instance_id].bank + ENCODER[ENC_R].speed(), 0, MAX_BANKS - 1);
configuration.dexed[instance_id].bank = bank_tmp;
#ifdef DISPLAY_LCD_SPI
change_disp_sd(false);
#endif
load_sysex(configuration.dexed[instance_id].bank, configuration.dexed[instance_id].voice, instance_id);
get_voice_names_from_bank(configuration.dexed[instance_id].bank, instance_id);
#ifdef DISPLAY_LCD_SPI
change_disp_sd(true);
#endif
eeprom_write();
break;
case MENU_VOICE_SOUND:
voice_tmp = configuration.dexed[instance_id].voice + ENCODER[ENC_R].speed();
if (voice_tmp >= MAX_VOICES && configuration.dexed[instance_id].bank + 1 < MAX_BANKS)
{
voice_tmp %= MAX_VOICES;
configuration.dexed[instance_id].bank++;
configuration.dexed[instance_id].bank = constrain(configuration.dexed[instance_id].bank, 0, MAX_BANKS - 1);
}
else if (voice_tmp >= MAX_VOICES && configuration.dexed[instance_id].bank + 1 >= MAX_BANKS)
{
voice_tmp = MAX_VOICES - 1;
}
configuration.dexed[instance_id].voice = voice_tmp;
#ifdef DISPLAY_LCD_SPI
change_disp_sd(false);
#endif
load_sysex(configuration.dexed[instance_id].bank, configuration.dexed[instance_id].voice, instance_id);
get_voice_names_from_bank(configuration.dexed[instance_id].bank, instance_id);
#ifdef DISPLAY_LCD_SPI
change_disp_sd(true);
#endif
eeprom_write();
break;
5 years ago
}
UI_func_voice_selection(0);
break;
}
}
void encoder_right_down(void)
{
uint8_t instance_id = 0;
int8_t voice_tmp;
uint8_t bank_tmp;
if (LCDML.FUNC_getID() > MENU_ID_OF_INSTANCE_2 && LCDML.FUNC_getID() != 255)
instance_id = 1;
switch (menu_state)
{
case MENU_EDIT:
case MENU_VOLUME:
menu_state = MENU_EDIT;
LCDML.BT_up();
break;
case MENU_VOICE:
#ifdef DEBUG
Serial.println(F("State: MENU_VOICE, Encoder right down"));
#endif
switch (menu_voice)
{
case MENU_VOICE_BANK:
bank_tmp = constrain(configuration.dexed[instance_id].bank - ENCODER[ENC_R].speed(), 0, MAX_BANKS - 1);
configuration.dexed[instance_id].bank = bank_tmp;
#ifdef DISPLAY_LCD_SPI
change_disp_sd(false);
#endif
load_sysex(configuration.dexed[instance_id].bank, configuration.dexed[instance_id].voice, instance_id);
get_voice_names_from_bank(configuration.dexed[instance_id].bank, instance_id);
#ifdef DISPLAY_LCD_SPI
change_disp_sd(true);
#endif
eeprom_write();
break;
case MENU_VOICE_SOUND:
voice_tmp = configuration.dexed[instance_id].voice - ENCODER[ENC_R].speed();
if (voice_tmp < 0 && configuration.dexed[instance_id].bank - 1 >= 0)
{
configuration.dexed[instance_id].bank--;
configuration.dexed[instance_id].bank = constrain(configuration.dexed[instance_id].bank, 0, MAX_BANKS - 1);
}
else if (voice_tmp < 0 && configuration.dexed[instance_id].bank - 1 <= 0)
{
voice_tmp = 0;
}
if (voice_tmp < 0)
voice_tmp = MAX_VOICES + voice_tmp;
configuration.dexed[instance_id].voice = voice_tmp;
#ifdef DISPLAY_LCD_SPI
change_disp_sd(false);
#endif
load_sysex(configuration.dexed[instance_id].bank, configuration.dexed[instance_id].voice, instance_id);
get_voice_names_from_bank(configuration.dexed[instance_id].bank, instance_id);
#ifdef DISPLAY_LCD_SPI
change_disp_sd(true);
#endif
eeprom_write();
break;
}
UI_func_voice_selection(0);
break;
}
}
void encoder_right_button_long(void)
{
#ifdef DEBUG
Serial.println(F("Encoder right long press"));
#endif
LCDML.BT_quit();
}
void encoder_right_button_short(void)
{
#ifdef DEBUG
Serial.println(F("Encoder right short press"));
#endif
if (menu_state == MENU_EDIT)
{
LCDML.BT_enter();
}
else if (menu_state == MENU_VOICE)
{
#ifdef DEBUG
Serial.println(F("State: MENU_VOICE, button short press"));
#endif
if (menu_voice == MENU_VOICE_BANK)
menu_voice = MENU_VOICE_SOUND;
else
menu_voice = MENU_VOICE_BANK;
UI_func_voice_selection(0);
}
}
/************************************************************************************
LEFT Encoder functions
************************************************************************************/
void encoder_left_up(void)
{
#ifdef DEBUG
Serial.println(F("Volume +"));
#endif
configuration.vol = constrain(configuration.vol + ENCODER[ENC_L].speed(), VOLUME_MIN, VOLUME_MAX);
//eeprom_write();
//set_volume(configuration.vol, configuration.mono);
UI_func_volume(0);
}
void encoder_left_down(void)
{
#ifdef DEBUG
Serial.println(F("Volume -"));
#endif
configuration.vol = constrain(configuration.vol - ENCODER[ENC_L].speed(), VOLUME_MIN, VOLUME_MAX);
//eeprom_write();
//set_volume(configuration.vol, configuration.mono);
UI_func_volume(0);
}
void encoder_left_button_long(void)
{
#ifdef DEBUG
Serial.println(F("Encoder left long press"));
#endif
if (menu_state == MENU_EDIT)
{
menu_state = MENU_VOICE;
UI_func_voice_selection(0);
}
else if (menu_state == MENU_VOICE)
{
menu_state = MENU_EDIT;
LCDML.MENU_goRoot();
}
}
void encoder_left_button_short(void)
{
#ifdef DEBUG
Serial.println(F("Encoder left short press"));
#endif
if (menu_state == MENU_EDIT)
{
//LCDML.FUNC_goBackToMenu();
LCDML.BT_quit();
}
else if (menu_state == MENU_VOICE)
{
menu_state = MENU_EDIT;
LCDML.MENU_goRoot();
5 years ago
}
}
/***********************************************************************
DISPLAY
***********************************************************************/
void lcdml_menu_clear(void)
{
lcd.clear();
lcd.setCursor(0, 0);
}
void lcdml_menu_display(void)
{
// update content
// ***************
if (LCDML.DISP_checkMenuUpdate()) {
// clear menu
// ***************
LCDML.DISP_clear();
// declaration of some variables
// ***************
// content variable
char content_text[_LCDML_DISP_cols]; // save the content text of every menu element
// menu element object
LCDMenuLib2_menu *tmp;
// some limit values
uint8_t i = LCDML.MENU_getScroll();
uint8_t maxi = _LCDML_DISP_rows + i;
uint8_t n = 0;
// check if this element has children
if ((tmp = LCDML.MENU_getDisplayedObj()) != NULL)
{
// loop to display lines
do
{
// check if a menu element has a condition and if the condition be true
if (tmp->checkCondition())
{
// check the type off a menu element
if (tmp->checkType_menu() == true)
{
// display normal content
LCDML_getContent(content_text, tmp->getID());
lcd.setCursor(1, n);
lcd.print(content_text);
}
else
{
if (tmp->checkType_dynParam()) {
tmp->callback(n);
}
}
// increment some values
i++;
n++;
}
// try to go to the next sibling and check the number of displayed rows
} while (((tmp = tmp->getSibling(1)) != NULL) && (i < maxi));
}
}
if (LCDML.DISP_checkMenuCursorUpdate())
{
// init vars
uint8_t n_max = (LCDML.MENU_getChilds() >= _LCDML_DISP_rows) ? _LCDML_DISP_rows : (LCDML.MENU_getChilds());
uint8_t scrollbar_min = 0;
uint8_t scrollbar_max = LCDML.MENU_getChilds();
uint8_t scrollbar_cur_pos = LCDML.MENU_getCursorPosAbs();
uint8_t scroll_pos = ((1.*n_max * _LCDML_DISP_rows) / (scrollbar_max - 1) * scrollbar_cur_pos);
// display rows
for (uint8_t n = 0; n < n_max; n++)
{
//set cursor
lcd.setCursor(0, n);
//set cursor char
if (n == LCDML.MENU_getCursorPos()) {
lcd.write(_LCDML_DISP_cfg_cursor);
} else {
lcd.write(' ');
}
// delete or reset scrollbar
if (_LCDML_DISP_cfg_scrollbar == 1) {
if (scrollbar_max > n_max) {
#ifdef I2C_DISPLAY
lcd.setCursor((_LCDML_DISP_cols - 1), n);
lcd.write((uint8_t)0);
#else
lcd.drawTile((_LCDML_DISP_cols - 1), n, 1, flipped_scroll_bar[0]);
lcd.setCursor((_LCDML_DISP_cols), n + 1);
#endif
}
else {
lcd.setCursor((_LCDML_DISP_cols - 1), n);
lcd.print(F(" "));
}
}
}
// display scrollbar
if (_LCDML_DISP_cfg_scrollbar == 1) {
if (scrollbar_max > n_max) {
//set scroll position
if (scrollbar_cur_pos == scrollbar_min) {
// min pos
#ifdef I2C_DISPLAY
lcd.setCursor((_LCDML_DISP_cols - 1), 0);
lcd.write((uint8_t)1);
#else
lcd.drawTile((_LCDML_DISP_cols - 1), 0, 1, flipped_scroll_bar[1]);
lcd.setCursor((_LCDML_DISP_cols), 1);
#endif
} else if (scrollbar_cur_pos == (scrollbar_max - 1)) {
// max pos
#ifdef I2C_DISPLAY
lcd.setCursor((_LCDML_DISP_cols - 1), (n_max - 1));
lcd.write((uint8_t)4);
#else
lcd.drawTile((_LCDML_DISP_cols - 1), (n_max - 1), 1, flipped_scroll_bar[4]);
lcd.setCursor((_LCDML_DISP_cols), (n_max));
#endif
} else {
// between
#ifdef I2C_DISPLAY
lcd.setCursor((_LCDML_DISP_cols - 1), scroll_pos / n_max);
lcd.write((uint8_t)(scroll_pos % n_max) + 1);
#else
lcd.drawTile((_LCDML_DISP_cols - 1), scroll_pos / n_max, 1, flipped_scroll_bar[(scroll_pos % n_max) + 1]);
lcd.setCursor((_LCDML_DISP_cols), (scroll_pos / n_max) + 1);
#endif
}
}
}
}
}
//####################################################################################################################################################################################################
/***********************************************************************
MENU
***********************************************************************/
#ifdef USE_FX
void UI_func_reverb_roomsize(uint8_t param)
{
if (LCDML.FUNC_setup()) // ****** SETUP *********
{
// setup function
lcd_special_chars(BLOCKBAR);
lcd_display_bar_int("Reverb Room", configuration.reverb_roomsize, 1.0, REVERB_ROOMSIZE_MIN, REVERB_ROOMSIZE_MAX, 3, false, false, false, true);
}
if (LCDML.FUNC_loop()) // ****** LOOP *********
{
if (LCDML.BT_checkEnter())
{
LCDML.FUNC_goBackToMenu();
}
else if (LCDML.BT_checkDown() || LCDML.BT_checkUp())
{
if (LCDML.BT_checkDown())
configuration.reverb_roomsize = constrain(configuration.reverb_roomsize + ENCODER[ENC_R].speed(), REVERB_ROOMSIZE_MIN, REVERB_ROOMSIZE_MAX);
else if (LCDML.BT_checkUp())
configuration.reverb_roomsize = constrain(configuration.reverb_roomsize - ENCODER[ENC_R].speed(), REVERB_ROOMSIZE_MIN, REVERB_ROOMSIZE_MAX);
lcd_display_bar_int("Reverb Room", configuration.reverb_roomsize, 1.0, REVERB_ROOMSIZE_MIN, REVERB_ROOMSIZE_MAX, 3, false, false, false, false);
freeverb_r.roomsize(mapfloat(configuration.reverb_roomsize, REVERB_ROOMSIZE_MIN, REVERB_ROOMSIZE_MAX, 0.0, 1.0));
freeverb_l.roomsize(mapfloat(configuration.reverb_roomsize, REVERB_ROOMSIZE_MIN, REVERB_ROOMSIZE_MAX, 0.0, 1.0));
}
}
if (LCDML.FUNC_close()) // ****** STABLE END *********
{
lcd_special_chars(SCROLLBAR);
eeprom_write();
}
}
void UI_func_reverb_damping(uint8_t param)
{
if (LCDML.FUNC_setup()) // ****** SETUP *********
{
// setup function
lcd_special_chars(BLOCKBAR);
lcd_display_bar_int("Reverb Damp.", configuration.reverb_damping, 1.0, REVERB_DAMPING_MIN, REVERB_DAMPING_MAX, 3, false, false, false, true);
}
if (LCDML.FUNC_loop()) // ****** LOOP *********
{
if (LCDML.BT_checkEnter())
{
LCDML.FUNC_goBackToMenu();
}
else if (LCDML.BT_checkDown() || LCDML.BT_checkUp())
{
if (LCDML.BT_checkDown())
configuration.reverb_damping = constrain(configuration.reverb_damping + ENCODER[ENC_R].speed(), REVERB_DAMPING_MIN, REVERB_DAMPING_MAX);
else if (LCDML.BT_checkUp())
configuration.reverb_damping = constrain(configuration.reverb_damping - ENCODER[ENC_R].speed(), REVERB_DAMPING_MIN, REVERB_DAMPING_MAX);
lcd_display_bar_int("Reverb Damp.", configuration.reverb_damping, 1.0, REVERB_DAMPING_MIN, REVERB_DAMPING_MAX, 3, false, false, false, false);
freeverb_r.damping(mapfloat(configuration.reverb_damping, REVERB_DAMPING_MIN, REVERB_DAMPING_MAX, 0.0, 1.0));
freeverb_l.damping(mapfloat(configuration.reverb_damping, REVERB_DAMPING_MIN, REVERB_DAMPING_MAX, 0.0, 1.0));
}
}
if (LCDML.FUNC_close()) // ****** STABLE END *********
{
lcd_special_chars(SCROLLBAR);
eeprom_write();
}
}
void UI_func_reverb_send(uint8_t param)
{
uint8_t instance_id = 0;
if (LCDML.FUNC_getID() > MENU_ID_OF_INSTANCE_2)
instance_id = 1;
if (LCDML.FUNC_setup()) // ****** SETUP *********
{
// setup function
lcd_special_chars(BLOCKBAR);
lcd_display_bar_int("Reverb Send", configuration.dexed[instance_id].reverb_send, 1.0, REVERB_SEND_MIN, REVERB_SEND_MAX, 3, false, false, false, true);
}
if (LCDML.FUNC_loop()) // ****** LOOP *********
{
if (LCDML.BT_checkEnter())
{
LCDML.FUNC_goBackToMenu();
}
else if (LCDML.BT_checkDown() || LCDML.BT_checkUp())
{
if (LCDML.BT_checkDown())
configuration.dexed[instance_id].reverb_send = constrain(configuration.dexed[instance_id].reverb_send + ENCODER[ENC_R].speed(), REVERB_SEND_MIN, REVERB_SEND_MAX);
else if (LCDML.BT_checkUp())
configuration.dexed[instance_id].reverb_send = constrain(configuration.dexed[instance_id].reverb_send - ENCODER[ENC_R].speed(), REVERB_SEND_MIN, REVERB_SEND_MAX);
lcd_display_bar_int("Reverb Send", configuration.dexed[instance_id].reverb_send, 1.0, REVERB_SEND_MIN, REVERB_SEND_MAX, 3, false, false, false, false);
reverb_send_mixer_r.gain(instance_id, configuration.dexed[instance_id].reverb_send / 100.0);
reverb_send_mixer_l.gain(instance_id, configuration.dexed[instance_id].reverb_send / 100.0);
}
}
if (LCDML.FUNC_close()) // ****** STABLE END *********
{
lcd_special_chars(SCROLLBAR);
eeprom_write();
}
}
void UI_func_reverb_level(uint8_t param)
{
if (LCDML.FUNC_setup()) // ****** SETUP *********
{
// setup function
lcd_special_chars(BLOCKBAR);
lcd_display_bar_int("Reverb Level", configuration.reverb_level, 1.0, REVERB_LEVEL_MIN, REVERB_LEVEL_MAX, 3, false, false, false, true);
}
if (LCDML.FUNC_loop()) // ****** LOOP *********
{
if (LCDML.BT_checkEnter())
{
LCDML.FUNC_goBackToMenu();
}
else if (LCDML.BT_checkDown() || LCDML.BT_checkUp())
{
if (LCDML.BT_checkDown())
configuration.reverb_level = constrain(configuration.reverb_level + ENCODER[ENC_R].speed(), REVERB_LEVEL_MIN, REVERB_LEVEL_MAX);
else if (LCDML.BT_checkUp())
configuration.reverb_level = constrain(configuration.reverb_level - ENCODER[ENC_R].speed(), REVERB_LEVEL_MIN, REVERB_LEVEL_MAX);
lcd_display_bar_int("Reverb Level", configuration.reverb_level, 1.0, REVERB_LEVEL_MIN, REVERB_LEVEL_MAX, 3, false, false, false, true);
master_mixer_r.gain(REVERB, mapfloat(configuration.reverb_level, REVERB_LEVEL_MIN, REVERB_LEVEL_MAX, 0.0, 1.0));
master_mixer_l.gain(REVERB, mapfloat(configuration.reverb_level, REVERB_LEVEL_MIN, REVERB_LEVEL_MAX, 0.0, 1.0));
}
}
if (LCDML.FUNC_close()) // ****** STABLE END *********
{
lcd_special_chars(SCROLLBAR);
eeprom_write();
}
}
void UI_func_chorus_frequency(uint8_t param)
{
if (LCDML.FUNC_setup()) // ****** SETUP *********
{
// setup function
lcd_special_chars(BLOCKBAR);
lcd_display_bar_float("Chorus Frq.", configuration.chorus_frequency, 0.1, CHORUS_FREQUENCY_MIN, CHORUS_FREQUENCY_MAX, 2, 1, false, false, false, true);
}
if (LCDML.FUNC_loop()) // ****** LOOP *********
{
if (LCDML.BT_checkEnter())
{
LCDML.FUNC_goBackToMenu();
}
else if (LCDML.BT_checkDown() || LCDML.BT_checkUp())
{
if (LCDML.BT_checkDown())
configuration.chorus_frequency = constrain(configuration.chorus_frequency + ENCODER[ENC_R].speed(), CHORUS_FREQUENCY_MIN, CHORUS_FREQUENCY_MAX);
else if (LCDML.BT_checkUp())
configuration.chorus_frequency = constrain(configuration.chorus_frequency - ENCODER[ENC_R].speed(), CHORUS_FREQUENCY_MIN, CHORUS_FREQUENCY_MAX);
lcd_display_bar_float("Chorus Frq.", configuration.chorus_frequency, 0.1, CHORUS_FREQUENCY_MIN, CHORUS_FREQUENCY_MAX, 2, 1, false, false, false, false);
chorus_modulator.frequency(configuration.chorus_frequency / 10.0);
}
}
if (LCDML.FUNC_close()) // ****** STABLE END *********
{
lcd_special_chars(SCROLLBAR);
eeprom_write();
}
}
void UI_func_chorus_waveform(uint8_t param)
{
if (LCDML.FUNC_setup()) // ****** SETUP *********
{
// setup function
lcd.setCursor(0, 0);
lcd.print(F("Chorus Waveform"));
}
if (LCDML.FUNC_loop()) // ****** LOOP *********
{
if (LCDML.BT_checkEnter())
LCDML.FUNC_goBackToMenu();
else if (LCDML.BT_checkDown())
configuration.chorus_waveform = constrain(configuration.chorus_waveform + 1, CHORUS_WAVEFORM_MIN, CHORUS_WAVEFORM_MAX);
else if (LCDML.BT_checkUp())
configuration.chorus_waveform = constrain(configuration.chorus_waveform - 1, CHORUS_WAVEFORM_MIN, CHORUS_WAVEFORM_MAX);
lcd.setCursor(0, 1);
switch (configuration.chorus_waveform)
{
case 0:
chorus_modulator.begin(WAVEFORM_TRIANGLE);
lcd.print(F("[TRIANGLE]"));
break;
case 1:
chorus_modulator.begin(WAVEFORM_SINE);
lcd.print(F("[SINE ]"));
break;
default:
chorus_modulator.begin(WAVEFORM_TRIANGLE);
lcd.print(F("[TRIANGLE]"));
break;
}
}
if (LCDML.FUNC_close()) // ****** STABLE END *********
{
// you can here reset some global vars or do nothing
eeprom_write();
}
}
void UI_func_chorus_depth(uint8_t param)
{
if (LCDML.FUNC_setup()) // ****** SETUP *********
{
// setup function
lcd_special_chars(BLOCKBAR);
lcd_display_bar_int("Chorus Dpt.", configuration.chorus_depth, 1.0, CHORUS_DEPTH_MIN, CHORUS_DEPTH_MAX, 3, false, false, false, true);
}
if (LCDML.FUNC_loop()) // ****** LOOP *********
{
if (LCDML.BT_checkEnter())
{
LCDML.FUNC_goBackToMenu();
}
else if (LCDML.BT_checkDown() || LCDML.BT_checkUp())
{
if (LCDML.BT_checkDown())
configuration.chorus_depth = constrain(configuration.chorus_depth + ENCODER[ENC_R].speed(), CHORUS_DEPTH_MIN, CHORUS_DEPTH_MAX);
else if (LCDML.BT_checkUp())
configuration.chorus_depth = constrain(configuration.chorus_depth - ENCODER[ENC_R].speed(), CHORUS_DEPTH_MIN, CHORUS_DEPTH_MAX);
lcd_display_bar_int("Chorus Dpt.", configuration.chorus_depth, 1.0, CHORUS_DEPTH_MIN, CHORUS_DEPTH_MAX, 3, false, false, false, false);
chorus_modulator.amplitude(configuration.chorus_depth / 100.0);
}
}
if (LCDML.FUNC_close()) // ****** STABLE END *********
{
lcd_special_chars(SCROLLBAR);
eeprom_write();
}
}
void UI_func_chorus_send(uint8_t param)
{
uint8_t instance_id = 0;
if (LCDML.FUNC_getID() > MENU_ID_OF_INSTANCE_2)
instance_id = 1;
if (LCDML.FUNC_setup()) // ****** SETUP *********
{
// setup function
lcd_special_chars(BLOCKBAR);
lcd_display_bar_int("Chorus Send", configuration.dexed[instance_id].chorus_send, 1.0, CHORUS_SEND_MIN, CHORUS_SEND_MAX, 3, false, false, false, true);
}
if (LCDML.FUNC_loop()) // ****** LOOP *********
{
if (LCDML.BT_checkEnter())
{
LCDML.FUNC_goBackToMenu();
}
else if (LCDML.BT_checkDown() || LCDML.BT_checkUp())
{
if (LCDML.BT_checkDown())
configuration.dexed[instance_id].chorus_send = constrain(configuration.dexed[instance_id].chorus_send + ENCODER[ENC_R].speed(), CHORUS_SEND_MIN, CHORUS_SEND_MAX);
else if (LCDML.BT_checkUp())
configuration.dexed[instance_id].chorus_send = constrain(configuration.dexed[instance_id].chorus_send - ENCODER[ENC_R].speed(), CHORUS_SEND_MIN, CHORUS_SEND_MAX);
lcd_display_bar_int("Chorus Send", configuration.dexed[instance_id].chorus_send, 1.0, CHORUS_SEND_MIN, CHORUS_SEND_MAX, 3, false, false, false, false);
5 years ago
chorus_send_mixer_r.gain(instance_id, configuration.dexed[instance_id].chorus_send / 100.0);
chorus_send_mixer_l.gain(instance_id, configuration.dexed[instance_id].chorus_send / 100.0);
}
}
if (LCDML.FUNC_close()) // ****** STABLE END *********
{
lcd_special_chars(SCROLLBAR);
eeprom_write();
}
}
void UI_func_chorus_level(uint8_t param)
{
if (LCDML.FUNC_setup()) // ****** SETUP *********
{
// setup function
lcd_special_chars(BLOCKBAR);
lcd_display_bar_int("Chorus Lvl.", configuration.chorus_level, 1.0, CHORUS_LEVEL_MIN, CHORUS_LEVEL_MAX, 3, false, false, false, true);
}
if (LCDML.FUNC_loop()) // ****** LOOP *********
{
if (LCDML.BT_checkEnter())
{
LCDML.FUNC_goBackToMenu();
}
else if (LCDML.BT_checkDown() || LCDML.BT_checkUp())
{
if (LCDML.BT_checkDown())
configuration.chorus_level = constrain(configuration.chorus_level + ENCODER[ENC_R].speed(), CHORUS_LEVEL_MIN, CHORUS_LEVEL_MAX);
else if (LCDML.BT_checkUp())
configuration.chorus_level = constrain(configuration.chorus_level - ENCODER[ENC_R].speed(), CHORUS_LEVEL_MIN, CHORUS_LEVEL_MAX);
lcd_display_bar_int("Chorus Lvl.", configuration.chorus_level, 1.0, CHORUS_LEVEL_MIN, CHORUS_LEVEL_MAX, 3, false, false, false, false);
master_mixer_r.gain(CHORUS, mapfloat(configuration.chorus_level, CHORUS_LEVEL_MIN, CHORUS_LEVEL_MAX, 0.0, 1.0));
master_mixer_l.gain(CHORUS, mapfloat(configuration.chorus_level, CHORUS_LEVEL_MIN, CHORUS_LEVEL_MAX, 0.0, 1.0));
}
}
if (LCDML.FUNC_close()) // ****** STABLE END *********
{
lcd_special_chars(SCROLLBAR);
eeprom_write();
}
}
void UI_func_delay_time(uint8_t param)
{
if (LCDML.FUNC_setup()) // ****** SETUP *********
{
// setup function
lcd_special_chars(BLOCKBAR);
lcd_display_bar_int("Delay Time", configuration.delay_time, 10.0, DELAY_TIME_MIN, DELAY_TIME_MAX, 3, false, false, false, true);
}
if (LCDML.FUNC_loop()) // ****** LOOP *********
{
if (LCDML.BT_checkEnter())
{
LCDML.FUNC_goBackToMenu();
}
else if (LCDML.BT_checkDown() || LCDML.BT_checkUp())
{
if (LCDML.BT_checkDown())
configuration.delay_time = constrain(configuration.delay_time + ENCODER[ENC_R].speed(), DELAY_TIME_MIN, DELAY_TIME_MAX);
else if (LCDML.BT_checkUp())
configuration.delay_time = constrain(configuration.delay_time - ENCODER[ENC_R].speed(), DELAY_TIME_MIN, DELAY_TIME_MAX);
lcd_display_bar_int("Delay Time", configuration.delay_time, 10.0, DELAY_TIME_MIN, DELAY_TIME_MAX, 3, false, false, false, true);
delay_r.delay(0, configuration.delay_time * 10);
delay_l.delay(0, configuration.delay_time * 10);
}
}
if (LCDML.FUNC_close()) // ****** STABLE END *********
{
lcd_special_chars(SCROLLBAR);
eeprom_write();
}
}
void UI_func_delay_feedback(uint8_t param)
{
if (LCDML.FUNC_setup()) // ****** SETUP *********
{
// setup function
lcd_special_chars(BLOCKBAR);
lcd_display_bar_int("Delay Feedb.", configuration.delay_feedback, 1.0, DELAY_FEEDBACK_MIN, DELAY_FEEDBACK_MAX, 3, false, false, false, true);
}
if (LCDML.FUNC_loop()) // ****** LOOP *********
{
if (LCDML.BT_checkEnter())
{
LCDML.FUNC_goBackToMenu();
}
else if (LCDML.BT_checkDown() || LCDML.BT_checkUp())
{
if (LCDML.BT_checkDown())
configuration.delay_feedback = constrain(configuration.delay_feedback + ENCODER[ENC_R].speed(), DELAY_FEEDBACK_MIN, DELAY_FEEDBACK_MAX);
else if (LCDML.BT_checkUp())
configuration.delay_feedback = constrain(configuration.delay_feedback - ENCODER[ENC_R].speed(), DELAY_FEEDBACK_MIN, DELAY_FEEDBACK_MAX);
lcd_display_bar_int("Delay Feedb.", configuration.delay_feedback, 1.0, DELAY_FEEDBACK_MIN, DELAY_FEEDBACK_MAX, 3, false, false, false, false);
5 years ago
delay_fb_mixer_r.gain(1, configuration.delay_feedback / 100.0); // amount of feedback
delay_fb_mixer_l.gain(1, configuration.delay_feedback / 100.0); // amount of feedback
//delay_fb_mixer.gain(0, 1.0 - configuration.delay_feedback / 200.0); // original signal
}
}
if (LCDML.FUNC_close()) // ****** STABLE END *********
{
lcd_special_chars(SCROLLBAR);
eeprom_write();
}
}
void UI_func_delay_send(uint8_t param)
{
uint8_t instance_id = 0;
if (LCDML.FUNC_getID() > MENU_ID_OF_INSTANCE_2)
instance_id = 1;
if (LCDML.FUNC_setup()) // ****** SETUP *********
{
// setup function
lcd_special_chars(BLOCKBAR);
lcd_display_bar_int("Delay Send", configuration.dexed[instance_id].delay_send, 1.0, DELAY_SEND_MIN, DELAY_SEND_MAX, 3, false, false, false, true);
}
if (LCDML.FUNC_loop()) // ****** LOOP *********
{
if (LCDML.BT_checkEnter())
{
LCDML.FUNC_goBackToMenu();
}
else if (LCDML.BT_checkDown() || LCDML.BT_checkUp())
{
if (LCDML.BT_checkDown())
configuration.dexed[instance_id].delay_send = constrain(configuration.dexed[instance_id].delay_send + ENCODER[ENC_R].speed(), DELAY_SEND_MIN, DELAY_SEND_MAX);
else if (LCDML.BT_checkUp())
configuration.dexed[instance_id].delay_send = constrain(configuration.dexed[instance_id].delay_send - ENCODER[ENC_R].speed(), DELAY_SEND_MIN, DELAY_SEND_MAX);
lcd_display_bar_int("Delay Send", configuration.dexed[instance_id].delay_send, 1.0, DELAY_SEND_MIN, DELAY_SEND_MAX, 3, false, false, false, false);
delay_send_mixer_r.gain(instance_id, configuration.dexed[instance_id].delay_send / 100.0);
delay_send_mixer_l.gain(instance_id, configuration.dexed[instance_id].delay_send / 100.0);
}
}
if (LCDML.FUNC_close()) // ****** STABLE END *********
{
lcd_special_chars(SCROLLBAR);
eeprom_write();
}
}
void UI_func_delay_level(uint8_t param)
{
if (LCDML.FUNC_setup()) // ****** SETUP *********
{
// setup function
lcd_special_chars(BLOCKBAR);
lcd_display_bar_int("Delay Lvl.", configuration.delay_level, 1.0, DELAY_LEVEL_MIN, DELAY_LEVEL_MAX, 3, false, false, false, true);
}
if (LCDML.FUNC_loop()) // ****** LOOP *********
{
if (LCDML.BT_checkEnter())
{
LCDML.FUNC_goBackToMenu();
}
else if (LCDML.BT_checkDown() || LCDML.BT_checkUp())
{
if (LCDML.BT_checkDown())
configuration.delay_level = constrain(configuration.delay_level + ENCODER[ENC_R].speed(), DELAY_LEVEL_MIN, DELAY_LEVEL_MAX);
else if (LCDML.BT_checkUp())
configuration.delay_level = constrain(configuration.delay_level - ENCODER[ENC_R].speed(), DELAY_LEVEL_MIN, DELAY_LEVEL_MAX);
lcd_display_bar_int("Delay Lvl.", configuration.delay_level, 1.0, DELAY_LEVEL_MIN, DELAY_LEVEL_MAX, 3, false, false, false, false);
master_mixer_r.gain(DELAY, mapfloat(configuration.delay_level, DELAY_LEVEL_MIN, DELAY_LEVEL_MAX, 0.0, 1.0));
master_mixer_l.gain(DELAY, mapfloat(configuration.delay_level, DELAY_LEVEL_MIN, DELAY_LEVEL_MAX, 0.0, 1.0));
}
lcd.setCursor(0, 1);
lcd_display_int(configuration.delay_level, 3, true, true, false);
}
if (LCDML.FUNC_close()) // ****** STABLE END *********
{
lcd_special_chars(SCROLLBAR);
eeprom_write();
}
}
void UI_func_filter_cutoff(uint8_t param)
{
uint8_t instance_id = 0;
if (LCDML.FUNC_getID() > MENU_ID_OF_INSTANCE_2)
instance_id = 1;
if (LCDML.FUNC_setup()) // ****** SETUP *********
{
// setup function
lcd_special_chars(BLOCKBAR);
lcd_display_bar_int("Filter Cut", configuration.dexed[instance_id].filter_cutoff, 1.0, FILTER_CUTOFF_MIN, FILTER_CUTOFF_MAX, 3, false, false, false, true);
}
if (LCDML.FUNC_loop()) // ****** LOOP *********
{
if (LCDML.BT_checkEnter())
{
LCDML.FUNC_goBackToMenu();
}
else if (LCDML.BT_checkDown() || LCDML.BT_checkUp())
{
if (LCDML.BT_checkDown())
configuration.dexed[instance_id].filter_cutoff = constrain(configuration.dexed[instance_id].filter_cutoff + ENCODER[ENC_R].speed(), FILTER_CUTOFF_MIN, FILTER_CUTOFF_MAX);
else if (LCDML.BT_checkUp())
configuration.dexed[instance_id].filter_cutoff = constrain(configuration.dexed[instance_id].filter_cutoff - ENCODER[ENC_R].speed(), FILTER_CUTOFF_MIN, FILTER_CUTOFF_MAX);
lcd_display_bar_int("Filter Cut", configuration.dexed[instance_id].filter_cutoff, 1.0, FILTER_CUTOFF_MIN, FILTER_CUTOFF_MAX, 3, false, false, false, false);
MicroDexed[instance_id]->fx.Cutoff = mapfloat(configuration.dexed[instance_id].filter_cutoff, FILTER_CUTOFF_MIN, FILTER_CUTOFF_MAX, 1.0, 0.0);
}
lcd.setCursor(0, 1);
lcd_display_int(configuration.dexed[instance_id].filter_cutoff, 3, true, true, false);
}
if (LCDML.FUNC_close()) // ****** STABLE END *********
{
lcd_special_chars(SCROLLBAR);
eeprom_write();
}
}
void UI_func_filter_resonance(uint8_t param)
{
uint8_t instance_id = 0;
if (LCDML.FUNC_getID() > MENU_ID_OF_INSTANCE_2)
instance_id = 1;
if (LCDML.FUNC_setup()) // ****** SETUP *********
{
// setup function
lcd_special_chars(BLOCKBAR);
lcd_display_bar_int("Filter Res", configuration.dexed[instance_id].filter_resonance, 1.0, FILTER_RESONANCE_MIN, FILTER_RESONANCE_MAX, 3, false, false, false, true);
}
if (LCDML.FUNC_loop()) // ****** LOOP *********
{
if (LCDML.BT_checkEnter())
{
LCDML.FUNC_goBackToMenu();
}
else if (LCDML.BT_checkDown() || LCDML.BT_checkUp())
{
if (LCDML.BT_checkDown())
configuration.dexed[instance_id].filter_resonance = constrain(configuration.dexed[instance_id].filter_resonance + ENCODER[ENC_R].speed(), FILTER_RESONANCE_MIN, FILTER_RESONANCE_MAX);
else if (LCDML.BT_checkUp())
configuration.dexed[instance_id].filter_resonance = constrain(configuration.dexed[instance_id].filter_resonance - ENCODER[ENC_R].speed(), FILTER_RESONANCE_MIN, FILTER_RESONANCE_MAX);
lcd_display_bar_int("Filter Res", configuration.dexed[instance_id].filter_resonance, 1.0, FILTER_RESONANCE_MIN, FILTER_RESONANCE_MAX, 3, false, false, false, false);
MicroDexed[instance_id]->fx.Reso = mapfloat(configuration.dexed[instance_id].filter_resonance, FILTER_RESONANCE_MIN, FILTER_RESONANCE_MAX, 1.0, 0.0);
}
lcd.setCursor(0, 1);
lcd_display_int(configuration.dexed[instance_id].filter_resonance, 3, true, true, false);
}
if (LCDML.FUNC_close()) // ****** STABLE END *********
{
lcd_special_chars(SCROLLBAR);
eeprom_write();
}
}
#endif
void UI_func_transpose(uint8_t param)
{
uint8_t instance_id = 0;
if (LCDML.FUNC_getID() > MENU_ID_OF_INSTANCE_2)
instance_id = 1;
if (LCDML.FUNC_setup()) // ****** SETUP *********
{
// setup function
lcd_special_chars(METERBAR);
lcd_display_meter_int("Transpose", configuration.dexed[instance_id].transpose, 1.0, -24.0, TRANSPOSE_MIN, TRANSPOSE_MAX, 3, false, false, true, true);
}
if (LCDML.FUNC_loop()) // ****** LOOP *********
{
if (LCDML.BT_checkEnter())
{
LCDML.FUNC_goBackToMenu();
}
else if (LCDML.BT_checkDown() || LCDML.BT_checkUp())
{
if (LCDML.BT_checkDown())
configuration.dexed[instance_id].transpose = constrain(configuration.dexed[instance_id].transpose + ENCODER[ENC_R].speed(), TRANSPOSE_MIN, TRANSPOSE_MAX);
else if (LCDML.BT_checkUp())
configuration.dexed[instance_id].transpose = constrain(configuration.dexed[instance_id].transpose - ENCODER[ENC_R].speed(), TRANSPOSE_MIN, TRANSPOSE_MAX);
lcd_display_meter_int("Transpose", configuration.dexed[instance_id].transpose, 1.0, -24.0, TRANSPOSE_MIN, TRANSPOSE_MAX, 3, false, false, true, true);
MicroDexed[instance_id]->data[DEXED_VOICE_OFFSET + DEXED_TRANSPOSE] = configuration.dexed[instance_id].transpose;
MicroDexed[instance_id]->notesOff();
}
}
if (LCDML.FUNC_close()) // ****** STABLE END *********
{
lcd_special_chars(SCROLLBAR);
eeprom_write();
}
}
void UI_func_tune(uint8_t param)
{
uint8_t instance_id = 0;
if (LCDML.FUNC_getID() > MENU_ID_OF_INSTANCE_2)
instance_id = 1;
if (LCDML.FUNC_setup()) // ****** SETUP *********
{
// setup function
lcd_special_chars(METERBAR);
lcd_display_meter_int("Tune", configuration.dexed[instance_id].tune, 1.0, -100.0, TUNE_MIN, TUNE_MAX, 3, false, false, true, true);
}
if (LCDML.FUNC_loop()) // ****** LOOP *********
{
if (LCDML.BT_checkEnter())
{
LCDML.FUNC_goBackToMenu();
}
else if (LCDML.BT_checkDown() || LCDML.BT_checkUp())
{
if (LCDML.BT_checkDown())
configuration.dexed[instance_id].tune = constrain(configuration.dexed[instance_id].tune + ENCODER[ENC_R].speed(), TUNE_MIN, TUNE_MAX);
else if (LCDML.BT_checkUp())
configuration.dexed[instance_id].tune = constrain(configuration.dexed[instance_id].tune - ENCODER[ENC_R].speed(), TUNE_MIN, TUNE_MAX);
lcd_display_meter_int("Tune", configuration.dexed[instance_id].tune, 1.0, -100.0, TUNE_MIN, TUNE_MAX, 3, false, false, true, false);
MicroDexed[instance_id]->controllers.masterTune = (int((configuration.dexed[instance_id].tune - 100) / 100.0 * 0x4000) << 11) * (1.0 / 12);
MicroDexed[instance_id]->doRefreshVoice();
}
}
if (LCDML.FUNC_close()) // ****** STABLE END *********
{
lcd_special_chars(SCROLLBAR);
eeprom_write();
}
}
void UI_func_midi_channel(uint8_t param)
{
uint8_t instance_id = 0;
if (LCDML.FUNC_getID() > MENU_ID_OF_INSTANCE_2)
instance_id = 1;
if (LCDML.FUNC_setup()) // ****** SETUP *********
{
// setup function
lcd.setCursor(0, 0);
lcd.print(F("MIDI Channel"));
}
if (LCDML.FUNC_loop()) // ****** LOOP *********
{
if (LCDML.BT_checkEnter())
{
LCDML.FUNC_goBackToMenu();
}
else if (LCDML.BT_checkDown())
configuration.dexed[instance_id].midi_channel = constrain(configuration.dexed[instance_id].midi_channel + ENCODER[ENC_R].speed(), MIDI_CHANNEL_MIN, MIDI_CHANNEL_MAX);
else if (LCDML.BT_checkUp())
configuration.dexed[instance_id].midi_channel = constrain(configuration.dexed[instance_id].midi_channel - ENCODER[ENC_R].speed(), MIDI_CHANNEL_MIN, MIDI_CHANNEL_MAX);
lcd.setCursor(0, 1);
if (configuration.dexed[instance_id].midi_channel == 0)
{
lcd.print(F("[OMNI]"));
}
else
{
lcd_display_int(configuration.dexed[instance_id].midi_channel, 4, false, true, false);
}
}
if (LCDML.FUNC_close()) // ****** STABLE END *********
{
// you can here reset some global vars or do nothing
eeprom_write();
}
}
void UI_func_sound_intensity(uint8_t param)
{
uint8_t instance_id = 0;
if (LCDML.FUNC_getID() > MENU_ID_OF_INSTANCE_2)
instance_id = 1;
if (LCDML.FUNC_setup()) // ****** SETUP *********
{
// setup function
lcd_special_chars(BLOCKBAR);
lcd_display_bar_int("Sound Intens.", configuration.dexed[instance_id].sound_intensity, 1.0, SOUND_INTENSITY_MIN, SOUND_INTENSITY_MAX, 3, false, false, false, true);
}
if (LCDML.FUNC_loop()) // ****** LOOP *********
{
if (LCDML.BT_checkEnter())
{
LCDML.FUNC_goBackToMenu();
}
else if (LCDML.BT_checkDown() || LCDML.BT_checkUp())
{
if (LCDML.BT_checkDown())
configuration.dexed[instance_id].sound_intensity = constrain(configuration.dexed[instance_id].sound_intensity + ENCODER[ENC_R].speed(), SOUND_INTENSITY_MIN, SOUND_INTENSITY_MAX);
else if (LCDML.BT_checkUp())
configuration.dexed[instance_id].sound_intensity = constrain(configuration.dexed[instance_id].sound_intensity - ENCODER[ENC_R].speed(), SOUND_INTENSITY_MIN, SOUND_INTENSITY_MAX);
lcd_display_bar_int("Sound Intens.", configuration.dexed[instance_id].sound_intensity, 1.0, SOUND_INTENSITY_MIN, SOUND_INTENSITY_MAX, 3, false, false, false, false);
dexed_level[instance_id]->gain(mapfloat(configuration.dexed[instance_id].sound_intensity, SOUND_INTENSITY_MIN, SOUND_INTENSITY_MAX, 0.0, SOUND_INTENSITY_AMP_MAX));
}
}
if (LCDML.FUNC_close()) // ****** STABLE END *********
{
// you can here reset some global vars or do nothing
lcd_special_chars(SCROLLBAR);
eeprom_write();
}
}
void UI_func_panorama(uint8_t param)
{
uint8_t instance_id = 0;
if (LCDML.FUNC_getID() > MENU_ID_OF_INSTANCE_2)
instance_id = 1;
if (LCDML.FUNC_setup()) // ****** SETUP *********
{
// setup function
if (configuration.mono > 0)
{
lcd.setCursor(0, 0);
lcd.print(F("Panorama"));
lcd.setCursor(0, 1);
lcd.print(F("MONO-disabled"));
return;
}
lcd_special_chars(METERBAR);
lcd_display_meter_float("Panorama", configuration.dexed[instance_id].pan, 0.05, -20.0, PANORAMA_MIN, PANORAMA_MAX, 3, 1, false, false, true, true);
}
if (LCDML.FUNC_loop()) // ****** LOOP *********
{
if (LCDML.BT_checkEnter())
{
LCDML.FUNC_goBackToMenu();
}
else if (LCDML.BT_checkDown() && configuration.mono == 0)
configuration.dexed[instance_id].pan = constrain(configuration.dexed[instance_id].pan + ENCODER[ENC_R].speed(), PANORAMA_MIN, PANORAMA_MAX);
else if (LCDML.BT_checkUp() && configuration.mono == 0)
configuration.dexed[instance_id].pan = constrain(configuration.dexed[instance_id].pan - ENCODER[ENC_R].speed(), PANORAMA_MIN, PANORAMA_MAX);
if (configuration.mono == 0)
{
lcd_display_meter_float("Panorama", configuration.dexed[instance_id].pan, 0.05, -20.0, PANORAMA_MIN, PANORAMA_MAX, 3, 1, false, false, true, false);
mono2stereo[instance_id]->panorama(mapfloat(configuration.dexed[instance_id].pan, PANORAMA_MIN, PANORAMA_MAX, -1.0, 1.0));
}
}
if (LCDML.FUNC_close()) // ****** STABLE END *********
{
lcd_special_chars(SCROLLBAR);
eeprom_write();
}
}
void UI_func_stereo_mono(uint8_t param)
{
if (LCDML.FUNC_setup()) // ****** SETUP *********
{
// setup function
lcd.setCursor(0, 0);
lcd.print(F("Stereo/Mono"));
lcd.setCursor(0, 1);
switch (configuration.mono)
{
case 0:
lcd.print(F("[STEREO]"));
stereo2mono.stereo(true);
break;
case 1:
lcd.print(F("[MONO ]"));
stereo2mono.stereo(false);
break;
case 2:
lcd.print(F("[MONO-R]"));
stereo2mono.stereo(false);
break;
case 3:
lcd.print(F("[MONO-L]"));
stereo2mono.stereo(false);
break;
}
}
if (LCDML.FUNC_loop()) // ****** LOOP *********
{
if (LCDML.BT_checkEnter())
LCDML.FUNC_goBackToMenu();
else if (LCDML.BT_checkDown())
configuration.mono = constrain(configuration.mono + 1, MONO_MIN, MONO_MAX);
else if (LCDML.BT_checkUp())
configuration.mono = constrain(configuration.mono - 1, MONO_MIN, MONO_MAX);
lcd.setCursor(0, 1);
switch (configuration.mono)
{
case 0:
lcd.print(F("[STEREO]"));
stereo2mono.stereo(true);
break;
case 1:
lcd.print(F("[MONO ]"));
stereo2mono.stereo(false);
break;
case 2:
lcd.print(F("[MONO-R]"));
stereo2mono.stereo(false);
break;
case 3:
lcd.print(F("[MONO-L]"));
stereo2mono.stereo(false);
break;
}
set_volume(configuration.vol, configuration.mono);
}
if (LCDML.FUNC_close()) // ****** STABLE END *********
{
// you can here reset some global vars or do nothing
eeprom_write();
}
}
void UI_func_polyphony(uint8_t param)
{
uint8_t instance_id = 0;
if (LCDML.FUNC_getID() > MENU_ID_OF_INSTANCE_2)
instance_id = 1;
if (LCDML.FUNC_setup()) // ****** SETUP *********
{
// setup function
lcd_special_chars(BLOCKBAR);
lcd_display_bar_int("Polyphony", configuration.dexed[instance_id].polyphony, 1.0, POLYPHONY_MIN, POLYPHONY_MAX, 3, false, false, false, true);
}
if (LCDML.FUNC_loop()) // ****** LOOP *********
{
if (LCDML.BT_checkEnter())
{
LCDML.FUNC_goBackToMenu();
}
else if (LCDML.BT_checkDown() || LCDML.BT_checkUp())
{
if (LCDML.BT_checkDown())
configuration.dexed[instance_id].polyphony = constrain(configuration.dexed[instance_id].polyphony + ENCODER[ENC_R].speed(), POLYPHONY_MIN, POLYPHONY_MAX);
else if (LCDML.BT_checkUp())
configuration.dexed[instance_id].polyphony = constrain(configuration.dexed[instance_id].polyphony - ENCODER[ENC_R].speed(), POLYPHONY_MIN, POLYPHONY_MAX);
lcd_display_bar_int("Polyphony", configuration.dexed[instance_id].polyphony, 1.0, POLYPHONY_MIN, POLYPHONY_MAX, 3, false, false, false, false);
MicroDexed[instance_id]->setMaxNotes(configuration.dexed[instance_id].polyphony);
}
}
if (LCDML.FUNC_close()) // ****** STABLE END *********
{
lcd_special_chars(SCROLLBAR);
eeprom_write();
}
}
void UI_func_engine(uint8_t param)
{
uint8_t instance_id = 0;
if (LCDML.FUNC_getID() > MENU_ID_OF_INSTANCE_2)
instance_id = 1;
if (LCDML.FUNC_setup()) // ****** SETUP *********
{
// setup function
lcd.setCursor(0, 0);
lcd.print(F("Engine"));
}
if (LCDML.FUNC_loop()) // ****** LOOP *********
{
if (LCDML.BT_checkEnter())
{
LCDML.FUNC_goBackToMenu();
}
else if (LCDML.BT_checkDown() || LCDML.BT_checkUp())
{
if (LCDML.BT_checkDown())
configuration.dexed[instance_id].engine = constrain(configuration.dexed[instance_id].engine + 1, ENGINE_MIN, ENGINE_MAX);
else if (LCDML.BT_checkUp())
configuration.dexed[instance_id].engine = constrain(configuration.dexed[instance_id].engine - 1, ENGINE_MIN, ENGINE_MAX);
MicroDexed[instance_id]->setEngineType(configuration.dexed[instance_id].engine);
}
lcd.setCursor(0, 1);
switch (configuration.dexed[instance_id].engine)
{
case 0:
lcd.print(F("[MODERN]"));
break;
case 1:
lcd.print(F("[MARK 1]"));
break;
case 2:
lcd.print(F("[OPL ]"));
break;
}
}
if (LCDML.FUNC_close()) // ****** STABLE END *********
{
// you can here reset some global vars or do nothing
eeprom_write();
}
}
void UI_func_mono_poly(uint8_t param)
{
uint8_t instance_id = 0;
if (LCDML.FUNC_getID() > MENU_ID_OF_INSTANCE_2)
instance_id = 1;
if (LCDML.FUNC_setup()) // ****** SETUP *********
{
// setup function
lcd.setCursor(0, 0);
lcd.print(F("Mono/Polyphonic"));
}
if (LCDML.FUNC_loop()) // ****** LOOP *********
{
if (LCDML.BT_checkEnter())
{
LCDML.FUNC_goBackToMenu();
}
else if (LCDML.BT_checkDown() || LCDML.BT_checkUp())
{
if (LCDML.BT_checkDown())
configuration.dexed[instance_id].monopoly = constrain(configuration.dexed[instance_id].monopoly + 1, MONOPOLY_MIN, MONOPOLY_MAX);
else if (LCDML.BT_checkUp())
configuration.dexed[instance_id].monopoly = constrain(configuration.dexed[instance_id].monopoly - 1, MONOPOLY_MIN, MONOPOLY_MAX);
MicroDexed[instance_id]->setMonoMode(!configuration.dexed[instance_id].monopoly);
}
lcd.setCursor(0, 1);
switch (configuration.dexed[instance_id].monopoly)
{
case 0:
lcd.print(F("[MONOPHONIC]"));
break;
case 1:
lcd.print(F("[POLYPHONIC]"));
break;
}
}
if (LCDML.FUNC_close()) // ****** STABLE END *********
{
// you can here reset some global vars or do nothing
eeprom_write();
}
}
void UI_func_note_refresh(uint8_t param)
{
uint8_t instance_id = 0;
if (LCDML.FUNC_getID() > MENU_ID_OF_INSTANCE_2)
instance_id = 1;
if (LCDML.FUNC_setup()) // ****** SETUP *********
{
// setup function
lcd.setCursor(0, 0);
lcd.print(F("Note Refresh"));
}
if (LCDML.FUNC_loop()) // ****** LOOP *********
{
if (LCDML.BT_checkEnter())
{
LCDML.FUNC_goBackToMenu();
}
else if (LCDML.BT_checkDown() || LCDML.BT_checkUp())
{
if (LCDML.BT_checkDown())
configuration.dexed[instance_id].note_refresh = constrain(configuration.dexed[instance_id].note_refresh + 1, NOTE_REFRESH_MIN, NOTE_REFRESH_MAX);
else if (LCDML.BT_checkUp())
configuration.dexed[instance_id].note_refresh = constrain(configuration.dexed[instance_id].note_refresh - 1, NOTE_REFRESH_MIN, NOTE_REFRESH_MAX);
MicroDexed[instance_id]->setRefreshMode(configuration.dexed[instance_id].note_refresh);
}
lcd.setCursor(0, 1);
switch (configuration.dexed[instance_id].note_refresh)
{
case 0:
lcd.print(F("[NORMAL ]"));
break;
case 1:
lcd.print(F("[RETRIGGERED]"));
break;
}
}
if (LCDML.FUNC_close()) // ****** STABLE END *********
{
// you can here reset some global vars or do nothing
eeprom_write();
}
}
void UI_func_pb_range(uint8_t param)
{
uint8_t instance_id = 0;
if (LCDML.FUNC_getID() > MENU_ID_OF_INSTANCE_2)
instance_id = 1;
if (LCDML.FUNC_setup()) // ****** SETUP *********
{
// setup function
lcd_special_chars(BLOCKBAR);
lcd_display_bar_int("PB Range", configuration.dexed[instance_id].pb_range, 1.0, PB_RANGE_MIN, PB_RANGE_MAX, 2, false, false, false, true);
}
if (LCDML.FUNC_loop()) // ****** LOOP *********
{
if (LCDML.BT_checkEnter())
{
LCDML.FUNC_goBackToMenu();
}
else if (LCDML.BT_checkDown() || LCDML.BT_checkUp())
{
if (LCDML.BT_checkDown())
configuration.dexed[instance_id].pb_range = constrain(configuration.dexed[instance_id].pb_range + ENCODER[ENC_R].speed(), PB_RANGE_MIN, PB_RANGE_MAX);
else if (LCDML.BT_checkUp())
configuration.dexed[instance_id].pb_range = constrain(configuration.dexed[instance_id].pb_range - ENCODER[ENC_R].speed(), PB_RANGE_MIN, PB_RANGE_MAX);
lcd_display_bar_int("PB Range", configuration.dexed[instance_id].pb_range, 1.0, PB_RANGE_MIN, PB_RANGE_MAX, 2, false, false, false, false);
MicroDexed[instance_id]->setPBController(configuration.dexed[instance_id].pb_range, configuration.dexed[instance_id].pb_step);
}
}
if (LCDML.FUNC_close()) // ****** STABLE END *********
{
lcd_special_chars(SCROLLBAR);
eeprom_write();
}
}
void UI_func_pb_step(uint8_t param)
{
uint8_t instance_id = 0;
if (LCDML.FUNC_getID() > MENU_ID_OF_INSTANCE_2)
instance_id = 1;
if (LCDML.FUNC_setup()) // ****** SETUP *********
{
// setup function
lcd_special_chars(BLOCKBAR);
lcd_display_bar_int("PB Step", configuration.dexed[instance_id].pb_step, 1.0, PB_STEP_MIN, PB_STEP_MAX, 2, false, false, false, true);
}
if (LCDML.FUNC_loop()) // ****** LOOP *********
{
if (LCDML.BT_checkEnter())
{
LCDML.FUNC_goBackToMenu();
}
else if (LCDML.BT_checkDown() || LCDML.BT_checkUp())
{
if (LCDML.BT_checkDown())
configuration.dexed[instance_id].pb_step = constrain(configuration.dexed[instance_id].pb_step + ENCODER[ENC_R].speed(), PB_STEP_MIN, PB_STEP_MAX);
else if (LCDML.BT_checkUp())
configuration.dexed[instance_id].pb_step = constrain(configuration.dexed[instance_id].pb_step - ENCODER[ENC_R].speed(), PB_STEP_MIN, PB_STEP_MAX);
lcd_display_bar_int("PB Step", configuration.dexed[instance_id].pb_step, 1.0, PB_STEP_MIN, PB_STEP_MAX, 2, false, false, false, false);
MicroDexed[instance_id]->setPBController(configuration.dexed[instance_id].pb_range, configuration.dexed[instance_id].pb_step);
}
}
if (LCDML.FUNC_close()) // ****** STABLE END *********
{
// you can here reset some global vars or do nothing
lcd_special_chars(SCROLLBAR);
eeprom_write();
}
}
void UI_func_mw_range(uint8_t param)
{
uint8_t instance_id = 0;
if (LCDML.FUNC_getID() > MENU_ID_OF_INSTANCE_2)
instance_id = 1;
if (LCDML.FUNC_setup()) // ****** SETUP *********
{
// setup function
lcd_special_chars(BLOCKBAR);
lcd_display_bar_int("MW Range", configuration.dexed[instance_id].mw_range, 1.0, MW_RANGE_MIN, MW_RANGE_MAX, 2, false, false, false, true);
}
if (LCDML.FUNC_loop()) // ****** LOOP *********
{
if (LCDML.BT_checkEnter())
{
LCDML.FUNC_goBackToMenu();
}
else if (LCDML.BT_checkDown() || LCDML.BT_checkUp())
{
if (LCDML.BT_checkDown())
configuration.dexed[instance_id].mw_range = constrain(configuration.dexed[instance_id].mw_range + ENCODER[ENC_R].speed(), MW_RANGE_MIN, MW_RANGE_MAX);
else if (LCDML.BT_checkUp())
configuration.dexed[instance_id].mw_range = constrain(configuration.dexed[instance_id].mw_range - ENCODER[ENC_R].speed(), MW_RANGE_MIN, MW_RANGE_MAX);
lcd_display_bar_int("MW Range", configuration.dexed[instance_id].mw_range, 1.0, MW_RANGE_MIN, MW_RANGE_MAX, 2, false, false, false, false);
MicroDexed[instance_id]->setMWController(configuration.dexed[instance_id].mw_range, configuration.dexed[instance_id].mw_assign, configuration.dexed[instance_id].mw_mode);
}
}
if (LCDML.FUNC_close()) // ****** STABLE END *********
{
// you can here reset some global vars or do nothing
lcd_special_chars(SCROLLBAR);
eeprom_write();
}
}
void UI_func_mw_assign(uint8_t param)
{
uint8_t instance_id = 0;
if (LCDML.FUNC_getID() > MENU_ID_OF_INSTANCE_2)
instance_id = 1;
if (LCDML.FUNC_setup()) // ****** SETUP *********
{
// setup function
lcd.setCursor(0, 0);
lcd.print(F("MW Assign"));
}
if (LCDML.FUNC_loop()) // ****** LOOP *********
{
if (LCDML.BT_checkEnter())
{
LCDML.FUNC_goBackToMenu();
}
else if (LCDML.BT_checkDown() || LCDML.BT_checkUp())
{
if (LCDML.BT_checkDown())
configuration.dexed[instance_id].mw_assign = constrain(configuration.dexed[instance_id].mw_assign + 1, MW_ASSIGN_MIN, MW_ASSIGN_MAX);
else if (LCDML.BT_checkUp())
configuration.dexed[instance_id].mw_assign = constrain(configuration.dexed[instance_id].mw_assign - 1, MW_ASSIGN_MIN, MW_ASSIGN_MAX);
lcd.setCursor(0, 1);
switch (configuration.dexed[instance_id].mw_assign)
{
case 0:
lcd.print(F("[ NONE ]"));
break;
case 1:
lcd.print(F("[PTCH ]"));
break;
case 2:
lcd.print(F("[ AMP ]"));
break;
case 3:
lcd.print(F("[PTCH AMP ]"));
break;
case 4:
lcd.print(F("[ EG-BS]"));
break;
case 5:
lcd.print(F("[PTCH EG-BS]"));
break;
case 6:
lcd.print(F("[ AMP EG-BS]"));
break;
case 7:
lcd.print(F("[PTCH AMP EG-BS]"));
break;
}
MicroDexed[instance_id]->setMWController(configuration.dexed[instance_id].mw_range, configuration.dexed[instance_id].mw_assign, configuration.dexed[instance_id].mw_mode);
}
}
if (LCDML.FUNC_close()) // ****** STABLE END *********
{
// you can here reset some global vars or do nothing
eeprom_write();
}
}
void UI_func_mw_mode(uint8_t param)
{
uint8_t instance_id = 0;
if (LCDML.FUNC_getID() > MENU_ID_OF_INSTANCE_2)
instance_id = 1;
if (LCDML.FUNC_setup()) // ****** SETUP *********
{
// setup function
lcd.setCursor(0, 0);
lcd.print(F("MW Mode"));
}
if (LCDML.FUNC_loop()) // ****** LOOP *********
{
if (LCDML.BT_checkEnter())
{
LCDML.FUNC_goBackToMenu();
}
else if (LCDML.BT_checkDown() || LCDML.BT_checkUp())
{
if (LCDML.BT_checkDown())
configuration.dexed[instance_id].mw_mode = constrain(configuration.dexed[instance_id].mw_mode + 1, MW_MODE_MIN, MW_MODE_MAX);
else if (LCDML.BT_checkUp())
configuration.dexed[instance_id].mw_mode = constrain(configuration.dexed[instance_id].mw_mode - 1, MW_MODE_MIN, MW_MODE_MAX);
lcd.setCursor(0, 1);
switch (configuration.dexed[instance_id].mw_mode)
{
case 0:
lcd.print(F("[NORMAL ]"));
break;
case 1:
lcd.print(F("[REVERSE]"));
break;
}
MicroDexed[instance_id]->setMWController(configuration.dexed[instance_id].mw_range, configuration.dexed[instance_id].mw_assign, configuration.dexed[instance_id].mw_mode);
}
}
if (LCDML.FUNC_close()) // ****** STABLE END *********
{
// you can here reset some global vars or do nothing
eeprom_write();
}
}
void UI_func_fc_range(uint8_t param)
{
uint8_t instance_id = 0;
if (LCDML.FUNC_getID() > MENU_ID_OF_INSTANCE_2)
instance_id = 1;
if (LCDML.FUNC_setup()) // ****** SETUP *********
{
// setup function
lcd_special_chars(BLOCKBAR);
lcd_display_bar_int("FC Range", configuration.dexed[instance_id].fc_range, 1.0, FC_RANGE_MIN, FC_RANGE_MAX, 2, false, false, false, true);
}
if (LCDML.FUNC_loop()) // ****** LOOP *********
{
if (LCDML.BT_checkEnter())
{
LCDML.FUNC_goBackToMenu();
}
else if (LCDML.BT_checkDown() || LCDML.BT_checkUp())
{
if (LCDML.BT_checkDown())
configuration.dexed[instance_id].fc_range = constrain(configuration.dexed[instance_id].fc_range + ENCODER[ENC_R].speed(), FC_RANGE_MIN, FC_RANGE_MAX);
else if (LCDML.BT_checkUp())
configuration.dexed[instance_id].fc_range = constrain(configuration.dexed[instance_id].fc_range - ENCODER[ENC_R].speed(), FC_RANGE_MIN, FC_RANGE_MAX);
lcd_display_bar_int("FC Range", configuration.dexed[instance_id].fc_range, 1.0, FC_RANGE_MIN, FC_RANGE_MAX, 2, false, false, false, false);
MicroDexed[instance_id]->setFCController(configuration.dexed[instance_id].fc_range, configuration.dexed[instance_id].fc_assign, configuration.dexed[instance_id].fc_mode);
}
}
if (LCDML.FUNC_close()) // ****** STABLE END *********
{
// you can here reset some global vars or do nothing
lcd_special_chars(SCROLLBAR);
eeprom_write();
}
}
void UI_func_fc_assign(uint8_t param)
{
uint8_t instance_id = 0;
if (LCDML.FUNC_getID() > MENU_ID_OF_INSTANCE_2)
instance_id = 1;
if (LCDML.FUNC_setup()) // ****** SETUP *********
{
// setup function
lcd.setCursor(0, 0);
lcd.print(F("FC Assign"));
}
if (LCDML.FUNC_loop()) // ****** LOOP *********
{
if (LCDML.BT_checkEnter())
{
LCDML.FUNC_goBackToMenu();
}
else if (LCDML.BT_checkDown() || LCDML.BT_checkUp())
{
if (LCDML.BT_checkDown())
configuration.dexed[instance_id].fc_assign = constrain(configuration.dexed[instance_id].fc_assign + 1, FC_ASSIGN_MIN, FC_ASSIGN_MAX);
else if (LCDML.BT_checkUp())
configuration.dexed[instance_id].fc_assign = constrain(configuration.dexed[instance_id].fc_assign - 1, FC_ASSIGN_MIN, FC_ASSIGN_MAX);
lcd.setCursor(0, 1);
switch (configuration.dexed[instance_id].fc_assign)
{
case 0:
lcd.print(F("[ NONE ]"));
break;
case 1:
lcd.print(F("[PTCH ]"));
break;
case 2:
lcd.print(F("[ AMP ]"));
break;
case 3:
lcd.print(F("[PTCH AMP ]"));
break;
case 4:
lcd.print(F("[ EG-BS]"));
break;
case 5:
lcd.print(F("[PTCH EG-BS]"));
break;
case 6:
lcd.print(F("[ AMP EG-BS]"));
break;
case 7:
lcd.print(F("[PTCH AMP EG-BS]"));
break;
}
MicroDexed[instance_id]->setFCController(configuration.dexed[instance_id].fc_range, configuration.dexed[instance_id].fc_assign, configuration.dexed[instance_id].fc_mode);
}
}
if (LCDML.FUNC_close()) // ****** STABLE END *********
{
// you can here reset some global vars or do nothing
eeprom_write();
}
}
void UI_func_fc_mode(uint8_t param)
{
uint8_t instance_id = 0;
if (LCDML.FUNC_getID() > MENU_ID_OF_INSTANCE_2)
instance_id = 1;
if (LCDML.FUNC_setup()) // ****** SETUP *********
{
// setup function
lcd.setCursor(0, 0);
lcd.print(F("FC Mode"));
}
if (LCDML.FUNC_loop()) // ****** LOOP *********
{
if (LCDML.BT_checkEnter())
{
LCDML.FUNC_goBackToMenu();
}
else if (LCDML.BT_checkDown() || LCDML.BT_checkUp())
{
if (LCDML.BT_checkDown())
configuration.dexed[instance_id].fc_mode = constrain(configuration.dexed[instance_id].fc_mode + 1, FC_MODE_MIN, FC_MODE_MAX);
else if (LCDML.BT_checkUp())
configuration.dexed[instance_id].fc_mode = constrain(configuration.dexed[instance_id].fc_mode - 1, FC_MODE_MIN, FC_MODE_MAX);
lcd.setCursor(0, 1);
switch (configuration.dexed[instance_id].fc_mode)
{
case 0:
lcd.print(F("[NORMAL ]"));
break;
case 1:
lcd.print(F("[REVERSE]"));
break;
}
MicroDexed[instance_id]->setFCController(configuration.dexed[instance_id].fc_range, configuration.dexed[instance_id].fc_assign, configuration.dexed[instance_id].fc_mode);
}
}
if (LCDML.FUNC_close()) // ****** STABLE END *********
{
// you can here reset some global vars or do nothing
eeprom_write();
}
}
void UI_func_bc_range(uint8_t param)
{
uint8_t instance_id = 0;
if (LCDML.FUNC_getID() > MENU_ID_OF_INSTANCE_2)
instance_id = 1;
if (LCDML.FUNC_setup()) // ****** SETUP *********
{
// setup function
lcd_special_chars(BLOCKBAR);
lcd_display_bar_int("BC Range", configuration.dexed[instance_id].bc_range, 1.0, BC_RANGE_MIN, BC_RANGE_MAX, 2, false, false, false, true);
}
if (LCDML.FUNC_loop()) // ****** LOOP *********
{
if (LCDML.BT_checkEnter())
{
LCDML.FUNC_goBackToMenu();
}
else if (LCDML.BT_checkDown() || LCDML.BT_checkUp())
{
if (LCDML.BT_checkDown())
configuration.dexed[instance_id].bc_range = constrain(configuration.dexed[instance_id].bc_range + ENCODER[ENC_R].speed(), BC_RANGE_MIN, BC_RANGE_MAX);
else if (LCDML.BT_checkUp())
configuration.dexed[instance_id].bc_range = constrain(configuration.dexed[instance_id].bc_range - ENCODER[ENC_R].speed(), BC_RANGE_MIN, BC_RANGE_MAX);
lcd_display_bar_int("BC Range", configuration.dexed[instance_id].bc_range, 1.0, BC_RANGE_MIN, BC_RANGE_MAX, 2, false, false, false, false);
MicroDexed[instance_id]->setBCController(configuration.dexed[instance_id].bc_range, configuration.dexed[instance_id].bc_assign, configuration.dexed[instance_id].bc_mode);
}
}
if (LCDML.FUNC_close()) // ****** STABLE END *********
{
// you can here reset some global vars or do nothing
lcd_special_chars(SCROLLBAR);
eeprom_write();
}
}
void UI_func_bc_assign(uint8_t param)
{
uint8_t instance_id = 0;
if (LCDML.FUNC_getID() > MENU_ID_OF_INSTANCE_2)
instance_id = 1;
if (LCDML.FUNC_setup()) // ****** SETUP *********
{
// setup function
lcd.setCursor(0, 0);
lcd.print(F("BC Assign"));
}
if (LCDML.FUNC_loop()) // ****** LOOP *********
{
if (LCDML.BT_checkEnter())
{
LCDML.FUNC_goBackToMenu();
}
else if (LCDML.BT_checkDown() || LCDML.BT_checkUp())
{
if (LCDML.BT_checkDown())
configuration.dexed[instance_id].bc_assign = constrain(configuration.dexed[instance_id].bc_assign + 1, BC_ASSIGN_MIN, BC_ASSIGN_MAX);
else if (LCDML.BT_checkUp())
configuration.dexed[instance_id].bc_assign = constrain(configuration.dexed[instance_id].bc_assign - 1, BC_ASSIGN_MIN, BC_ASSIGN_MAX);
lcd.setCursor(0, 1);
switch (configuration.dexed[instance_id].bc_assign)
{
case 0:
lcd.print(F("[ NONE ]"));
break;
case 1:
lcd.print(F("[PTCH ]"));
break;
case 2:
lcd.print(F("[ AMP ]"));
break;
case 3:
lcd.print(F("[PTCH AMP ]"));
break;
case 4:
lcd.print(F("[ EG-BS]"));
break;
case 5:
lcd.print(F("[PTCH EG-BS]"));
break;
case 6:
lcd.print(F("[ AMP EG-BS]"));
break;
case 7:
lcd.print(F("[PTCH AMP EG-BS]"));
break;
}
MicroDexed[instance_id]->setBCController(configuration.dexed[instance_id].bc_range, configuration.dexed[instance_id].bc_assign, configuration.dexed[instance_id].bc_mode);
}
}
if (LCDML.FUNC_close()) // ****** STABLE END *********
{
// you can here reset some global vars or do nothing
eeprom_write();
}
}
void UI_func_bc_mode(uint8_t param)
{
uint8_t instance_id = 0;
if (LCDML.FUNC_getID() > MENU_ID_OF_INSTANCE_2)
instance_id = 1;
if (LCDML.FUNC_setup()) // ****** SETUP *********
{
// setup function
lcd.setCursor(0, 0);
lcd.print(F("BC Mode"));
}
if (LCDML.FUNC_loop()) // ****** LOOP *********
{
if (LCDML.BT_checkEnter())
{
LCDML.FUNC_goBackToMenu();
}
else if (LCDML.BT_checkDown() || LCDML.BT_checkUp())
{
if (LCDML.BT_checkDown())
configuration.dexed[instance_id].bc_mode = constrain(configuration.dexed[instance_id].bc_mode + 1, BC_MODE_MIN, BC_MODE_MAX);
else if (LCDML.BT_checkUp())
configuration.dexed[instance_id].bc_mode = constrain(configuration.dexed[instance_id].bc_mode - 1, BC_MODE_MIN, BC_MODE_MAX);
lcd.setCursor(0, 1);
switch (configuration.dexed[instance_id].bc_mode)
{
case 0:
lcd.print(F("[NORMAL ]"));
break;
case 1:
lcd.print(F("[REVERSE]"));
break;
}
MicroDexed[instance_id]->setBCController(configuration.dexed[instance_id].bc_range, configuration.dexed[instance_id].bc_assign, configuration.dexed[instance_id].bc_mode);
}
}
if (LCDML.FUNC_close()) // ****** STABLE END *********
{
// you can here reset some global vars or do nothing
eeprom_write();
}
}
void UI_func_at_range(uint8_t param)
{
uint8_t instance_id = 0;
if (LCDML.FUNC_getID() > MENU_ID_OF_INSTANCE_2)
instance_id = 1;
if (LCDML.FUNC_setup()) // ****** SETUP *********
{
// setup function
lcd_special_chars(BLOCKBAR);
lcd_display_bar_int("AT Range", configuration.dexed[instance_id].at_range, 1.0, AT_RANGE_MIN, AT_RANGE_MAX, 2, false, false, false, true);
}
if (LCDML.FUNC_loop()) // ****** LOOP *********
{
if (LCDML.BT_checkEnter())
{
LCDML.FUNC_goBackToMenu();
}
else if (LCDML.BT_checkDown() || LCDML.BT_checkUp())
{
if (LCDML.BT_checkDown())
configuration.dexed[instance_id].at_range = constrain(configuration.dexed[instance_id].at_range + ENCODER[ENC_R].speed(), AT_RANGE_MIN, AT_RANGE_MAX);
else if (LCDML.BT_checkUp())
configuration.dexed[instance_id].at_range = constrain(configuration.dexed[instance_id].at_range - ENCODER[ENC_R].speed(), AT_RANGE_MIN, AT_RANGE_MAX);
lcd_display_bar_int("AT Range", configuration.dexed[instance_id].at_range, 1.0, AT_RANGE_MIN, AT_RANGE_MAX, 2, false, false, false, false);
MicroDexed[instance_id]->setATController(configuration.dexed[instance_id].at_range, configuration.dexed[instance_id].at_assign, configuration.dexed[instance_id].at_mode);
}
}
if (LCDML.FUNC_close()) // ****** STABLE END *********
{
// you can here reset some global vars or do nothing
lcd_special_chars(SCROLLBAR);
eeprom_write();
}
}
void UI_func_at_assign(uint8_t param)
{
uint8_t instance_id = 0;
if (LCDML.FUNC_getID() > MENU_ID_OF_INSTANCE_2)
instance_id = 1;
if (LCDML.FUNC_setup()) // ****** SETUP *********
{
// setup function
lcd.setCursor(0, 0);
lcd.print(F("AT Assign"));
}
if (LCDML.FUNC_loop()) // ****** LOOP *********
{
if (LCDML.BT_checkEnter())
{
LCDML.FUNC_goBackToMenu();
}
else if (LCDML.BT_checkDown() || LCDML.BT_checkUp())
{
if (LCDML.BT_checkDown())
configuration.dexed[instance_id].at_assign = constrain(configuration.dexed[instance_id].at_assign + 1, AT_ASSIGN_MIN, AT_ASSIGN_MAX);
else if (LCDML.BT_checkUp())
configuration.dexed[instance_id].at_assign = constrain(configuration.dexed[instance_id].at_assign - 1, AT_ASSIGN_MIN, AT_ASSIGN_MAX);
lcd.setCursor(0, 1);
switch (configuration.dexed[instance_id].at_assign)
{
case 0:
lcd.print(F("[ NONE ]"));
break;
case 1:
lcd.print(F("[PTCH ]"));
break;
case 2:
lcd.print(F("[ AMP ]"));
break;
case 3:
lcd.print(F("[PTCH AMP ]"));
break;
case 4:
lcd.print(F("[ EG-BS]"));
break;
case 5:
lcd.print(F("[PTCH EG-BS]"));
break;
case 6:
lcd.print(F("[ AMP EG-BS]"));
break;
case 7:
lcd.print(F("[PTCH AMP EG-BS]"));
break;
}
MicroDexed[instance_id]->setATController(configuration.dexed[instance_id].at_range, configuration.dexed[instance_id].at_assign, configuration.dexed[instance_id].at_mode);
}
}
if (LCDML.FUNC_close()) // ****** STABLE END *********
{
// you can here reset some global vars or do nothing
eeprom_write();
}
}
void UI_func_at_mode(uint8_t param)
{
uint8_t instance_id = 0;
if (LCDML.FUNC_getID() > MENU_ID_OF_INSTANCE_2)
instance_id = 1;
if (LCDML.FUNC_setup()) // ****** SETUP *********
{
// setup function
lcd.setCursor(0, 0);
lcd.print(F("AT Mode"));
}
if (LCDML.FUNC_loop()) // ****** LOOP *********
{
if (LCDML.BT_checkEnter())
{
LCDML.FUNC_goBackToMenu();
}
else if (LCDML.BT_checkDown() || LCDML.BT_checkUp())
{
if (LCDML.BT_checkDown())
configuration.dexed[instance_id].at_mode = constrain(configuration.dexed[instance_id].at_mode + 1, AT_MODE_MIN, AT_MODE_MAX);
else if (LCDML.BT_checkUp())
configuration.dexed[instance_id].at_mode = constrain(configuration.dexed[instance_id].at_mode - 1, AT_MODE_MIN, AT_MODE_MAX);
lcd.setCursor(0, 1);
switch (configuration.dexed[instance_id].at_mode)
{
case 0:
lcd.print(F("[NORMAL ]"));
break;
case 1:
lcd.print(F("[REVERSE]"));
break;
}
MicroDexed[instance_id]->setATController(configuration.dexed[instance_id].at_range, configuration.dexed[instance_id].at_assign, configuration.dexed[instance_id].at_mode);
}
}
if (LCDML.FUNC_close()) // ****** STABLE END *********
{
// you can here reset some global vars or do nothing
eeprom_write();
}
}
void UI_func_portamento_mode(uint8_t param)
{
uint8_t instance_id = 0;
if (LCDML.FUNC_getID() > MENU_ID_OF_INSTANCE_2)
instance_id = 1;
if (LCDML.FUNC_setup()) // ****** SETUP *********
{
// setup function
lcd.setCursor(0, 0);
lcd.print(F("Portamento Mode"));
}
if (LCDML.FUNC_loop()) // ****** LOOP *********
{
if (LCDML.BT_checkEnter())
{
LCDML.FUNC_goBackToMenu();
}
else if (LCDML.BT_checkDown() || LCDML.BT_checkUp())
{
if (LCDML.BT_checkDown())
configuration.dexed[instance_id].portamento_mode = constrain(configuration.dexed[instance_id].portamento_mode + 1, PORTAMENTO_MODE_MIN, PORTAMENTO_MODE_MAX);
else if (LCDML.BT_checkUp())
configuration.dexed[instance_id].portamento_mode = constrain(configuration.dexed[instance_id].portamento_mode - 1, PORTAMENTO_MODE_MIN, PORTAMENTO_MODE_MAX);
lcd.setCursor(0, 1);
switch (configuration.dexed[instance_id].portamento_mode)
{
case 0:
if (configuration.dexed[instance_id].monopoly == 1)
lcd.print(F("[RETAIN ]"));
else
lcd.print(F("[FINGERED]"));
break;
case 1:
if (configuration.dexed[instance_id].monopoly == 1)
lcd.print(F("[FOLLOW ]"));
else
lcd.print(F("[FULL ]"));
break;
}
MicroDexed[instance_id]->setPortamentoMode(configuration.dexed[instance_id].portamento_mode, configuration.dexed[instance_id].portamento_glissando, configuration.dexed[instance_id].portamento_time);
}
}
if (LCDML.FUNC_close()) // ****** STABLE END *********
{
// you can here reset some global vars or do nothing
eeprom_write();
}
}
void UI_func_portamento_glissando(uint8_t param)
{
uint8_t instance_id = 0;
if (LCDML.FUNC_getID() > MENU_ID_OF_INSTANCE_2)
instance_id = 1;
if (LCDML.FUNC_setup()) // ****** SETUP *********
{
// setup function
lcd.setCursor(0, 0);
lcd.print(F("Portam. Gliss."));
}
if (LCDML.FUNC_loop()) // ****** LOOP *********
{
if (LCDML.BT_checkEnter())
{
LCDML.FUNC_goBackToMenu();
}
else if (LCDML.BT_checkDown() || LCDML.BT_checkUp())
{
if (LCDML.BT_checkDown())
configuration.dexed[instance_id].portamento_glissando = constrain(configuration.dexed[instance_id].portamento_glissando + 1, PORTAMENTO_GLISSANDO_MIN, PORTAMENTO_GLISSANDO_MAX);
else if (LCDML.BT_checkUp())
configuration.dexed[instance_id].portamento_glissando = constrain(configuration.dexed[instance_id].portamento_glissando - 1, PORTAMENTO_GLISSANDO_MIN, PORTAMENTO_GLISSANDO_MAX);
lcd.setCursor(0, 1);
switch (configuration.dexed[instance_id].portamento_glissando)
{
case 0:
lcd.print(F("[OFF]"));
break;
case 1:
lcd.print(F("[ON ]"));
break;
}
MicroDexed[instance_id]->setPortamentoMode(configuration.dexed[instance_id].portamento_mode, configuration.dexed[instance_id].portamento_glissando, configuration.dexed[instance_id].portamento_time);
}
}
if (LCDML.FUNC_close()) // ****** STABLE END *********
{
// you can here reset some global vars or do nothing
eeprom_write();
}
}
void UI_func_portamento_time(uint8_t param)
{
uint8_t instance_id = 0;
if (LCDML.FUNC_getID() > MENU_ID_OF_INSTANCE_2)
instance_id = 1;
if (LCDML.FUNC_setup()) // ****** SETUP *********
{
lcd_special_chars(BLOCKBAR);
lcd_display_bar_int("Portam. Time", configuration.dexed[instance_id].portamento_time, 1.0, PORTAMENTO_TIME_MIN, PORTAMENTO_TIME_MAX, 2, false, false, false, true);
}
if (LCDML.FUNC_loop()) // ****** LOOP *********
{
if (LCDML.BT_checkEnter())
{
LCDML.FUNC_goBackToMenu();
}
else if (LCDML.BT_checkDown() || LCDML.BT_checkUp())
{
if (LCDML.BT_checkDown())
configuration.dexed[instance_id].portamento_time = constrain(configuration.dexed[instance_id].portamento_time + ENCODER[ENC_R].speed(), PORTAMENTO_TIME_MIN, PORTAMENTO_TIME_MAX);
else if (LCDML.BT_checkUp())
configuration.dexed[instance_id].portamento_time = constrain(configuration.dexed[instance_id].portamento_time - ENCODER[ENC_R].speed(), PORTAMENTO_TIME_MIN, PORTAMENTO_TIME_MAX);
lcd_display_bar_int("Portam. Time", configuration.dexed[instance_id].portamento_time, 1.0, PORTAMENTO_TIME_MIN, PORTAMENTO_TIME_MAX, 2, false, false, false, false);
MicroDexed[instance_id]->setPortamentoMode(configuration.dexed[instance_id].portamento_mode, configuration.dexed[instance_id].portamento_glissando, configuration.dexed[instance_id].portamento_time);
}
}
if (LCDML.FUNC_close()) // ****** STABLE END *********
{
// you can here reset some global vars or do nothing
lcd_special_chars(SCROLLBAR);
eeprom_write();
}
}
void UI_func_OP1(uint8_t param)
{
uint8_t instance_id = 0;
if (LCDML.FUNC_getID() > MENU_ID_OF_INSTANCE_2)
instance_id = 1;
UI_handle_OP(param, 0, instance_id);
}
void UI_func_OP2(uint8_t param)
{
uint8_t instance_id = 0;
if (LCDML.FUNC_getID() > MENU_ID_OF_INSTANCE_2)
instance_id = 1;
UI_handle_OP(param, 1, instance_id);
}
void UI_func_OP3(uint8_t param)
{
uint8_t instance_id = 0;
if (LCDML.FUNC_getID() > MENU_ID_OF_INSTANCE_2)
instance_id = 1;
UI_handle_OP(param, 2, instance_id);
}
void UI_func_OP4(uint8_t param)
{
uint8_t instance_id = 0;
if (LCDML.FUNC_getID() > MENU_ID_OF_INSTANCE_2)
instance_id = 1;
UI_handle_OP(param, 3, instance_id);
}
void UI_func_OP5(uint8_t param)
{
uint8_t instance_id = 0;
if (LCDML.FUNC_getID() > MENU_ID_OF_INSTANCE_2)
instance_id = 1;
UI_handle_OP(param, 4, instance_id);
}
void UI_func_OP6(uint8_t param)
{
uint8_t instance_id = 0;
if (LCDML.FUNC_getID() > MENU_ID_OF_INSTANCE_2)
instance_id = 1;
UI_handle_OP(param, 5, instance_id);
}
void UI_handle_OP(uint8_t param, uint8_t op, uint8_t instance_id)
{
bool state = bitRead(configuration.dexed[instance_id].op_enabled, op);
if (LCDML.FUNC_setup()) // ****** SETUP *********
{
// setup function
lcd.setCursor(0, 0);
lcd.print(F("Operator "));
lcd.print(op + 1);
lcd.setCursor(0, 1);
if (state == true)
{
lcd.print(F("[ENABLED ]"));
}
else
{
lcd.print(F("[DISABLED]"));
}
}
if (LCDML.FUNC_loop()) // ****** LOOP *********
{
if (LCDML.BT_checkEnter())
{
LCDML.FUNC_goBackToMenu();
}
else if (LCDML.BT_checkUp() && state == true)
{
bitClear(configuration.dexed[instance_id].op_enabled, op);
state = false;
}
else if (LCDML.BT_checkDown() && state == false)
{
bitSet(configuration.dexed[instance_id].op_enabled, op);
state = true;
}
if (LCDML.BT_checkDown() || LCDML.BT_checkUp())
{
lcd.setCursor(0, 1);
if (state == true)
{
lcd.print(F("[ENABLED ]"));
}
else
{
lcd.print(F("[DISABLED]"));
}
MicroDexed[instance_id]->setOPs(configuration.dexed[instance_id].op_enabled);
MicroDexed[instance_id]->doRefreshVoice();
}
}
if (LCDML.FUNC_close()) // ****** STABLE END *********
{
// you can here reset some global vars or do nothing
eeprom_write();
}
}
void UI_func_information(uint8_t param)
{
if (LCDML.FUNC_setup()) // ****** SETUP *********
{
char version_string[LCD_cols + 1];
generate_version_string(version_string, sizeof(version_string));
// setup function
lcd.setCursor(0, 0);
lcd.print(F("MicroDexed"));
lcd.setCursor(0, 1);
lcd.print(version_string);
}
if (LCDML.FUNC_loop()) // ****** LOOP *********
{
// loop function, can be run in a loop when LCDML_DISP_triggerMenu(xx) is set
// the quit button works in every DISP function without any checks; it starts the loop_end function
if (LCDML.BT_checkEnter()) { // check if any button is pressed (enter, up, down, left, right)
// LCDML_goToMenu stops a running menu function and goes to the menu
LCDML.FUNC_goBackToMenu();
}
}
if (LCDML.FUNC_close()) // ****** STABLE END *********
{
// you can here reset some global vars or do nothing
}
}
void UI_func_midi_soft_thru(uint8_t param)
{
if (LCDML.FUNC_setup()) // ****** SETUP *********
{
// setup function
lcd.setCursor(0, 0);
5 years ago
lcd.print(F("MIDI Soft THRU"));
}
if (LCDML.FUNC_loop()) // ****** LOOP *********
{
if (LCDML.BT_checkEnter())
{
LCDML.FUNC_goBackToMenu();
}
else if (LCDML.BT_checkDown() || LCDML.BT_checkUp())
{
if (LCDML.BT_checkDown())
configuration.soft_midi_thru = constrain(configuration.soft_midi_thru + 1, SOFT_MIDI_THRU_MIN, SOFT_MIDI_THRU_MAX);
else if (LCDML.BT_checkUp())
configuration.soft_midi_thru = constrain(configuration.soft_midi_thru - 1, SOFT_MIDI_THRU_MIN, SOFT_MIDI_THRU_MAX);
lcd.setCursor(0, 1);
switch (configuration.soft_midi_thru)
{
case 0:
lcd.print(F("[OFF]"));
break;
case 1:
lcd.print(F("[ON ]"));
break;
}
}
}
if (LCDML.FUNC_close()) // ****** STABLE END *********
{
// you can here reset some global vars or do nothing
eeprom_write();
}
}
void UI_func_velocity_level(uint8_t param)
{
uint8_t instance_id = 0;
if (LCDML.FUNC_getID() > MENU_ID_OF_INSTANCE_2)
instance_id = 1;
if (LCDML.FUNC_setup()) // ****** SETUP *********
{
// setup function
lcd_special_chars(BLOCKBAR);
lcd_display_bar_int("Velocity Lvl", configuration.dexed[instance_id].velocity_level, 1.0, VELOCITY_LEVEL_MIN, VELOCITY_LEVEL_MAX, 3, false, false, false, true);
}
if (LCDML.FUNC_loop()) // ****** LOOP *********
{
if (LCDML.BT_checkEnter())
{
LCDML.FUNC_goBackToMenu();
}
else if (LCDML.BT_checkDown() || LCDML.BT_checkUp())
{
if (LCDML.BT_checkDown())
configuration.dexed[instance_id].velocity_level = constrain(configuration.dexed[instance_id].velocity_level + ENCODER[ENC_R].speed(), VELOCITY_LEVEL_MIN, VELOCITY_LEVEL_MAX);
else if (LCDML.BT_checkUp())
configuration.dexed[instance_id].velocity_level = constrain(configuration.dexed[instance_id].velocity_level - ENCODER[ENC_R].speed(), VELOCITY_LEVEL_MIN, VELOCITY_LEVEL_MAX);
lcd_display_bar_int("Velocity Lvl", configuration.dexed[instance_id].velocity_level, 1.0, VELOCITY_LEVEL_MIN, VELOCITY_LEVEL_MAX, 3, false, false, false, false);
}
}
if (LCDML.FUNC_close()) // ****** STABLE END *********
{
// you can here reset some global vars or do nothing
lcd_special_chars(SCROLLBAR);
eeprom_write();
}
}
void UI_func_voice_selection(uint8_t param)
{
#ifdef DEBUG
Serial.println(F("UI_func_voice_selection()"));
#endif
menu_state = MENU_VOICE;
strip_extension(bank_names[selected_dexed_instance][configuration.dexed[selected_dexed_instance].bank], bank_name[selected_dexed_instance]);
//LCDML.DISP_clear();
// display bank and voice number
lcd.show(0, 0, 2, configuration.dexed[selected_dexed_instance].bank);
lcd.show(1, 0, 2, configuration.dexed[selected_dexed_instance].voice + 1);
// display names
lcd.show(0, 4, 10, bank_name[selected_dexed_instance]);
lcd.show(1, 4, 10, voice_names[selected_dexed_instance][configuration.dexed[selected_dexed_instance].voice]);
// display selected Dexed instance
5 years ago
/* if (selected_dexed_instance == 1)
{
#if NUM_DEXED > 1
lcd.show(0, 15, 1, "o");
#else
lcd.show(0, 15, 1, " ");
#endif
lcd.show(1, 15, 1, "*");
}
else
{
selected_dexed_instance = 0;
lcd.show(0, 15, 1, "*");
#if NUM_DEXED > 1
lcd.show(1, 15, 1, "o");
#else
lcd.show(1, 15, 1, " ");
#endif
} */
lcd.show(0, 15, 1, " ");
lcd.show(1, 15, 1, " ");
// display selections
switch (menu_voice)
{
case MENU_VOICE_BANK:
lcd.show(0, 2, 2, " [");
lcd.show(0, 14, 1, "]");
lcd.show(1, 2, 2, " ");
lcd.show(1, 14, 1, " ");
break;
case MENU_VOICE_SOUND:
lcd.show(0, 2, 2, " ");
lcd.show(0, 14, 1, " ");
lcd.show(1, 2, 2, " [");
lcd.show(1, 14, 1, "]");
break;
}
for (int x = 2; x < LCD_rows; x++) {
lcd.show(x, 0, LCD_cols, " ");
}
}
void UI_func_volume(uint8_t param)
{
#ifdef DEBUG
Serial.println(F("UI_func_volume()"));
#endif
back_from_volume = 0;
if (menu_state != MENU_VOLUME)
{
lcd_special_chars(BLOCKBAR);
lcd_display_bar_int("Volume", configuration.vol, 1.0, VOLUME_MIN, VOLUME_MAX, 3, false, false, false, true);
menu_state = MENU_VOLUME;
}
else
lcd_display_bar_int("Volume", configuration.vol, 1.0, VOLUME_MIN, VOLUME_MAX, 3, false, false, false, false);
set_volume(configuration.vol, configuration.mono);
eeprom_write();
}
void UI_func_load(uint8_t param)
{
if (LCDML.FUNC_setup()) // ****** SETUP *********
{
// setup function
lcd.setCursor(0, 0);
lcd.print(F("Load setup"));
}
if (LCDML.FUNC_loop()) // ****** LOOP *********
{
if (LCDML.BT_checkEnter())
{
LCDML.FUNC_goBackToMenu();
}
else if (LCDML.BT_checkDown() || LCDML.BT_checkUp())
{
if (LCDML.BT_checkDown())
{
if (dexed_setup_number < 100)
{
dexed_setup_number++;
}
}
else if (LCDML.BT_checkUp())
{
if (dexed_setup_number > 1)
{
dexed_setup_number--;
}
}
//LOAD SYSEX FILE
}
lcd.setCursor(0, 1);
lcd_display_int(dexed_setup_number, 2, false, true, false);
}
if (LCDML.FUNC_close()) // ****** STABLE END *********
{
// you can here reset some global vars or do nothing
eeprom_write();
}
}
void UI_func_save(uint8_t param)
{
if (LCDML.FUNC_setup()) // ****** SETUP *********
{
// setup function
lcd.setCursor(0, 0);
lcd.print(F("Save setup"));
}
if (LCDML.FUNC_loop()) // ****** LOOP *********
{
if (LCDML.BT_checkEnter())
{
LCDML.FUNC_goBackToMenu();
}
else if (LCDML.BT_checkDown() || LCDML.BT_checkUp())
{
if (LCDML.BT_checkDown())
{
if (dexed_setup_number < 100)
{
dexed_setup_number++;
}
}
else if (LCDML.BT_checkUp())
{
if (dexed_setup_number > 1)
{
dexed_setup_number--;
}
}
//SAVE SYSEX FILE
}
lcd.setCursor(0, 1);
lcd_display_int(dexed_setup_number, 2, false, true, false);
}
if (LCDML.FUNC_close()) // ****** STABLE END *********
{
// you can here reset some global vars or do nothing
eeprom_write();
}
}
5 years ago
void UI_function_not_enabled(void)
{
if (LCDML.FUNC_setup()) // ****** SETUP *********
{
// setup function
lcd.setCursor(0, 0);
lcd.print(F("Function not"));
lcd.setCursor(0, 1);
lcd.print(F("enbaled!"));
}
if (LCDML.FUNC_loop()) // ****** LOOP *********
{
if (LCDML.BT_checkEnter())
{
LCDML.FUNC_goBackToMenu();
}
}
if (LCDML.FUNC_close()) // ****** STABLE END *********
{
// you can here reset some global vars or do nothing
}
}
void UI_function_not_implemented(uint8_t param)
{
if (LCDML.FUNC_setup()) // ****** SETUP *********
{
// setup function
lcd.setCursor(0, 0);
lcd.print(F("Function not"));
lcd.setCursor(0, 1);
lcd.print(F("implemented!"));
}
if (LCDML.FUNC_loop()) // ****** LOOP *********
{
if (LCDML.BT_checkEnter())
{
LCDML.FUNC_goBackToMenu();
}
}
if (LCDML.FUNC_close()) // ****** STABLE END *********
{
// you can here reset some global vars or do nothing
}
}
5 years ago
void lcd_display_int(int16_t var, uint8_t size, bool zeros, bool brackets, bool sign)
{
lcd_display_float(float(var), size, 0, zeros, brackets, sign);
}
void lcd_display_float(float var, uint8_t size_number, uint8_t size_fraction, bool zeros, bool brackets, bool sign)
{
char s[LCD_cols + 1];
char f[LCD_cols + 1];
if (size_fraction > 0)
{
if (zeros == true && sign == true)
sprintf(f, "%%+0%d.%df", size_number + size_fraction + 2, size_fraction);
else if (zeros == true && sign == false)
sprintf(f, "%%+0%d.%df", size_number + size_fraction + 1, size_fraction);
else if (zeros == false && sign == true)
sprintf(f, "%%+%d.%df", size_number + size_fraction + 2, size_fraction);
else if (zeros == false && sign == false)
sprintf(f, "%%%d.%df", size_number + size_fraction + 1, size_fraction);
sprintf(s, f, var);
}
else
{
if (zeros == true && sign == true)
sprintf(f, "%%+0%dd", size_number + 1);
else if (zeros == true && sign == false)
sprintf(f, "%%%0dd", size_number);
else if (zeros == false && sign == true)
sprintf(f, "%%+%dd", size_number + 1);
else if (zeros == false && sign == false)
sprintf(f, "%%%dd", size_number);
sprintf(s, f, int(var));
}
if (brackets == true)
{
char tmp[LCD_cols + 1];
strcpy(tmp, s);
sprintf(s, "[%s]", tmp);
}
lcd.print(s);
}
inline void lcd_display_bar_int(const char* title, uint32_t value, float factor, int32_t min_value, int32_t max_value, uint8_t size, bool zeros, bool brackets, bool sign, bool init)
{
lcd_display_bar_float(title, float(value), factor, min_value, max_value, size, 0, zeros, brackets, sign, init);
}
void lcd_display_bar_float(const char* title, float value, float factor, int32_t min_value, int32_t max_value, uint8_t size_number, uint8_t size_fraction, bool zeros, bool brackets, bool sign, bool init)
{
uint8_t size = 0;
float v = float((value - min_value) * LCD_cols) / (max_value - min_value);
float _vi = 0.0;
uint8_t vf = uint8_t(modff(v, &_vi) * 10.0 + 0.5);
uint8_t vi = uint8_t(_vi);
if (size_fraction == 0)
size = size_number;
else
size = size_number + size_fraction + 1;
if (brackets == true)
size += 2;
if (sign == true)
size += 1;
if (init == true)
{
// Title
lcd.setCursor(0, 0);
lcd.print(title);
// Value-Brackets
if (brackets == true)
{
lcd.setCursor(LCD_cols - size, 0);
lcd.print(F("["));
lcd.setCursor(LCD_cols - 1, 0);
lcd.print(F("]"));
}
}
// Value
lcd.setCursor(LCD_cols - size, 0);
lcd_display_float(value * factor, size_number, size_fraction, zeros, brackets, sign);
// Bar
lcd.setCursor(0, 1);
if (vi == 0)
{
lcd.write((uint8_t)vf / 2.0 - 0.5);
lcd.print(F(" "));
}
else
{
for (uint8_t i = 0; i < vi; i++)
lcd.write((uint8_t)4); // full block
if (vi < LCD_cols)
lcd.write((uint8_t)vf / 2.0 - 0.5);
for (uint8_t i = LCD_cols - vi; i < LCD_cols; i++)
lcd.print(F(" ")); // empty block
}
}
inline 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)
{
lcd_display_meter_float(title, float(value), factor, offset, min_value, max_value, size, 0, zeros, brackets, sign, 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)
{
uint8_t size = 0;
float v = float((value - min_value) * LCD_cols) / (max_value - min_value);
float _vi = 0.0;
uint8_t vf = uint8_t(modff(v, &_vi) * 10.0 + 0.5);
uint8_t vi = uint8_t(_vi);
if (size_fraction == 0)
size = size_number;
else
size = size_number + size_fraction + 1;
if (brackets == true)
size += 2;
if (sign == true)
size += 1;
if (init == true)
{
// Title
lcd.setCursor(0, 0);
lcd.print(title);
// Value-Brackets
if (brackets == true)
{
lcd.setCursor(LCD_cols - size, 0);
lcd.print(F("["));
lcd.setCursor(LCD_cols - 1, 0);
lcd.print(F("]"));
}
}
// Value
lcd.setCursor(LCD_cols - size, 0);
lcd_display_float((value + offset) * factor, size_number, size_fraction, zeros, brackets, sign);
// Bar
lcd.setCursor(0, 1);
if (vi == 0)
{
lcd.write((uint8_t)vf / 2.0 - 0.5);
lcd.print(F(" "));
}
else
{
for (uint8_t i = 0; i < LCD_cols; i++)
lcd.print(F(" ")); // empty block
lcd.setCursor(vi - 1, 1);
lcd.write((uint8_t)vf / 2.0 - 0.5);
}
}
void lcd_special_chars(uint8_t mode)
{
switch (mode)
{
case SCROLLBAR:
// set special chars for scrollbar
for (uint8_t i = 0; i < 5; i++)
{
#ifdef I2C_DISPLAY
lcd.createChar(i, (uint8_t*)scroll_bar[i]);
#else
flipped_scroll_bar[i] = rotTile(scroll_bar[i]);
#endif
}
break;
case BLOCKBAR:
// set special chars for volumebar
for (uint8_t i = 0; i < 5; i++)
{
#ifdef I2C_DISPLAY
lcd.createChar(i, (uint8_t*)block_bar[i]);
#else
flipped_block_bar[i] = rotTile(block_bar[i]);
#endif
}
break;
case METERBAR:
// set special chars for volumebar
for (uint8_t i = 0; i < 5; i++)
{
#ifdef I2C_DISPLAY
lcd.createChar(i, (uint8_t*)meter_bar[i]);
#else
flipped_block_bar[i] = rotTile(meter_bar[i]);
#endif
}
break;
}
}
#endif
#endif