Added MIDI learning for drum note, highest/lowest note (Dexed engines).

dev
Holger Wirtz 2 years ago
parent d809ebba6c
commit 4292e5de99
  1. 13
      MicroDexed.ino
  2. 18
      UI.hpp

@ -343,6 +343,7 @@ FLASHMEM void create_audio_drum_chain(uint8_t instance_id) {
}
#endif
// other global vars
uint8_t sd_card = 0;
Sd2Card card;
SdVolume volume;
@ -360,6 +361,7 @@ uint8_t midi_voices[NUM_DEXED];
#ifdef SHOW_CPU_LOAD_MSEC
elapsedMillis cpu_mem_millis;
#endif
uint8_t* midi_learn_var = NULL;
uint32_t cpumax = 0;
uint32_t peak_dexed = 0;
float peak_dexed_value = 0.0;
@ -903,6 +905,17 @@ void init_MIDI_send_CC(void) {
MIDI MESSAGE HANDLER
******************************************************************************/
void handleNoteOn(byte inChannel, byte inNumber, byte inVelocity) {
// check for MIDI learn mode
if (midi_learn_var != NULL) {
*midi_learn_var = inNumber;
if (LCDML.FUNC_getID() != LCDML.OTHER_getIDFromFunction(UI_func_drum_midi_note))
LCDML.OTHER_jumpToFunc(UI_func_drum_midi_note);
else if (LCDML.FUNC_getID() != LCDML.OTHER_getIDFromFunction(UI_func_lowest_note))
LCDML.OTHER_jumpToFunc(UI_func_lowest_note);
else if (LCDML.FUNC_getID() != LCDML.OTHER_getIDFromFunction(UI_func_highest_note))
LCDML.OTHER_jumpToFunc(UI_func_highest_note);
}
// Check for MicroDexed
for (uint8_t instance_id = 0; instance_id < NUM_DEXED; instance_id++) {
if (checkMidiChannel(inChannel, instance_id)) {

@ -55,6 +55,7 @@
#define _LCDML_DISP_cfg_scrollbar 1 // enable a scrollbar
extern bool check_sd_performance_exists(uint8_t number);
extern uint8_t* midi_learn_var;
extern config_t configuration;
extern void set_volume(uint8_t v, uint8_t m);
@ -333,6 +334,11 @@ void UI_func_epiano_chorus_frequency(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_level(uint8_t param);
void UI_func_drums_main_volume(uint8_t param);
void UI_func_drum_volume(uint8_t param);
void UI_func_drum_pan(uint8_t param);
void UI_func_drum_pitch(uint8_t param);
void UI_func_drum_midi_note(uint8_t param);
void UI_update_instance_icons();
bool UI_select_name(uint8_t y, uint8_t x, char* edit_string, uint8_t len, bool init);
uint8_t search_accepted_char(uint8_t c);
@ -356,11 +362,6 @@ void locate_previous_favorite();
void locate_next_favorite();
void locate_next_non_favorite();
void locate_random_non_favorite();
void UI_func_drums_main_volume(uint8_t param);
void UI_func_drum_volume(uint8_t param);
void UI_func_drum_pan(uint8_t param);
void UI_func_drum_pitch(uint8_t param);
void UI_func_drum_midi_note(uint8_t param);
char* basename(const char* filename);
char* strip_extension(char* filename);
@ -1759,6 +1760,8 @@ void UI_func_lowest_note(uint8_t param) {
lcd_active_instance_number(selected_instance_id);
UI_update_instance_icons();
midi_learn_var = &configuration.dexed[selected_instance_id].lowest_note;
}
if (LCDML.FUNC_loop()) // ****** LOOP *********
@ -1786,6 +1789,7 @@ void UI_func_lowest_note(uint8_t param) {
{
lcd_special_chars(SCROLLBAR);
encoderDir[ENC_R].reset();
midi_learn_var = NULL;
}
}
@ -1806,6 +1810,7 @@ void UI_func_highest_note(uint8_t param) {
lcd_active_instance_number(selected_instance_id);
UI_update_instance_icons();
midi_learn_var = &configuration.dexed[selected_instance_id].highest_note;
}
if (LCDML.FUNC_loop()) // ****** LOOP *********
@ -1833,6 +1838,7 @@ void UI_func_highest_note(uint8_t param) {
{
lcd_special_chars(SCROLLBAR);
encoderDir[ENC_R].reset();
midi_learn_var = NULL;
}
}
@ -4327,6 +4333,7 @@ void UI_func_drum_midi_note(uint8_t param) {
display.setCursor(0, 0);
display.print("Drum MIDI Note");
_UI_func_drum_midi_note_display(mode);
midi_learn_var = &configuration.drums.drum_midi_note[activesample];
}
if (LCDML.FUNC_loop()) // ****** LOOP *********
@ -4357,6 +4364,7 @@ void UI_func_drum_midi_note(uint8_t param) {
if (LCDML.FUNC_close()) // ****** STABLE END *********
{
encoderDir[ENC_R].reset();
midi_learn_var = NULL;
}
}

Loading…
Cancel
Save