Added UI function for changing drum pitch.

dev
Holger Wirtz 2 years ago
parent b2c3ee4da1
commit 5ec1fdfda3
  1. 2
      MicroDexed.ino
  2. 127
      UI.hpp
  3. 2
      config.h

@ -377,7 +377,7 @@ char g_voice_name[NUM_DEXED][VOICE_NAME_LEN];
char g_bank_name[NUM_DEXED][BANK_NAME_LEN]; char g_bank_name[NUM_DEXED][BANK_NAME_LEN];
char receive_bank_filename[FILENAME_LEN]; char receive_bank_filename[FILENAME_LEN];
uint8_t selected_instance_id = 0; uint8_t selected_instance_id = 0;
uint8_t seq_UI_last_step = 0; uint8_t active_sample = 0;
#if defined(ARDUINO_TEENSY40) || defined(ARDUINO_TEENSY41) #if defined(ARDUINO_TEENSY40) || defined(ARDUINO_TEENSY41)
#if NUM_DEXED > 1 #if NUM_DEXED > 1
int8_t midi_decay[NUM_DEXED] = { -1, -1 }; int8_t midi_decay[NUM_DEXED] = { -1, -1 };

127
UI.hpp

@ -56,6 +56,7 @@
extern bool check_sd_performance_exists(uint8_t number); extern bool check_sd_performance_exists(uint8_t number);
extern bool midi_learn_mode; extern bool midi_learn_mode;
extern uint8_t active_sample;
extern config_t configuration; extern config_t configuration;
extern void set_volume(uint8_t v, uint8_t m); extern void set_volume(uint8_t v, uint8_t m);
@ -294,7 +295,6 @@ void UI_func_information(uint8_t param);
void UI_func_set_performance_name(uint8_t param); void UI_func_set_performance_name(uint8_t param);
void UI_func_volume(uint8_t param); void UI_func_volume(uint8_t param);
void UI_func_smart_filter(uint8_t param); void UI_func_smart_filter(uint8_t param);
void UI_func_drum_midi_channel(uint8_t param);
void UI_func_load_performance(uint8_t param); void UI_func_load_performance(uint8_t param);
void UI_func_save_performance(uint8_t param); void UI_func_save_performance(uint8_t param);
void UI_func_save_voice(uint8_t param); void UI_func_save_voice(uint8_t param);
@ -338,6 +338,7 @@ void UI_func_epiano_chorus_frequency(uint8_t param);
void UI_func_epiano_chorus_waveform(uint8_t param); void UI_func_epiano_chorus_waveform(uint8_t param);
void UI_func_epiano_chorus_depth(uint8_t param); void UI_func_epiano_chorus_depth(uint8_t param);
void UI_func_epiano_chorus_level(uint8_t param); void UI_func_epiano_chorus_level(uint8_t param);
void UI_func_drum_midi_channel(uint8_t param);
void UI_func_drums_main_volume(uint8_t param); void UI_func_drums_main_volume(uint8_t param);
void UI_func_drum_volume(uint8_t param); void UI_func_drum_volume(uint8_t param);
void UI_func_drum_pan(uint8_t param); void UI_func_drum_pan(uint8_t param);
@ -3980,6 +3981,27 @@ void UI_handle_OP(uint8_t param) {
} }
} }
void _check_display_name(bool display_name, uint8_t digits) {
if (display_name == true) {
display.setCursor(0, 1);
display.print(F("["));
display.setCursor(9, 1);
display.print(F("]"));
display.setCursor(LCD_cols - digits - 2, 1);
display.print(F(" "));
display.setCursor(LCD_cols - 1, 1);
display.print(F(" "));
} else {
display.setCursor(0, 1);
display.print(F(" "));
display.setCursor(9, 1);
display.print(F(" "));
display.setCursor(LCD_cols - digits - 2, 1);
display.print(F("["));
display.setCursor(LCD_cols - 1, 1);
display.print(F("]"));
}
}
void UI_func_drum_midi_channel(uint8_t param) { void UI_func_drum_midi_channel(uint8_t param) {
if (LCDML.FUNC_setup()) // ****** SETUP ********* if (LCDML.FUNC_setup()) // ****** SETUP *********
{ {
@ -3991,6 +4013,7 @@ void UI_func_drum_midi_channel(uint8_t param) {
if (LCDML.FUNC_loop()) // ****** LOOP ********* if (LCDML.FUNC_loop()) // ****** LOOP *********
{ {
if ((LCDML.BT_checkDown() && encoderDir[ENC_R].Down()) || (LCDML.BT_checkUp() && encoderDir[ENC_R].Up())) {
if (LCDML.BT_checkDown() && encoderDir[ENC_R].Down()) if (LCDML.BT_checkDown() && encoderDir[ENC_R].Down())
configuration.drums.midi_channel = constrain(configuration.drums.midi_channel + ENCODER[ENC_R].speed(), MIDI_CHANNEL_MIN, MIDI_CHANNEL_MAX); configuration.drums.midi_channel = constrain(configuration.drums.midi_channel + ENCODER[ENC_R].speed(), MIDI_CHANNEL_MIN, MIDI_CHANNEL_MAX);
else if (LCDML.BT_checkUp() && encoderDir[ENC_R].Up()) else if (LCDML.BT_checkUp() && encoderDir[ENC_R].Up())
@ -4003,6 +4026,7 @@ void UI_func_drum_midi_channel(uint8_t param) {
display_int(configuration.drums.midi_channel, 4, false, true, false); display_int(configuration.drums.midi_channel, 4, false, true, false);
} }
} }
}
if (LCDML.FUNC_close()) // ****** STABLE END ********* if (LCDML.FUNC_close()) // ****** STABLE END *********
{ {
@ -4012,34 +4036,103 @@ void UI_func_drum_midi_channel(uint8_t param) {
} }
void UI_func_drums_main_volume(uint8_t param) { void UI_func_drums_main_volume(uint8_t param) {
; char tmp[6];
}
void _UI_func_drum_pitch_display(bool mode) { if (LCDML.FUNC_setup()) // ****** SETUP *********
; {
lcd_special_chars(BLOCKBAR);
display_bar_int("DRM Main Vol", configuration.drums.main_vol, 1.0, VOLUME_MIN, VOLUME_MAX, 3, false, false, true);
}
if (LCDML.FUNC_loop()) // ****** LOOP *********
{
if ((LCDML.BT_checkDown() && encoderDir[ENC_R].Down()) || (LCDML.BT_checkUp() && encoderDir[ENC_R].Up())) {
if (LCDML.BT_checkDown()) {
configuration.drums.main_vol = constrain(configuration.drums.main_vol + ENCODER[ENC_L].speed(), DRUMS_MAIN_VOL_MIN, DRUMS_MAIN_VOL_MAX);
} else if (LCDML.BT_checkUp()) {
configuration.drums.main_vol = constrain(configuration.drums.main_vol - ENCODER[ENC_L].speed(), DRUMS_MAIN_VOL_MIN, DRUMS_MAIN_VOL_MAX);
}
display_bar_int("DRM Main Vol", configuration.drums.main_vol, 1.0, DRUMS_MAIN_VOL_MIN, DRUMS_MAIN_VOL_MAX, 3, false, false, false);
master_mixer_r.gain(MASTER_MIX_CH_DRUMS, configuration.drums.main_vol);
master_mixer_l.gain(MASTER_MIX_CH_DRUMS, configuration.drums.main_vol);
}
}
if (LCDML.FUNC_close()) // ****** STABLE END *********
{
lcd_special_chars(SCROLLBAR);
encoderDir[ENC_L].reset();
}
} }
void UI_func_drum_pitch(uint8_t param) { void UI_func_drum_pitch(uint8_t param) {
; static bool display_name;
} char tmp_val[5];
void _UI_func_drum_volume_display(bool mode) { if (LCDML.FUNC_setup()) // ****** SETUP *********
; {
} midi_learn_mode = true;
void UI_func_drum_volume(uint8_t param) { display.setCursor(0, 0);
; display.print(F("Drums Pitch"));
} display.setCursor(1, 1);
display.print(drum_config[active_sample].name);
display.setCursor(LCD_cols - 5, 1);
snprintf_P(tmp_val, sizeof(tmp_val), PSTR("%4.1f"), configuration.drums.pitch[active_sample] / 10.0);
display.print(tmp_val);
_check_display_name(display_name, 4);
}
void _UI_func_drum_pan_display(bool mode) { if (LCDML.FUNC_loop()) // ****** LOOP *********
; {
if ((LCDML.BT_checkDown() && encoderDir[ENC_R].Down()) || (LCDML.BT_checkUp() && encoderDir[ENC_R].Up()) || (LCDML.BT_checkEnter() && encoderDir[ENC_R].ButtonShort())) {
if (LCDML.BT_checkDown()) {
if (display_name == true) {
active_sample = constrain(++active_sample, 0, NUM_DRUMSET_CONFIG - 1);
display.setCursor(LCD_cols - 5, 1);
snprintf_P(tmp_val, sizeof(tmp_val), PSTR("%4.1f"), configuration.drums.pitch[active_sample] / 10.0);
display.print(tmp_val);
} else {
configuration.drums.pitch[active_sample] = constrain(configuration.drums.pitch[active_sample] + ENCODER[ENC_L].speed(), DRUMS_PITCH_MIN, DRUMS_PITCH_MAX);
}
} else if (LCDML.BT_checkUp()) {
if (display_name == true) {
active_sample = constrain(--active_sample, 0, NUM_DRUMSET_CONFIG - 1);
display.setCursor(LCD_cols - 5, 1);
snprintf_P(tmp_val, sizeof(tmp_val), PSTR("%4.1f"), configuration.drums.pitch[active_sample] / 10.0);
display.print(tmp_val);
} else {
configuration.drums.pitch[active_sample] = constrain(configuration.drums.pitch[active_sample] - ENCODER[ENC_L].speed(), DRUMS_PITCH_MIN, DRUMS_PITCH_MAX);
}
} else if (LCDML.BT_checkEnter()) {
display_name = !display_name;
}
if (display_name == true) {
display.setCursor(1, 1);
display.print(drum_config[active_sample].name);
} else {
display.setCursor(LCD_cols - 5, 1);
snprintf_P(tmp_val, sizeof(tmp_val), PSTR("%4.1f"), configuration.drums.pitch[active_sample] / 10.0);
display.print(tmp_val);
}
_check_display_name(display_name, 4);
}
}
if (LCDML.FUNC_close()) // ****** STABLE END *********
{
encoderDir[ENC_L].reset();
midi_learn_mode = false;
}
} }
void UI_func_drum_pan(uint8_t param) { void UI_func_drum_volume(uint8_t param) {
; ;
} }
void _UI_func_drum_reverb_send_display(bool mode) { void UI_func_drum_pan(uint8_t param) {
; ;
} }

@ -324,7 +324,7 @@
#define VOICE_NAME_LEN 12 // 11 (plus '\0') #define VOICE_NAME_LEN 12 // 11 (plus '\0')
#define FILENAME_LEN BANK_NAME_LEN + VOICE_NAME_LEN #define FILENAME_LEN BANK_NAME_LEN + VOICE_NAME_LEN
#define CONFIG_FILENAME_LEN 50 #define CONFIG_FILENAME_LEN 50
#define DRUM_NAME_LEN 21 #define DRUM_NAME_LEN 9
#define FAV_CONFIG_PATH "FAVCFG" #define FAV_CONFIG_PATH "FAVCFG"
#define FAV_CONFIG_NAME "FAVCFG" #define FAV_CONFIG_NAME "FAVCFG"

Loading…
Cancel
Save