Small fixes for drum midi note learning.

dev
Holger Wirtz 2 years ago
parent 167f5b0162
commit ba11d092ee
  1. 5
      MicroDexed.ino
  2. 13
      UI.hpp

@ -338,6 +338,7 @@ int perform_release_mod[NUM_DEXED] = { 0, 0 };
int16_t* delayline[NUM_DEXED]; int16_t* delayline[NUM_DEXED];
int16_t* ep_delayline_r; int16_t* ep_delayline_r;
int16_t* ep_delayline_l; int16_t* ep_delayline_l;
uint8_t midinote_old[NUM_DRUMSET_CONFIG];
#if NUM_DRUMS > 0 #if NUM_DRUMS > 0
//extern drum_config_t drum_config[NUM_DRUMSET_CONFIG]; //extern drum_config_t drum_config[NUM_DRUMSET_CONFIG];
@ -2237,8 +2238,10 @@ int8_t handle_midi_learn(int8_t note) {
LCDML.OTHER_jumpToFunc(UI_func_drum_vol_min_max); LCDML.OTHER_jumpToFunc(UI_func_drum_vol_min_max);
} else if (LCDML.FUNC_getID() == LCDML.OTHER_getIDFromFunction(UI_func_drum_midi_note)) { } else if (LCDML.FUNC_getID() == LCDML.OTHER_getIDFromFunction(UI_func_drum_midi_note)) {
ret_channel = configuration.drums.midi_channel; ret_channel = configuration.drums.midi_channel;
if (midi_learn_mode & 0x80) if (midi_learn_mode & 0x80) {
configuration.drums.midinote[active_sample] = midinote_old[active_sample];
active_sample = get_drums_id_by_note(note); active_sample = get_drums_id_by_note(note);
} else configuration.drums.midinote[active_sample] = note;
midi_learn_mode |= note; midi_learn_mode |= note;
LCDML.OTHER_jumpToFunc(UI_func_drum_midi_note); LCDML.OTHER_jumpToFunc(UI_func_drum_midi_note);
} else if (LCDML.FUNC_getID() == LCDML.OTHER_getIDFromFunction(UI_func_drum_pitch)) { } else if (LCDML.FUNC_getID() == LCDML.OTHER_getIDFromFunction(UI_func_drum_pitch)) {

@ -132,6 +132,7 @@ extern uint8_t midi_bpm;
extern bool save_sys_flag; extern bool save_sys_flag;
extern elapsedMillis save_sys; extern elapsedMillis save_sys;
extern bool save_sys_flag; extern bool save_sys_flag;
extern uint8_t midinote_old[NUM_DRUMSET_CONFIG];
/*********************************************************************** /***********************************************************************
GLOBAL GLOBAL
@ -4427,7 +4428,6 @@ void UI_func_drum_midi_note(uint8_t param) {
} }
#else #else
static bool display_name; static bool display_name;
static uint8_t midinote_old[NUM_DRUMSET_CONFIG];
static int8_t ask_before_quit_mode; static int8_t ask_before_quit_mode;
char tmp_val[4]; char tmp_val[4];
@ -4488,8 +4488,10 @@ void UI_func_drum_midi_note(uint8_t param) {
LCDML.loop_menu(); LCDML.loop_menu();
} else { } else {
if (display_name == true) { if (display_name == true) {
if (active_sample < NUM_DRUMSET_CONFIG - 2) if (active_sample < NUM_DRUMSET_CONFIG - 2) {
configuration.drums.midinote[active_sample] = midinote_old[active_sample];
active_sample++; active_sample++;
}
} else } else
configuration.drums.midinote[active_sample] = constrain(configuration.drums.midinote[active_sample] + ENCODER[ENC_L].speed(), DRUMS_MIDI_NOTE_MIN, DRUMS_MIDI_NOTE_MAX); configuration.drums.midinote[active_sample] = constrain(configuration.drums.midinote[active_sample] + ENCODER[ENC_L].speed(), DRUMS_MIDI_NOTE_MIN, DRUMS_MIDI_NOTE_MAX);
} }
@ -4504,8 +4506,10 @@ void UI_func_drum_midi_note(uint8_t param) {
LCDML.loop_menu(); LCDML.loop_menu();
} else { } else {
if (display_name == true) { if (display_name == true) {
if (active_sample > 0) if (active_sample > 0) {
configuration.drums.midinote[active_sample] = midinote_old[active_sample];
active_sample--; active_sample--;
}
} else } else
configuration.drums.midinote[active_sample] = constrain(configuration.drums.midinote[active_sample] - ENCODER[ENC_L].speed(), DRUMS_MIDI_NOTE_MIN, DRUMS_MIDI_NOTE_MAX); configuration.drums.midinote[active_sample] = constrain(configuration.drums.midinote[active_sample] - ENCODER[ENC_L].speed(), DRUMS_MIDI_NOTE_MIN, DRUMS_MIDI_NOTE_MAX);
} }
@ -4533,11 +4537,10 @@ void UI_func_drum_midi_note(uint8_t param) {
LCDML.OTHER_updateFunc(); LCDML.OTHER_updateFunc();
LCDML.loop_menu(); LCDML.loop_menu();
} }
} else { } else
display_name = !display_name; display_name = !display_name;
} }
} }
}
if (ask_before_quit_mode < 0) { if (ask_before_quit_mode < 0) {
getNoteName(tmp_val, configuration.drums.midinote[active_sample]); getNoteName(tmp_val, configuration.drums.midinote[active_sample]);

Loading…
Cancel
Save