From 3e3eba914deb451fd501f017dacd326f046be3a9 Mon Sep 17 00:00:00 2001 From: positionhigh Date: Fri, 23 Jul 2021 23:15:52 +0200 Subject: [PATCH] =?UTF-8?q?Dateien=20hochladen=20nach=20=E2=80=9E=E2=80=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- MicroDexed.ino | 26 +++++++++- UI.hpp | 125 +++++++++++++++++++++++++++++++++++++++++++++++++ UI_FX.h | 17 +++---- UI_FX_T4.h | 17 +++---- config.h | 34 ++++---------- 5 files changed, 178 insertions(+), 41 deletions(-) diff --git a/MicroDexed.ino b/MicroDexed.ino index 7a4eb77..956893c 100644 --- a/MicroDexed.ino +++ b/MicroDexed.ino @@ -268,6 +268,7 @@ int16_t _midi_bpm = -1; elapsedMillis midi_bpm_timer; elapsedMillis long_button_pressed; elapsedMillis control_rate; +elapsedMillis sequencer_timer; uint8_t active_voices[NUM_DEXED]; uint8_t midi_voices[NUM_DEXED]; #ifdef SHOW_CPU_LOAD_MSEC @@ -288,7 +289,13 @@ char g_voice_name[NUM_DEXED][VOICE_NAME_LEN]; char g_bank_name[NUM_DEXED][BANK_NAME_LEN]; char receive_bank_filename[FILENAME_LEN]; uint8_t selected_instance_id = 0; - +uint8_t seqsteptimer=0; +uint32_t seqtimer_old=5000; +//uint8_t seqdata[1][16]={48,48,54,48,49,54,54,48,54,54,48,54,49,54,54,54}; +//uint8_t seqdata[1][16]={72,72,78,72,75,78,78,72,78,78,72,78,75,78,78,78}; +uint8_t seqdata[3][16]={72,72, 0,72,75, 0, 0,72, 0, 0,72, 0,75, 0, 0, 0, + 73,73, 0,73, 0, 0,73,73, 0, 0,73,73, 0, 0, 0, 0, + 78, 0, 0,78, 0, 0,78, 0,78,78, 0, 0, 0, 0, 0, 0}; #ifdef TEENSY4 #if NUM_DEXED>1 int8_t midi_decay[NUM_DEXED] = { -1, -1}; @@ -599,6 +606,23 @@ void loop() ENCODER[ENC_L].update(); ENCODER[ENC_R].update(); + //sequencer + if (sequencer_timer > seqtimer_old +125) + + { + +seqtimer_old=sequencer_timer; +if (seqdata[0][seqsteptimer]>0) {handleNoteOn(DRUM_MIDI_CHANNEL, seqdata[0][seqsteptimer] , 99);} +if (seqdata[1][seqsteptimer]>0) {handleNoteOn(DRUM_MIDI_CHANNEL, seqdata[1][seqsteptimer] , 99);} +if (seqdata[2][seqsteptimer]>0) {handleNoteOn(DRUM_MIDI_CHANNEL, seqdata[2][seqsteptimer] , 99);} +seqsteptimer++; + +} +if (seqsteptimer>15)seqsteptimer=0; + +//Serial.print(seqsteptimer); +//Serial.println(""); + #ifdef ENABLE_LCD_UI LCDML.loop(); #endif diff --git a/UI.hpp b/UI.hpp index 938727d..b6c9c44 100644 --- a/UI.hpp +++ b/UI.hpp @@ -63,6 +63,13 @@ 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; +uint8_t activesample; +#if NUM_DRUMS > 0 +#include "drums.h" +#endif + #ifdef DISPLAY_LCD_SPI extern void change_disp_sd(bool d); @@ -114,6 +121,7 @@ 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; #ifdef I2C_DISPLAY #include @@ -234,6 +242,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 +3528,122 @@ 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.setCursor(0, 0); + lcd.print(drum_config[activesample].midinote); + +lcd.setCursor(11, 0); + lcd.print("["); + + lcd.setCursor(12, 0); + lcd.print(active_seq_track+1); + + lcd.setCursor(13, 0); + lcd.print("/3]"); + + // lcd.setCursor(2, 0); + // lcd.print("[" ); + + lcd.setCursor(0, 1); + lcd.print("----------------" ); + + lcd.setCursor(3, 0); + displayname=drum_config[activesample].filename; + + lcd.print(displayname.substring(5,12) ); + + lcd.setCursor(10, 0); + // 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_loop()) // ****** LOOP ********* + { + + +// 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(0, 0); +// +//lcd.print(drum_config[activesample].midinote); +// +// lcd.setCursor(3, 0); +// displayname=drum_config[activesample].filename; +// +// lcd.print(displayname.substring(5,12) ); + + 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; + } + } + + } + + lcd.setCursor(11, 0); + lcd.print("["); + + lcd.setCursor(12, 0); + lcd.print(active_seq_track+1); + + lcd.setCursor(13, 0); + lcd.print("/3]"); + } + + if (LCDML.FUNC_close()) // ****** STABLE END ********* + { + encoderDir[ENC_R].reset(); + } +} + void UI_func_information(uint8_t param) { if (LCDML.FUNC_setup()) // ****** SETUP ********* 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/config.h b/config.h index 703ec18..40b8bd4 100644 --- a/config.h +++ b/config.h @@ -92,8 +92,8 @@ //************************************************************************************************* #define DEBUG 1 #define SERIAL_SPEED 230400 -#define SHOW_XRUN 1 -#define SHOW_CPU_LOAD_MSEC 5000 +//#define SHOW_XRUN 1 +//#define SHOW_CPU_LOAD_MSEC 5000 //************************************************************************************************* //* DEXED AND EFFECTS SETTINGS @@ -103,7 +103,7 @@ #warning >>> Sorry, only one instance possible for Teensy-3.6 #define NUM_DEXED 1 // 1 or 2 - nothing else! #else -#define NUM_DEXED 2 // 1 or 2 - nothing else! +#define NUM_DEXED 1 // 1 or 2 - nothing else! #endif // FX-CHAIN ENABLE/DISABLE @@ -242,27 +242,13 @@ // Encoder with button //#define ENCODER_USE_INTERRUPTS #define NUM_ENCODER 2 -#define ENC_L_PIN_A 3 -#define ENC_L_PIN_B 2 -#define BUT_L_PIN 4 -#if defined(TEENSY3_6) -#define ENC_R_PIN_A 28 -#define ENC_R_PIN_B 29 -#define BUT_R_PIN 30 -#else -#if defined(TEENSY4_0) -#define ENC_R_PIN_A 6 -#define ENC_R_PIN_B 5 -#define BUT_R_PIN 8 -//#define ENC_R_PIN_A 17 -//#define ENC_R_PIN_B 16 -//#define BUT_R_PIN 5 -#else // ARDUINO_TEENSY41 -#define ENC_R_PIN_A 24 -#define ENC_R_PIN_B 5 -#define BUT_R_PIN 9 -#endif -#endif +#define ENC_L_PIN_A 26 +#define ENC_L_PIN_B 25 +#define BUT_L_PIN 31 + +#define ENC_R_PIN_A 29 +#define ENC_R_PIN_B 28 +#define BUT_R_PIN 32 #define BUT_DEBOUNCE_MS 20 #define LONG_BUTTON_PRESS 500