Added UI function for drum volume min/max.

Several small fixes.
dev
Holger Wirtz 2 years ago
parent 5de7b39670
commit c7b406897a
  1. 4
      MicroDexed.ino
  2. 163
      UI.hpp

@ -2388,6 +2388,10 @@ int8_t handle_midi_learn(int8_t note) {
ret_channel = configuration.drums.midi_channel;
active_sample = get_drums_id_by_note(note);
LCDML.OTHER_jumpToFunc(UI_func_drum_reverb_send);
} else if (LCDML.FUNC_getID() == LCDML.OTHER_getIDFromFunction(UI_func_drum_vol_min_max)) {
ret_channel = configuration.drums.midi_channel;
active_sample = get_drums_id_by_note(note);
LCDML.OTHER_jumpToFunc(UI_func_drum_vol_min_max);
} else if (LCDML.FUNC_getID() == LCDML.OTHER_getIDFromFunction(UI_func_drum_midi_note)) {
ret_channel = configuration.drums.midi_channel;
if (midi_learn_mode != MIDI_LEARN_MODE_NOTE)

163
UI.hpp

@ -4003,29 +4003,44 @@ void _check_display_name(bool display_name, uint8_t digits) {
}
}
void _check_display_name_min_max(uint8_t display_name, uint8_t digits) {
switch (display_name) {
void _check_display_name_min_max(uint8_t input_mode, uint8_t input_type, uint8_t digits) {
switch (input_mode) {
case 0:
display.setCursor(7, 0);
if (input_type == 0)
display.print(F("[MIN]"));
else
display.print(F("[MAX]"));
display.setCursor(0, 1);
display.print(F("["));
display.print(F(" "));
display.setCursor(9, 1);
display.print(F("]"));
display.print(F(" "));
display.setCursor(LCD_cols - digits - 2, 1);
display.print(F(" "));
display.setCursor(LCD_cols - 1, 1);
display.print(F(" "));
break;
case 1:
display.setCursor(7, 0);
if (input_type == 0)
display.print(F(" MIN "));
else
display.print(F(" MAX "));
display.setCursor(0, 1);
display.print(F(" "));
display.print(F("["));
display.setCursor(9, 1);
display.print(F(" "));
display.print(F("]"));
display.setCursor(LCD_cols - digits - 2, 1);
display.print(F("["));
display.print(F(" "));
display.setCursor(LCD_cols - 1, 1);
display.print(F("]"));
display.print(F(" "));
break;
case 2:
display.setCursor(7, 0);
if (input_type == 0)
display.print(F(" MIN "));
else
display.print(F(" MAX "));
display.setCursor(0, 1);
display.print(F(" "));
display.setCursor(9, 1);
@ -4041,19 +4056,37 @@ void _check_display_name_min_max(uint8_t display_name, uint8_t digits) {
void UI_func_drum_midi_channel(uint8_t param) {
if (LCDML.FUNC_setup()) // ****** SETUP *********
{
encoderDir[ENC_R].reset();
display.setCursor(0, 0);
display.print(F("Drum MIDI Ch."));
display.print(F("MIDI Channel"));
display.setCursor(0, 1);
if (configuration.drums.midi_channel == 0) {
display.print(F("[OMNI]"));
} else {
display_int(configuration.drums.midi_channel, 4, false, true, false);
}
}
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 (configuration.drums.midi_channel + ENCODER[ENC_R].speed() < MIDI_CHANNEL_MAX)
configuration.drums.midi_channel += ENCODER[ENC_R].speed();
else
configuration.drums.midi_channel = MIDI_CHANNEL_MAX;
} else if (LCDML.BT_checkUp() && encoderDir[ENC_R].Up()) {
if (configuration.drums.midi_channel - ENCODER[ENC_R].speed() > MIDI_CHANNEL_MIN)
configuration.drums.midi_channel -= ENCODER[ENC_R].speed();
else
configuration.drums.midi_channel = MIDI_CHANNEL_MIN;
}*/
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);
constrain(configuration.drums.midi_channel + ENCODER[ENC_R].speed(), MIDI_CHANNEL_MIN, MIDI_CHANNEL_MAX);
else if (LCDML.BT_checkUp() && encoderDir[ENC_R].Up())
configuration.drums.midi_channel = constrain(configuration.drums.midi_channel - ENCODER[ENC_R].speed(), MIDI_CHANNEL_MIN, MIDI_CHANNEL_MAX);
constrain(configuration.drums.midi_channel - ENCODER[ENC_R].speed(), MIDI_CHANNEL_MIN, MIDI_CHANNEL_MAX);
display.setCursor(0, 1);
if (configuration.drums.midi_channel == 0) {
@ -4061,6 +4094,9 @@ void UI_func_drum_midi_channel(uint8_t param) {
} else {
display_int(configuration.drums.midi_channel, 4, false, true, false);
}
#ifdef DEBUG
Serial.printf_P(PSTR("Changing drum MIDI channel to %d\n"), configuration.drums.midi_channel);
#endif
}
}
@ -4129,23 +4165,15 @@ void UI_func_drum_pitch(uint8_t param) {
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) {
if (active_sample < NUM_DRUMSET_CONFIG - 2) {
if (active_sample < NUM_DRUMSET_CONFIG - 2)
active_sample++;
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) {
if (active_sample > 0) {
if (active_sample > 0)
active_sample--;
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);
}
@ -4191,13 +4219,16 @@ void UI_func_drum_vol_min_max(uint8_t param) {
tmp_name[8] = '\0';
display.setCursor(0, 0);
display.print(F("Vol [Min]/ Max "));
display.print(F("Volume"));
display.setCursor(1, 1);
display.print(tmp_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.setCursor(LCD_cols - 3, 1);
if (input_type == 0)
snprintf_P(tmp_val, sizeof(tmp_val), PSTR("%2d"), configuration.drums.vol_min[active_sample]);
else
snprintf_P(tmp_val, sizeof(tmp_val), PSTR("%2d"), configuration.drums.vol_max[active_sample]);
display.print(tmp_val);
_check_display_name_min_max(input_mode, 4);
_check_display_name_min_max(input_mode, input_type, 2);
}
if (LCDML.FUNC_loop()) // ****** LOOP *********
@ -4206,37 +4237,40 @@ void UI_func_drum_vol_min_max(uint8_t param) {
if (LCDML.BT_checkDown()) {
switch (input_mode) {
case 0:
if (active_sample < NUM_DRUMSET_CONFIG - 2) {
active_sample++;
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);
}
if (input_type == 0)
input_type = 1;
break;
case 1:
configuration.drums.pitch[active_sample] = constrain(configuration.drums.pitch[active_sample] + ENCODER[ENC_L].speed(), DRUMS_PITCH_MIN, DRUMS_PITCH_MAX);
if (active_sample < NUM_DRUMSET_CONFIG - 2)
active_sample++;
break;
case 2:
if (input_type == 0)
configuration.drums.vol_min[active_sample] = constrain(configuration.drums.vol_min[active_sample] + ENCODER[ENC_L].speed(), DRUMS_VOL_MIN, DRUMS_VOL_MAX);
else
configuration.drums.vol_max[active_sample] = constrain(configuration.drums.vol_max[active_sample] + ENCODER[ENC_L].speed(), DRUMS_VOL_MIN, DRUMS_VOL_MAX);
break;
}
} else if (LCDML.BT_checkUp()) {
switch (input_mode) {
case 0:
if (active_sample > 0) {
active_sample--;
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);
}
if (input_type == 1)
input_type = 0;
break;
case 1:
configuration.drums.pitch[active_sample] = constrain(configuration.drums.pitch[active_sample] - ENCODER[ENC_L].speed(), DRUMS_PITCH_MIN, DRUMS_PITCH_MAX);
if (active_sample > 0)
active_sample--;
break;
case 2:
if (input_type == 0)
configuration.drums.vol_min[active_sample] = constrain(configuration.drums.vol_min[active_sample] - ENCODER[ENC_L].speed(), DRUMS_VOL_MIN, DRUMS_VOL_MAX);
else
configuration.drums.vol_max[active_sample] = constrain(configuration.drums.vol_max[active_sample] - ENCODER[ENC_L].speed(), DRUMS_VOL_MIN, DRUMS_VOL_MAX);
break;
}
} else if (LCDML.BT_checkEnter()) {
input_mode = input_mode++ % 3;
input_mode++;
input_mode %= 3;
}
}
#ifdef DEBUG
@ -4251,11 +4285,14 @@ void UI_func_drum_vol_min_max(uint8_t param) {
display.setCursor(1, 1);
display.print(tmp_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.setCursor(LCD_cols - 3, 1);
if (input_type == 0)
snprintf_P(tmp_val, sizeof(tmp_val), PSTR("%2d"), configuration.drums.vol_min[active_sample]);
else
snprintf_P(tmp_val, sizeof(tmp_val), PSTR("%2d"), configuration.drums.vol_max[active_sample]);
display.print(tmp_val);
_check_display_name_min_max(input_mode, 4);
_check_display_name_min_max(input_mode, input_type, 2);
}
if (LCDML.FUNC_close()) // ****** STABLE END *********
@ -4293,23 +4330,15 @@ void UI_func_drum_pan(uint8_t param) {
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) {
if (active_sample < NUM_DRUMSET_CONFIG - 2) {
if (active_sample < NUM_DRUMSET_CONFIG - 2)
active_sample++;
display.setCursor(LCD_cols - 5, 1);
snprintf_P(tmp_val, sizeof(tmp_val), PSTR("%4.1f"), configuration.drums.pan[active_sample] / 10.0);
display.print(tmp_val);
}
} else {
configuration.drums.pan[active_sample] = constrain(configuration.drums.pan[active_sample] + ENCODER[ENC_L].speed(), DRUMS_PANORAMA_MIN, DRUMS_PANORAMA_MAX);
}
} else if (LCDML.BT_checkUp()) {
if (display_name == true) {
if (active_sample > 0) {
if (active_sample > 0)
active_sample--;
display.setCursor(LCD_cols - 5, 1);
snprintf_P(tmp_val, sizeof(tmp_val), PSTR("%4.1f"), configuration.drums.pan[active_sample] / 10.0);
display.print(tmp_val);
}
} else {
configuration.drums.pan[active_sample] = constrain(configuration.drums.pan[active_sample] - ENCODER[ENC_L].speed(), DRUMS_PANORAMA_MIN, DRUMS_PANORAMA_MAX);
}
@ -4368,23 +4397,15 @@ void UI_func_drum_reverb_send(uint8_t param) {
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) {
if (active_sample < NUM_DRUMSET_CONFIG - 2) {
if (active_sample < NUM_DRUMSET_CONFIG - 2)
active_sample++;
display.setCursor(LCD_cols - 3, 1);
snprintf_P(tmp_val, sizeof(tmp_val), PSTR("%2d"), configuration.drums.reverb_send[active_sample]);
display.print(tmp_val);
}
} else {
configuration.drums.reverb_send[active_sample] = constrain(configuration.drums.reverb_send[active_sample] + ENCODER[ENC_L].speed(), DRUMS_REVERB_SEND_MIN, DRUMS_REVERB_SEND_MAX);
}
} else if (LCDML.BT_checkUp()) {
if (display_name == true) {
if (active_sample > 0) {
if (active_sample > 0)
active_sample--;
display.setCursor(LCD_cols - 3, 1);
snprintf_P(tmp_val, sizeof(tmp_val), PSTR("%2d"), configuration.drums.reverb_send[active_sample]);
display.print(tmp_val);
}
} else {
configuration.drums.reverb_send[active_sample] = constrain(configuration.drums.reverb_send[active_sample] - ENCODER[ENC_L].speed(), DRUMS_REVERB_SEND_MIN, DRUMS_REVERB_SEND_MAX);
}
@ -4450,23 +4471,15 @@ void UI_func_drum_midi_note(uint8_t param) {
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) {
if (active_sample < NUM_DRUMSET_CONFIG - 2) {
if (active_sample < NUM_DRUMSET_CONFIG - 2)
active_sample++;
display.setCursor(LCD_cols - 4, 1);
getNoteName(tmp_val, configuration.drums.midinote[active_sample]);
display.print(tmp_val);
}
} else {
configuration.drums.midinote[active_sample] = constrain(configuration.drums.midinote[active_sample] + ENCODER[ENC_L].speed(), DRUMS_MIDI_NOTE_MIN, DRUMS_MIDI_NOTE_MAX);
}
} else if (LCDML.BT_checkUp()) {
if (display_name == true) {
if (active_sample > 0) {
if (active_sample > 0)
active_sample--;
display.setCursor(LCD_cols - 4, 1);
getNoteName(tmp_val, configuration.drums.midinote[active_sample]);
display.print(tmp_val);
}
} else {
configuration.drums.midinote[active_sample] = constrain(configuration.drums.midinote[active_sample] - ENCODER[ENC_L].speed(), DRUMS_MIDI_NOTE_MIN, DRUMS_MIDI_NOTE_MAX);
}

Loading…
Cancel
Save