pull/58/head
Holger Wirtz 3 years ago
commit c2ce0c270d
  1. 59
      MicroDexed.ino
  2. 269
      UI.hpp
  3. 17
      UI_FX.h
  4. 17
      UI_FX_T4.h
  5. 2
      drums.h
  6. 3
      midi_devices.hpp
  7. 103
      sequencer.cpp
  8. 50
      sequencer.h

@ -284,7 +284,6 @@ 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
@ -305,17 +304,6 @@ 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 = 0;
bool seq_running = false;
bool seq_recording = false;
uint8_t seq_note_in;
//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};
@ -341,6 +329,7 @@ int16_t delayline[NUM_DEXED][MOD_DELAY_SAMPLE_BUFFER];
extern uint8_t drum_counter;
extern uint8_t drum_type[NUM_DRUMS];
extern drum_config_t drum_config[NUM_DRUMCONFIG];
extern void sequencer(void);
#endif
#ifdef ENABLE_LCD_UI
@ -655,51 +644,7 @@ void loop()
ENCODER[ENC_R].update();
if (seq_running) {
if (sequencer_timer > seqtimer_old + 125)
{
seqtimer_old = sequencer_timer;
if (LCDML.FUNC_getID() == LCDML.OTHER_getIDFromFunction(UI_func_sequencer)) {
//write to sequencer if in sequencer menu (step recording and live recording)
if (seq_note_in > 0 && seq_recording == true) {
seqdata[active_seq_track][seqsteptimer] = seq_note_in;
seq_note_in = 0;
}
lcd.setCursor(seqsteptimer, 1);
lcd.print("X");
if (seqsteptimer == 0) {
lcd.setCursor(15, 1);
lcd.print(seq_find_shortname(15));
}
else
{
lcd.setCursor(seqsteptimer - 1, 1);
lcd.print(seq_find_shortname(seqsteptimer - 1));
}
}
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;
}
}
sequencer();
}
#ifdef ENABLE_LCD_UI
LCDML.loop();

269
UI.hpp

@ -28,6 +28,7 @@
#include "config.h"
#include "disp_plus.h"
#include "effect_modulated_delay.h"
#include "effect_stereo_mono.h"
#ifdef USE_PLATEREVERB
@ -63,17 +64,24 @@ 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 uint8_t seq_data[4][16];
extern uint8_t seq_patternchain[4][4];
extern uint8_t seq_step_timer;
extern bool seq_running;
extern bool seq_recording;
uint8_t seq_active_function = 99;
uint8_t activesample;
extern uint8_t seq_active_track;
extern elapsedMillis seq_millis_timer;
extern uint8_t seq_menu;
extern bool seq_button_r;
extern uint8_t seq_chain_select_menu;
extern uint8_t seq_chain_active_menu;
extern uint8_t seq_chain_active_chainstep;
#if NUM_DRUMS > 0
#include "drums.h"
#endif
#ifdef DISPLAY_LCD_SPI
extern void change_disp_sd(bool d);
#endif
@ -115,6 +123,7 @@ extern int perform_release_mod[NUM_DEXED];
extern float midi_ticks_factor[10];
extern uint8_t midi_bpm;
/***********************************************************************
GLOBAL
************************************************************************/
@ -124,9 +133,6 @@ 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;
bool seq_button_r = false;
#ifdef I2C_DISPLAY
#include <LiquidCrystal_I2C.h>
@ -248,6 +254,7 @@ 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_seq_pat_chain(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);
@ -3535,29 +3542,51 @@ void UI_handle_OP(uint8_t param)
}
const char* seq_find_shortname(uint8_t seqstep)
const char* seq_find_shortname(uint8_t sstep)
{
const char* shortname = " ";
bool found = false;
for (uint8_t d = 0; d < NUM_DRUMCONFIG - 1; d++)
{
if (seqdata[active_seq_track][seqstep] == drum_config[d].midinote)
if (seq_active_track < 3) {
for (uint8_t d = 0; d < NUM_DRUMCONFIG - 1; d++)
{
shortname = drum_config[d].shortname;
found = true;
break;
if (seq_data[ seq_patternchain[0][seq_active_track] ][sstep] == drum_config[d].midinote)
{
shortname = drum_config[d].shortname;
found = true;
break;
}
}
}
if (found == false) shortname = "-";
if (found == false) shortname = "-";
} else
{
if (seq_data[seq_active_track][sstep] > 0) shortname = "*"; else shortname = "-";
}
return shortname;
}
// deactivated for now since audio library seems not like to change reverb settings at runtime (and is skipping notes)
//void seq_set_rev_for_single_instr_per_step(uint8_t track, uint8_t note)
//{
//
// if (track < 3) {
// for (uint8_t d = 0; d < NUM_DRUMCONFIG - 1; d++)
// {
// if (seq_data[track][seq_step_timer] == drum_config[d].midinote)
// {
// drum_config[d].reverb_send = float(seq_reverb[track][seq_step_timer]) / float(100);
// break;
// }
// }
// }
//}
void UI_func_sequencer(uint8_t param)
{
char displayname[9];
char displayname[7];
if (LCDML.FUNC_setup()) // ****** SETUP *********
{
@ -3582,8 +3611,7 @@ void UI_func_sequencer(uint8_t param)
lcd.print("STP");
}
lcd.setCursor(14, 0);
lcd.print(active_seq_track + 1);
lcd.setCursor(10, 0);
lcd.print(seq_active_track + 1);
for (int i = 0; i < 16; i++) {
lcd.setCursor(i, 1);
lcd.print(seq_find_shortname(i) );
@ -3612,9 +3640,9 @@ void UI_func_sequencer(uint8_t param)
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);
seq_active_track = constrain(seq_active_track + 1, 0, 3);
else if (LCDML.BT_checkUp())
active_seq_track = constrain(active_seq_track - 1, 0, 2);
seq_active_track = constrain(seq_active_track - 1, 0, 3);
}
}
if (seq_button_r) //handle button presses during menu >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
@ -3626,16 +3654,17 @@ void UI_func_sequencer(uint8_t param)
} else if ( seq_menu == 0 && seq_active_function == 0)
{
if (activesample == NUM_DRUMCONFIG + 2) {
memset(seqdata[0], 0, sizeof(seqdata[0]));
memset(seqdata[1], 0, sizeof(seqdata[1]));
memset(seqdata[2], 0, sizeof(seqdata[2]));
memset(seq_data[0], 0, sizeof(seq_data[0]));
memset(seq_data[1], 0, sizeof(seq_data[1]));
memset(seq_data[2], 0, sizeof(seq_data[2]));
memset(seq_data[3], 0, sizeof(seq_data[3]));
for (int i = 0; i < 16; i++) {
lcd.setCursor(i, 1);
lcd.print(seq_find_shortname(i) );
}
} else if (activesample == NUM_DRUMCONFIG + 1) {
memset(seqdata[active_seq_track], 0, sizeof(seqdata[active_seq_track]));
memset(seq_data[seq_active_track], 0, sizeof(seq_data[seq_active_track]));
for (int i = 0; i < 16; i++) {
lcd.setCursor(i, 1);
lcd.print(seq_find_shortname(i) );
@ -3665,6 +3694,7 @@ void UI_func_sequencer(uint8_t param)
seq_recording = false;
seq_note_in = 0;
lcd.print("PLY");
MicroDexed[0]->panic();
}
} else if ( seq_menu == 2)
@ -3673,7 +3703,7 @@ void UI_func_sequencer(uint8_t param)
} else if (seq_menu > 2)
{
if (seq_active_function == 99) {
seqdata[active_seq_track][seq_menu - 3] = drum_config[activesample].midinote;
seq_data[seq_active_track][seq_menu - 3] = drum_config[activesample].midinote;
}
else
seq_active_function = 99;
@ -3741,7 +3771,7 @@ void UI_func_sequencer(uint8_t param)
lcd.setCursor(13, 0);
lcd.print("[");
lcd.setCursor(14, 0);
lcd.print(active_seq_track + 1);
lcd.print(seq_active_track + 1);
lcd.setCursor(15, 0);
lcd.print("]");
lcd.setCursor(0, 1);
@ -3771,11 +3801,198 @@ void UI_func_sequencer(uint8_t param)
}
}
if (LCDML.FUNC_close()) // ****** STABLE END *********
{
encoderDir[ENC_R].reset();
seq_running = false;
seq_recording = false;
seq_note_in = 0;
MicroDexed[0]->panic();
}
}
void UI_func_seq_pat_chain(uint8_t param)
{
if (LCDML.FUNC_setup()) // ****** SETUP *********
{
// setup function
seq_button_r = false;
lcd.setCursor( 12, 0);
lcd.print(seq_chain_active_chainstep + 1);
lcd.setCursor( 13, 0);
lcd.print("/4");
lcd.setCursor(0 , 0);
lcd.print("D");
lcd.setCursor(2 , 0);
lcd.print( seq_patternchain[seq_chain_active_chainstep][0]);
lcd.setCursor(0 , 1);
lcd.print("D");
lcd.setCursor(2 , 1);
lcd.print( seq_patternchain[seq_chain_active_chainstep][1]);
lcd.setCursor(6 , 0);
lcd.print("D");
lcd.setCursor(8 , 0);
lcd.print( seq_patternchain[seq_chain_active_chainstep][2]);
lcd.setCursor(6 , 1);
lcd.print("I");
lcd.setCursor(8 , 1);
lcd.print( seq_patternchain[seq_chain_active_chainstep][3]);
}
if (LCDML.FUNC_loop()) // ****** LOOP *********
{
if (seq_chain_active_menu == 99) {
if ((LCDML.BT_checkDown() && encoderDir[ENC_R].Down()) || (LCDML.BT_checkUp() && encoderDir[ENC_R].Up()))
{
if (LCDML.BT_checkDown())
seq_chain_select_menu = constrain(seq_chain_select_menu + 1, 0, 4);
else if (LCDML.BT_checkUp())
seq_chain_select_menu = constrain(seq_chain_select_menu - 1, 0, 4);
}
} else if (seq_chain_active_menu == 4) {
if ((LCDML.BT_checkDown() && encoderDir[ENC_R].Down()) || (LCDML.BT_checkUp() && encoderDir[ENC_R].Up()))
{
if (LCDML.BT_checkDown())
seq_chain_active_chainstep = constrain(seq_chain_active_chainstep + 1, 0, 3);
else if (LCDML.BT_checkUp())
seq_chain_active_chainstep = constrain(seq_chain_active_chainstep - 1, 0, 3);
}
}
else if (seq_chain_active_menu < 4) {
if ((LCDML.BT_checkDown() && encoderDir[ENC_R].Down()) || (LCDML.BT_checkUp() && encoderDir[ENC_R].Up()))
{
if (LCDML.BT_checkDown())
seq_patternchain[seq_chain_active_chainstep][seq_chain_active_menu] = constrain(seq_patternchain[seq_chain_active_chainstep][seq_chain_active_menu] + 1, 0, 9);
else if (LCDML.BT_checkUp())
seq_patternchain[seq_chain_active_chainstep][seq_chain_active_menu] = constrain(seq_patternchain[seq_chain_active_chainstep][seq_chain_active_menu] - 1, 0, 9);
}
}
if (seq_chain_select_menu == 0 && seq_chain_active_menu == 99) // Drum 0
{
lcd.setCursor(1 , 0);
lcd.print("[");
lcd.setCursor(3 , 0);
lcd.print("]");
lcd.setCursor(1 , 1);
lcd.print(" ");
lcd.setCursor(3 , 1);
lcd.print(" ");
} else if (seq_chain_select_menu == 1 && seq_chain_active_menu == 99) // Drum 1
{
lcd.setCursor(1 , 0);
lcd.print(" ");
lcd.setCursor(3 , 0);
lcd.print(" ");
lcd.setCursor(7 , 0);
lcd.print(" ");
lcd.setCursor(9 , 0);
lcd.print(" ");
lcd.setCursor(1 , 1);
lcd.print("[");
lcd.setCursor(3 , 1);
lcd.print("]");
} else if (seq_chain_select_menu == 2 && seq_chain_active_menu == 99) // Drum 2
{
lcd.setCursor(7 , 0);
lcd.print("[");
lcd.setCursor(9 , 0);
lcd.print("]");
lcd.setCursor(1 , 1);
lcd.print(" ");
lcd.setCursor(3 , 1);
lcd.print(" ");
lcd.setCursor(7 , 1);
lcd.print(" ");
lcd.setCursor(9 , 1);
lcd.print(" ");
} else if (seq_chain_select_menu == 3 && seq_chain_active_menu == 99) // Inst
{
lcd.setCursor(7 , 0);
lcd.print(" ");
lcd.setCursor(9 , 0);
lcd.print(" ");
lcd.setCursor(7 , 1);
lcd.print("[");
lcd.setCursor(9 , 1);
lcd.print("]");
lcd.setCursor( 11, 0);
lcd.print(" ");
lcd.setCursor( 15, 0);
lcd.print(" ");
} else if (seq_chain_select_menu == 4 && seq_chain_active_menu == 99) // Chainselect
{
lcd.setCursor(7 , 1);
lcd.print(" ");
lcd.setCursor(9 , 1);
lcd.print(" ");
lcd.setCursor( 11, 0);
lcd.print("[");
lcd.setCursor( 12, 0);
lcd.print(seq_chain_active_chainstep + 1);
lcd.setCursor( 13, 0);
lcd.print("/4]");
} else if (seq_chain_select_menu == 4 && seq_chain_active_menu == 4) // Chainselect modify
{
lcd.setCursor( 11, 0);
lcd.print("[");
lcd.setCursor( 12, 0);
lcd.print(seq_chain_active_chainstep + 1);
lcd.setCursor( 13, 0);
lcd.print("/4]");
lcd.setCursor(2 , 0);
lcd.print( seq_patternchain[seq_chain_active_chainstep][0]);
lcd.setCursor(2 , 1);
lcd.print( seq_patternchain[seq_chain_active_chainstep][1]);
lcd.setCursor(8 , 0);
lcd.print( seq_patternchain[seq_chain_active_chainstep][2]);
lcd.setCursor(8 , 1);
lcd.print( seq_patternchain[seq_chain_active_chainstep][3]);
} else if (seq_chain_select_menu == 0 && seq_chain_active_menu == 0) // Drum 0 modify
{
lcd.setCursor(2 , 0);
lcd.print( seq_patternchain[seq_chain_active_chainstep][0]);
} else if (seq_chain_select_menu == 1 && seq_chain_active_menu == 1) // Drum 1 modify
{
lcd.setCursor(2 , 1);
lcd.print( seq_patternchain[seq_chain_active_chainstep][1]);
} else if (seq_chain_select_menu == 2 && seq_chain_active_menu == 2) // Drum 2 modify
{
lcd.setCursor(8 , 0);
lcd.print( seq_patternchain[seq_chain_active_chainstep][2]);
} else if (seq_chain_select_menu == 3 && seq_chain_active_menu == 3) // Inst modify
{
lcd.setCursor(8 , 1);
lcd.print( seq_patternchain[seq_chain_active_chainstep][3]);
}
if (seq_button_r) //handle button presses during menu >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
{
seq_button_r = false;
if (seq_chain_active_menu == seq_chain_select_menu) {
seq_chain_active_menu = 99;
} else
{
seq_chain_active_menu = seq_chain_select_menu;
}
}
}
if (LCDML.FUNC_close()) // ****** STABLE END *********
{
encoderDir[ENC_R].reset();
}
}
void UI_func_information(uint8_t param)
{
if (LCDML.FUNC_setup()) // ****** SETUP *********

@ -110,12 +110,13 @@ 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, "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
LCDML_add(80, LCDML_0, 5, "Pattern Chain", UI_func_seq_pat_chain);
LCDML_add(81, LCDML_0, 6, "System", NULL);
LCDML_add(82, LCDML_0_6, 1, "Stereo/Mono", UI_func_stereo_mono);
LCDML_add(83, LCDML_0_6, 2, "MIDI Soft THRU", UI_func_midi_soft_thru);
LCDML_add(84, LCDML_0_6, 3, "Favorites", UI_func_favorites);
LCDML_add(85, LCDML_0_6, 4, "EEPROM Reset", UI_func_eeprom_reset);
LCDML_add(86, LCDML_0, 6, "Info", UI_func_information);
LCDML_addAdvanced(87, LCDML_0, 7, COND_hide, "Volume", UI_func_volume, 0, _LCDML_TYPE_default);
#define _LCDML_DISP_cnt 87
#endif

@ -113,12 +113,13 @@ 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, "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
LCDML_add(83, LCDML_0, 5, "Pattern Chain", UI_func_seq_pat_chain);
LCDML_add(84, LCDML_0, 6, "System", NULL);
LCDML_add(85, LCDML_0_6, 1, "Stereo/Mono", UI_func_stereo_mono);
LCDML_add(86, LCDML_0_6, 2, "MIDI Soft THRU", UI_func_midi_soft_thru);
LCDML_add(87, LCDML_0_6, 3, "Favorites", UI_func_favorites);
LCDML_add(88, LCDML_0_6, 4, "EEPROM Reset", UI_func_eeprom_reset);
LCDML_add(89, LCDML_0, 7, "Info", UI_func_information);
LCDML_addAdvanced(90, LCDML_0, 8, COND_hide, "Volume", UI_func_volume, 0, _LCDML_TYPE_default);
#define _LCDML_DISP_cnt 90
#endif

@ -164,7 +164,7 @@ drum_config_t drum_config[NUM_DRUMCONFIG] = {
1.0,
0.9,
0.0,
0.4
0.1
},
{
DRUM_SNARE,

@ -28,6 +28,7 @@
extern config_t configuration;
extern uint8_t seq_note_in;
extern uint8_t seq_note_in_velocity;
/* #if defined(MIDI_DEVICE_USB)
#include <midi_UsbTransport.h>
#endif */
@ -84,6 +85,7 @@ void handleNoteOn_MIDI_DEVICE_DIN(byte inChannel, byte inNumber, byte inVelocity
{
handleNoteOn(inChannel, inNumber, inVelocity);
seq_note_in=inNumber;
seq_note_in_velocity=inVelocity;
#ifdef DEBUG
Serial.print(F("[MIDI_DIN] NoteOn"));
#endif
@ -584,6 +586,7 @@ void handleNoteOn_MIDI_DEVICE_USB_HOST(byte inChannel, byte inNumber, byte inVel
{
handleNoteOn(inChannel, inNumber, inVelocity);
seq_note_in=inNumber;
seq_note_in_velocity=inVelocity;
#ifdef DEBUG
Serial.print(F("[MIDI_USB_HOST] NoteOn"));
#endif

@ -0,0 +1,103 @@
#include "config.h"
#include "sequencer.h"
#include <LCDMenuLib2.h>
#include <LiquidCrystal_I2C.h>
extern LCDMenuLib2 LCDML;
extern LiquidCrystal_I2C lcd;
extern config_t configuration;
extern void handleNoteOn(byte , byte , byte );
extern void handleNoteOff(byte , byte , byte );
extern void UI_func_sequencer(uint8_t);
extern const char* seq_find_shortname(uint8_t);
void sequencer()
{
bool seq_noteoffsent = false;
if (seq_note_in > 0 && seq_recording == false && seq_active_track == 3 && seq_note_in < 71) {
handleNoteOff(configuration.dexed[0].midi_channel, seq_data[3][seq_step_timer] + seq_transpose , 0);
handleNoteOff(configuration.dexed[0].midi_channel, seq_data[3][seq_step_timer - 1] + seq_transpose , 0);
seq_transpose = seq_note_in - 6 * 12 + 3;
seq_note_in = 0;
}
if (seq_millis_timer > seq_timer_previous + 136)
{
seq_timer_previous = seq_millis_timer;
if (LCDML.FUNC_getID() == LCDML.OTHER_getIDFromFunction(UI_func_sequencer)) {
//write to sequencer if in sequencer menu
if (seq_note_in > 0 && seq_recording == true) {
if (seq_active_track == 3) handleNoteOff(configuration.dexed[0].midi_channel, seq_data[3][seq_step_timer] + seq_transpose , 0);
seq_data[seq_active_track][seq_step_timer] = seq_note_in;
seq_vel[seq_active_track][seq_step_timer] = seq_note_in_velocity;
seq_note_in = 0;
seq_note_in_velocity=0;
}
lcd.setCursor(seq_step_timer, 1);
lcd.print("X");
if (seq_step_timer == 0) {
lcd.setCursor(15, 1);
lcd.print(seq_find_shortname(15));
}
else
{
lcd.setCursor(seq_step_timer - 1, 1);
lcd.print(seq_find_shortname(seq_step_timer - 1));
}
}
//loop for drum track 0-2
for (uint8_t d = 0; d < 3; d++)
{
if (seq_data[ seq_patternchain[0][d] ][seq_step_timer] > 0 && seq_vel[ seq_patternchain[0][d] ][seq_step_timer] > 0)
{
handleNoteOn(DRUM_MIDI_CHANNEL, seq_data[ seq_patternchain[0][d] ][seq_step_timer] , seq_vel[ seq_patternchain[0][d] ][seq_step_timer]);
}
}
// instrument track
if (seq_data[ seq_patternchain[0][3] ][seq_step_timer] > 0) //test instrument sequencer Instance=0
{
handleNoteOn(configuration.dexed[0].midi_channel, seq_data[ seq_patternchain[0][3] ][seq_step_timer] + seq_transpose , seq_vel[ seq_patternchain[0][3] ][seq_step_timer]);
}
seq_noteoffsent = false;
seq_step_timer++;
if (seq_step_timer > 15) {
seq_step_timer = 0;
}
}
if (seq_millis_timer > seq_timer_previous + 80 && seq_noteoffsent == false)
{
if (seq_step_timer > 0) {
if (seq_data[ seq_patternchain[0][3] ][seq_step_timer - 1] > 0) //test instrument sequencer Instance=0
{
handleNoteOff(configuration.dexed[0].midi_channel, seq_data[ seq_patternchain[0][3] ][seq_step_timer - 1] + seq_transpose , 0);
}
} else
{
if (seq_step_timer == 0) {
if (seq_data[ seq_patternchain[0][3] ][15] > 0) //test instrument sequencer Instance=0
{
handleNoteOff(configuration.dexed[0].midi_channel, seq_data[ seq_patternchain[0][3] ][15] + seq_transpose , 0);
;
}
}
}
seq_noteoffsent = true;
}
}

@ -0,0 +1,50 @@
uint8_t seq_active_track = 0;
uint8_t seq_menu;
bool seq_button_r = false;
bool seq_noteoffsent = false;
elapsedMillis seq_millis_timer;
uint8_t seq_step_timer = 0;
uint32_t seq_timer_previous = 0;
bool seq_running = false;
bool seq_recording = false;
uint8_t seq_note_in;
uint8_t seq_note_in_velocity;
int seq_transpose;
uint8_t seq_chain_select_menu;
uint8_t seq_chain_active_menu = 99;
uint8_t seq_chain_active_chainstep;
uint8_t seq_lenght=1; // 1=16 steps, 2=32 Steps, 3=46 Steps, 4=64 Steps
uint8_t seq_data[9][16] = {72, 0, 0, 0, 72, 0, 0, 72, 72, 0, 0, 0, 72, 0, 0, 0,
0, 0, 0, 0, 75, 0, 0, 0, 0, 0, 0, 0, 75, 0, 0, 0,
78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78,
45, 45, 57, 57, 45, 45, 57, 57, 45, 45, 57, 57, 45, 45, 57, 57,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
};
uint8_t seq_vel[9][16] = {128, 0, 0, 0, 108, 0, 0, 33, 117, 0, 0, 0, 109, 0, 0, 0,
0, 0, 0, 0, 55, 0, 0, 0, 0, 0, 0, 0, 65, 0, 0, 0,
78, 58, 88, 48, 78, 38, 78, 78, 68, 48, 68, 48, 88, 48, 78, 48,
85, 45, 87, 27, 2, 6, 5, 37, 7, 45, 33, 37, 5, 35, 2, 27,
128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,
128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,
128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,
128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,
128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128
};
//uint8_t seq_reverb[4][16] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
// 0, 0, 0, 0, 15, 0, 0, 0, 0, 0, 0, 0, 36, 0, 0, 0,
// 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
// 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
// };
uint8_t seq_patternchain[4][4] = { 0, 1, 2, 3,
0, 4, 2, 5,
0, 1, 2, 7,
0, 1, 3, 6
};
Loading…
Cancel
Save