diff --git a/UI.hpp b/UI.hpp index 938727d..788f114 100644 --- a/UI.hpp +++ b/UI.hpp @@ -63,6 +63,14 @@ extern void eeprom_update_dexed(uint8_t instance_id); extern float pseudo_log_curve(float value); extern uint8_t selected_instance_id; extern char receive_bank_filename[FILENAME_LEN]; +extern uint8_t seqdata[3][16]; +extern uint8_t seqsteptimer; +extern bool seq_running; +uint8_t activesample; +#if NUM_DRUMS > 0 +#include "drums.h" +#endif + #ifdef DISPLAY_LCD_SPI extern void change_disp_sd(bool d); @@ -114,6 +122,8 @@ const char accepted_chars[] = " ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-abcdefghijk uint8_t active_perform_page = 1; uint8_t orig_attack_values[2][7]; uint8_t orig_release_values[2][7]; +uint8_t active_seq_track = 0; +uint8_t seq_menu; #ifdef I2C_DISPLAY #include @@ -234,6 +244,7 @@ void UI_func_portamento_glissando(uint8_t param); void UI_func_portamento_time(uint8_t param); void UI_handle_OP(uint8_t param); void UI_func_information(uint8_t param); +void UI_func_sequencer(uint8_t param); void UI_func_volume(uint8_t param); void UI_func_load_performance(uint8_t param); void UI_func_save_performance(uint8_t param); @@ -3519,6 +3530,282 @@ void UI_handle_OP(uint8_t param) } } + +void UI_func_sequencer(uint8_t param) +{ + + String displayname = String(8); + + if (LCDML.FUNC_setup()) // ****** SETUP ********* + { + + encoderDir[ENC_R].reset(); + + // setup function + + // lcd.print(drum_config[activesample].midinote); + lcd.setCursor(1, 0); + displayname = drum_config[activesample].filename; + lcd.print(displayname.substring(5, 11) ); + + lcd.setCursor(8, 0); + lcd.print("["); + lcd.setCursor(9, 0); + if (seq_running) + { + lcd.print("STP"); + } + else { + lcd.print("RUN"); + } + + lcd.setCursor(12, 0); + lcd.print("]"); + + lcd.setCursor(14, 0); + lcd.print(active_seq_track + 1); + + lcd.setCursor(0, 1); + lcd.print("----------------" ); + + lcd.setCursor(10, 0); + for (int i = 0; i < 16; i++) { + lcd.setCursor(i, 1); + + for (uint8_t d = 0; d < NUM_DRUMCONFIG; d++) + { + if (seqdata[active_seq_track][i] == drum_config[d].midinote) + { + lcd.print(drum_config[d].shortname ); //one letter name of Category + break; + } + } + + } + + } + + if (LCDML.FUNC_loop()) // ****** LOOP ********* + { + + if ((LCDML.BT_checkDown() && encoderDir[ENC_R].Down()) || (LCDML.BT_checkUp() && encoderDir[ENC_R].Up())) + { + if (LCDML.BT_checkDown()) + seq_menu = constrain(seq_menu + 1, 0, 18); + else if (LCDML.BT_checkUp()) + seq_menu = constrain(seq_menu - 1, 0, 18); + } + bool foundsound = false; + if (seq_menu == 0) { + lcd.setCursor(8, 0); + lcd.print(" "); + lcd.setCursor(12, 0); + lcd.print(" "); + + lcd.setCursor(0, 0); + lcd.print("["); + lcd.setCursor(1, 0); + displayname = drum_config[activesample].filename; + lcd.print(displayname.substring(5, 11) ); + lcd.setCursor(7, 0); + lcd.print("]"); + } + + if (seq_menu == 1) { + + lcd.setCursor(0, 0); + lcd.print(" "); + lcd.setCursor(7, 0); + lcd.print(" "); + lcd.setCursor(13, 0); + lcd.print(" "); + lcd.setCursor(15, 0); + lcd.print(" "); + + lcd.setCursor(8, 0); + lcd.print("["); + lcd.setCursor(9, 0); + if (seq_running) + { + lcd.print("STP"); + } + else { + lcd.print("RUN"); + } + lcd.setCursor(12, 0); + lcd.print("]"); + + } + if (seq_menu == 2) { + lcd.setCursor(8, 0); + lcd.print(" "); + lcd.setCursor(12, 0); + lcd.print(" "); + + lcd.setCursor(13, 0); + lcd.print("["); + + lcd.setCursor(14, 0); + lcd.print(active_seq_track + 1); + + lcd.setCursor(15, 0); + lcd.print("]"); + + lcd.setCursor(0, 1); + + for (uint8_t d = 0; d < NUM_DRUMCONFIG; d++) + { + if (seqdata[active_seq_track][0] == drum_config[d].midinote) + { + lcd.print(drum_config[d].shortname ); //one letter name of Category + foundsound = true; + break; + } + } + if (foundsound == false) lcd.print("-"); + foundsound = false; + + } + + if (seq_menu == 3) { + lcd.setCursor(15, 0); + lcd.print(" "); + lcd.setCursor(13, 0); + lcd.print(" "); + + lcd.setCursor(0, 1); + lcd.print("X"); + + lcd.setCursor(1, 1); + + for (uint8_t d = 0; d < NUM_DRUMCONFIG; d++) + { + if (seqdata[active_seq_track][1] == drum_config[d].midinote) + { + lcd.print(drum_config[d].shortname ); //one letter name of Category + foundsound = true; + break; + } + } + if (foundsound == false) lcd.print("-"); + foundsound = false; + + + } + + if (seq_menu > 3) { + + lcd.setCursor(seq_menu - 3, 1); + lcd.print("X"); + + + lcd.setCursor(seq_menu - 4, 1); + + for (uint8_t d = 0; d < NUM_DRUMCONFIG; d++) + { + if (seqdata[active_seq_track][seq_menu - 4] == drum_config[d].midinote) + { + lcd.print(drum_config[d].shortname ); //one letter name of Category + foundsound = true; + break; + } + } + if (foundsound == false) lcd.print("-"); + foundsound = false; + + lcd.setCursor(seq_menu - 2, 1); + + for (uint8_t d = 0; d < NUM_DRUMCONFIG; d++) + { + if (seqdata[active_seq_track][seq_menu - 2] == drum_config[d].midinote) + { + lcd.print(drum_config[d].shortname ); //one letter name of Category + foundsound = true; + break; + } + } + if (foundsound == false) lcd.print("-"); + foundsound = false; + + + } + +// if (seq_menu == 55) { +// +// if ((LCDML.BT_checkDown() && encoderDir[ENC_R].Down()) || (LCDML.BT_checkUp() && encoderDir[ENC_R].Up())) +// { +// if (LCDML.BT_checkDown()) +// activesample = constrain(activesample + 1, 0, NUM_DRUMCONFIG - 1); +// else if (LCDML.BT_checkUp()) +// activesample = constrain(activesample - 1, 0, NUM_DRUMCONFIG - 1); +// } +// } +// else +// +// if (seq_menu == 41) { +// +// if ((LCDML.BT_checkDown() && encoderDir[ENC_R].Down()) || (LCDML.BT_checkUp() && encoderDir[ENC_R].Up())) +// { +// if (LCDML.BT_checkDown()) +// activesample = constrain(activesample + 1, 0, NUM_DRUMCONFIG - 1); +// else if (LCDML.BT_checkUp()) +// activesample = constrain(activesample - 1, 0, NUM_DRUMCONFIG - 1); +// } +// +// +// lcd.setCursor(1, 0); +// displayname = drum_config[activesample].filename; +// +// lcd.print(displayname.substring(5, 11) ); +// +// } else +// +// if (seq_menu == 54) { +// +// ; +// +// } else +// +// if (seq_menu == 555) { +// +// if ((LCDML.BT_checkDown() && encoderDir[ENC_R].Down()) || (LCDML.BT_checkUp() && encoderDir[ENC_R].Up())) +// { +// if (LCDML.BT_checkDown()) +// active_seq_track = constrain(active_seq_track + 1, 0, 2); +// else if (LCDML.BT_checkUp()) +// active_seq_track = constrain(active_seq_track - 1, 0, 2); +// } +// +// } + + + lcd.setCursor(0, 1); + lcd.print("----------------" ); + + for (int i = 0; i < 16; i++) { + lcd.setCursor(i, 1); + + for (uint8_t d = 0; d < NUM_DRUMCONFIG; d++) + { + if (seqdata[active_seq_track][i] == drum_config[d].midinote) + { + lcd.print(drum_config[d].shortname ); //one letter name of Category + break; + } + } + + } + + } + + if (LCDML.FUNC_close()) // ****** STABLE END ********* + { + + encoderDir[ENC_R].reset(); + } + +} + void UI_func_information(uint8_t param) { if (LCDML.FUNC_setup()) // ****** SETUP ********* @@ -4010,9 +4297,11 @@ void UI_func_voice_select(uint8_t param) void UI_func_volume(uint8_t param) { + char tmp[6]; if (LCDML.FUNC_setup()) // ****** SETUP ********* { + encoderDir[ENC_L].reset(); if (active_perform_page == 1) @@ -4177,6 +4466,7 @@ void UI_func_volume(uint8_t param) EEPROM.update(EEPROM_START_ADDRESS + offsetof(configuration_s, sys.vol), configuration.sys.vol); encoderDir[ENC_L].reset(); } + } void UI_func_load_performance(uint8_t param) diff --git a/UI_FX.h b/UI_FX.h index 3de9800..872384f 100644 --- a/UI_FX.h +++ b/UI_FX.h @@ -109,12 +109,13 @@ LCDML_add(75, LCDML_0_3, 5, "MIDI", NULL); LCDML_add(76, LCDML_0_3_5, 1, "MIDI Recv Bank", UI_func_sysex_receive_bank); LCDML_add(77, LCDML_0_3_5, 2, "MIDI Snd Bank", UI_func_sysex_send_bank); LCDML_add(78, LCDML_0_3_5, 3, "MIDI Snd Voice", UI_func_sysex_send_voice); -LCDML_add(79, LCDML_0, 4, "System", NULL); -LCDML_add(80, LCDML_0_4, 1, "Stereo/Mono", UI_func_stereo_mono); -LCDML_add(81, LCDML_0_4, 2, "MIDI Soft THRU", UI_func_midi_soft_thru); -LCDML_add(82, LCDML_0_4, 3, "Favorites", UI_func_favorites); -LCDML_add(83, LCDML_0_4, 4, "EEPROM Reset", UI_func_eeprom_reset); -LCDML_add(84, LCDML_0, 6, "Info", UI_func_information); -LCDML_addAdvanced(85, LCDML_0, 7, COND_hide, "Volume", UI_func_volume, 0, _LCDML_TYPE_default); -#define _LCDML_DISP_cnt 85 +LCDML_add(79, LCDML_0, 4, "Sequencer", UI_func_sequencer); +LCDML_add(80, LCDML_0, 5, "System", NULL); +LCDML_add(81, LCDML_0_5, 1, "Stereo/Mono", UI_func_stereo_mono); +LCDML_add(82, LCDML_0_5, 2, "MIDI Soft THRU", UI_func_midi_soft_thru); +LCDML_add(83, LCDML_0_5, 3, "Favorites", UI_func_favorites); +LCDML_add(84, LCDML_0_5, 4, "EEPROM Reset", UI_func_eeprom_reset); +LCDML_add(85, LCDML_0, 6, "Info", UI_func_information); +LCDML_addAdvanced(86, LCDML_0, 7, COND_hide, "Volume", UI_func_volume, 0, _LCDML_TYPE_default); +#define _LCDML_DISP_cnt 86 #endif diff --git a/UI_FX_T4.h b/UI_FX_T4.h index 15b6722..51b4b6d 100644 --- a/UI_FX_T4.h +++ b/UI_FX_T4.h @@ -112,12 +112,13 @@ LCDML_add(78, LCDML_0_3, 5, "MIDI", NULL); LCDML_add(79, LCDML_0_3_5, 1, "MIDI Recv Bank", UI_func_sysex_receive_bank); LCDML_add(80, LCDML_0_3_5, 2, "MIDI Snd Bank", UI_func_sysex_send_bank); LCDML_add(81, LCDML_0_3_5, 3, "MIDI Snd Voice", UI_func_sysex_send_voice); -LCDML_add(82, LCDML_0, 4, "System", NULL); -LCDML_add(83, LCDML_0_4, 1, "Stereo/Mono", UI_func_stereo_mono); -LCDML_add(84, LCDML_0_4, 2, "MIDI Soft THRU", UI_func_midi_soft_thru); -LCDML_add(85, LCDML_0_4, 3, "Favorites", UI_func_favorites); -LCDML_add(86, LCDML_0_4, 4, "EEPROM Reset", UI_func_eeprom_reset); -LCDML_add(87, LCDML_0, 6, "Info", UI_func_information); -LCDML_addAdvanced(88, LCDML_0, 7, COND_hide, "Volume", UI_func_volume, 0, _LCDML_TYPE_default); -#define _LCDML_DISP_cnt 88 +LCDML_add(82, LCDML_0, 4, "Sequencer", UI_func_sequencer); +LCDML_add(83, LCDML_0, 5, "System", NULL); +LCDML_add(84, LCDML_0_5, 1, "Stereo/Mono", UI_func_stereo_mono); +LCDML_add(85, LCDML_0_5, 2, "MIDI Soft THRU", UI_func_midi_soft_thru); +LCDML_add(86, LCDML_0_5, 3, "Favorites", UI_func_favorites); +LCDML_add(87, LCDML_0_5, 4, "EEPROM Reset", UI_func_eeprom_reset); +LCDML_add(88, LCDML_0, 6, "Info", UI_func_information); +LCDML_addAdvanced(89, LCDML_0, 7, COND_hide, "Volume", UI_func_volume, 0, _LCDML_TYPE_default); +#define _LCDML_DISP_cnt 89 #endif diff --git a/drums.h b/drums.h index 0d9a32d..72f6e83 100644 --- a/drums.h +++ b/drums.h @@ -32,16 +32,18 @@ typedef struct drum_config_s { uint8_t type; // Type of drum uint8_t midinote; // Triggered by note char filename[18]; // 44.1kHz mono LSB raw-sample to play + char shortname[2]; // 1 char name for sequencer float32_t pan; // Panorama (-1.0 - +1.0) float32_t vol; // Volume (0.0 - 1.0) } drum_config_t; -#define NUM_DRUMCONFIG 10 +#define NUM_DRUMCONFIG 14 drum_config_t drum_config[NUM_DRUMCONFIG] = { { DRUM_BASS, MIDI_C3, "/drm/bd01.raw", + "B", 0.0, 0.8 }, @@ -49,6 +51,7 @@ drum_config_t drum_config[NUM_DRUMCONFIG] = { DRUM_HANDCLAP, MIDI_CIS3, "/drm/cp02.raw", + "C", -0.4, 0.6 }, @@ -56,6 +59,7 @@ drum_config_t drum_config[NUM_DRUMCONFIG] = { DRUM_SNARE, MIDI_D3, "/drm/sd15.raw", + "S", 0.2, 0.8 }, @@ -63,27 +67,31 @@ drum_config_t drum_config[NUM_DRUMCONFIG] = { DRUM_HIHAT, MIDI_FIS3, "/drm/hh01.raw", + "h", 0.8, - 0.8 + 0.2 }, { DRUM_HIHAT, MIDI_GIS3, "/drm/hh02.raw", + "h", 0.8, - 0.8 + 0.2 }, { DRUM_HIHAT, MIDI_AIS3, "/drm/oh02.raw", + "H", 0.8, - 0.8 + 0.2 }, { DRUM_LOWTOM, MIDI_G3, "/drm/lt01.raw", + "T", -0.7, 0.8 }, @@ -91,6 +99,7 @@ drum_config_t drum_config[NUM_DRUMCONFIG] = { DRUM_HIGHTOM, MIDI_A3, "/drm/ht01.raw", + "T", -0.5, 0.8 }, @@ -99,14 +108,46 @@ drum_config_t drum_config[NUM_DRUMCONFIG] = { MIDI_CIS4, "/drm/rd01.raw", -0.6, - 0.8 + 0.3 }, { DRUM_RIDE, MIDI_DIS4, "/drm/rd02.raw", -0.6, - 0.8 - } + 0.3 + }, + { + DRUM_BASS, + MIDI_C5, + "/drm/PHKick1.raw", + "B", + 0.0, + 0.9 + }, + { + DRUM_HANDCLAP, + MIDI_DIS5, + "/drm/808Clap1.raw", + "C", + 0.0, + 0.9 + }, +{ + DRUM_SNARE, + MIDI_CIS5, + "/drm/808RimS1.raw", + "R", + -0.3, + 0.5 + }, + { + DRUM_HIHAT, + MIDI_FIS5, + "/drm/808HHCL1.raw", + "H", + 0.4, + 0.6 + } }; #endif