Merge pull request 'Sequencer now can latch/tie notes from 1/16 step to unlimited lenght' (#95) from positionhigh/MicroDexed:dev into dev

Reviewed-on: https://codeberg.org/dcoredump/MicroDexed/pulls/95
pull/96/head
Holger Wirtz 3 years ago
commit 55419d4fe9
  1. 2
      MicroDexed.ino
  2. 35
      UI.hpp
  3. 13
      sequencer.cpp
  4. 12
      sequencer.h

@ -667,7 +667,7 @@ void loop()
if (LCDML.FUNC_getID() == LCDML.OTHER_getIDFromFunction(UI_func_seq_pattern_editor)) //is in UI of Sequencer if (LCDML.FUNC_getID() == LCDML.OTHER_getIDFromFunction(UI_func_seq_pattern_editor)) //is in UI of Sequencer
{ {
lcd.setCursor(seq_step, 1); lcd.setCursor(seq_step, 1);
lcd.print("X"); lcd.write(124);
if (seq_step == 0) if (seq_step == 0)
{ {
lcd.setCursor(15, 1); lcd.setCursor(15, 1);

@ -4069,9 +4069,11 @@ const char* seq_find_shortname(uint8_t sstep)
if (found == false) shortname = "-"; if (found == false) shortname = "-";
} else } else
{ {
if (seq_data[seq_active_track][sstep] > 0) if (seq_data[seq_active_track][sstep] > 0 && seq_data[seq_active_track][sstep] != 130)
shortname = noteNames[seq_data[seq_active_track][sstep] % 12]; shortname = noteNames[seq_data[seq_active_track][sstep] % 12];
else shortname = "-"; else if (seq_data[seq_active_track][sstep] == 130) shortname = "~"; // note has tie/latch
else
shortname = "-";
} }
return shortname; return shortname;
} }
@ -4679,9 +4681,9 @@ void UI_func_seq_pattern_editor(uint8_t param)
if ((LCDML.BT_checkDown() && encoderDir[ENC_R].Down()) || (LCDML.BT_checkUp() && encoderDir[ENC_R].Up())) if ((LCDML.BT_checkDown() && encoderDir[ENC_R].Down()) || (LCDML.BT_checkUp() && encoderDir[ENC_R].Up()))
{ {
if (LCDML.BT_checkDown()) if (LCDML.BT_checkDown())
temp_int = constrain(temp_int + 1, 0, 114 ); temp_int = constrain(temp_int + 1, 0, 115 ); //was 114
else if (LCDML.BT_checkUp()) else if (LCDML.BT_checkUp())
temp_int = constrain(temp_int - 1, 0, 114 ); temp_int = constrain(temp_int - 1, 0, 115 );//was 114
} }
} }
} else if (seq_active_function == 2) } else if (seq_active_function == 2)
@ -4766,7 +4768,7 @@ void UI_func_seq_pattern_editor(uint8_t param)
seq_active_function = 0; seq_active_function = 0;
} else if ( seq_menu == 0 && seq_active_function == 0) } else if ( seq_menu == 0 && seq_active_function == 0)
{ {
if ( (seq_content_type[seq_active_track] == 0 && activesample == NUM_DRUMSET_CONFIG + 4) || (seq_content_type[seq_active_track] > 0 && temp_int == 114) ) if ( (seq_content_type[seq_active_track] == 0 && activesample == NUM_DRUMSET_CONFIG + 4) || (seq_content_type[seq_active_track] > 0 && temp_int == 115) )
{ //fill patterns { //fill patterns
lcd.setCursor(0, 0); lcd.setCursor(0, 0);
lcd.print("Fill Pattern:"); lcd.print("Fill Pattern:");
@ -4776,25 +4778,25 @@ void UI_func_seq_pattern_editor(uint8_t param)
seq_temp_select_menu = 0; seq_temp_select_menu = 0;
seq_temp_active_menu = 0; seq_temp_active_menu = 0;
} }
else if ( (seq_content_type[seq_active_track] == 0 && activesample == NUM_DRUMSET_CONFIG + 3) || (seq_content_type[seq_active_track] > 0 && temp_int == 113) ) else if ( (seq_content_type[seq_active_track] == 0 && activesample == NUM_DRUMSET_CONFIG + 3) || (seq_content_type[seq_active_track] > 0 && temp_int == 114) )
{ //swap patterns: Active pattern <-> destination pattern { //swap patterns: Active pattern <-> destination pattern
lcd.setCursor(0, 0); lcd.setCursor(0, 0);
lcd.print("Swap Pattern:"); lcd.print("Swap Pattern:");
temp_int = seq_active_track + 1; temp_int = seq_active_track + 1;
if (temp_int > 9)temp_int = 0; if (temp_int > 9)temp_int = 0;
seq_menu = 30; seq_menu = 30;
} else if ( (seq_content_type[seq_active_track] == 0 && activesample == NUM_DRUMSET_CONFIG + 2) || (seq_content_type[seq_active_track] > 0 && temp_int == 112) ) } else if ( (seq_content_type[seq_active_track] == 0 && activesample == NUM_DRUMSET_CONFIG + 2) || (seq_content_type[seq_active_track] > 0 && temp_int == 113) )
{ //copy pattern { //copy pattern
lcd.setCursor(0, 0); lcd.setCursor(0, 0);
lcd.print("Copy Pattern:"); lcd.print("Copy Pattern:");
temp_int = seq_active_track + 1; temp_int = seq_active_track + 1;
if (temp_int > 9)temp_int = 0; if (temp_int > 9)temp_int = 0;
seq_menu = 31; seq_menu = 31;
} else if ( (seq_content_type[seq_active_track] == 0 && activesample == NUM_DRUMSET_CONFIG + 1) || (seq_content_type[seq_active_track] > 0 && temp_int == 111) ) } else if ( (seq_content_type[seq_active_track] == 0 && activesample == NUM_DRUMSET_CONFIG + 1) || (seq_content_type[seq_active_track] > 0 && temp_int == 112) )
{ //clear all patterns { //clear all patterns
seq_clear_all_patterns(); seq_clear_all_patterns();
seq_printAllSeqSteps(); seq_printAllSeqSteps();
} else if ( (seq_content_type[seq_active_track] == 0 && activesample == NUM_DRUMSET_CONFIG) || (seq_content_type[seq_active_track] > 0 && temp_int == 110) ) } else if ( (seq_content_type[seq_active_track] == 0 && activesample == NUM_DRUMSET_CONFIG) || (seq_content_type[seq_active_track] > 0 && temp_int == 111) )
{ //clear pattern { //clear pattern
seq_clear_active_pattern(); seq_clear_active_pattern();
seq_printAllSeqSteps(); seq_printAllSeqSteps();
@ -4851,6 +4853,9 @@ void UI_func_seq_pattern_editor(uint8_t param)
if (temp_int == 109) { //clear note if (temp_int == 109) { //clear note
seq_data[seq_active_track][seq_menu - 3] = 0; seq_data[seq_active_track][seq_menu - 3] = 0;
seq_vel[seq_active_track][seq_menu - 3] = 0; seq_vel[seq_active_track][seq_menu - 3] = 0;
} else if (temp_int == 110) { //latch note
seq_data[seq_active_track][seq_menu - 3] = 130;
//seq_vel[seq_active_track][seq_menu - 3] = 0;
} else } else
{ {
seq_data[seq_active_track][seq_menu - 3] = temp_int; seq_data[seq_active_track][seq_menu - 3] = temp_int;
@ -4980,18 +4985,20 @@ void UI_func_seq_pattern_editor(uint8_t param)
lcd.print("EMPTY "); lcd.print("EMPTY ");
} else if (temp_int == 110) { } else if (temp_int == 110) {
lcd.setCursor(1, 0); lcd.setCursor(1, 0);
lcd.print("ClrPat"); lcd.print("LATCH");
} else if (temp_int == 111) { } else if (temp_int == 111) {
lcd.setCursor(1, 0); lcd.setCursor(1, 0);
lcd.print("ClrAll"); lcd.print("ClrPat");
} else if (temp_int == 112) { } else if (temp_int == 112) {
lcd.setCursor(1, 0); lcd.setCursor(1, 0);
lcd.print("Copy P"); lcd.print("ClrAll");
} else if (temp_int == 113) { } else if (temp_int == 113) {
lcd.setCursor(1, 0);
lcd.print("Copy P");
} else if (temp_int == 114) {
lcd.setCursor(1, 0); lcd.setCursor(1, 0);
lcd.print("Swap P"); lcd.print("Swap P");
} } else if (temp_int == 115) {
else if (temp_int == 114) {
lcd.setCursor(1, 0); lcd.setCursor(1, 0);
lcd.print("Fill P"); lcd.print("Fill P");
} }

@ -46,11 +46,14 @@ void sequencer_part1(void)
if (seq_data[seq_patternchain[seq_chain_active_step][d]][seq_step] > 0 ) // instrument track if (seq_data[seq_patternchain[seq_chain_active_step][d]][seq_step] > 0 ) // instrument track
{ {
if (seq_track_type[d] == 1 || (seq_track_type[d] == 3 && arp_play_basenote) ) if (seq_track_type[d] == 1 || (seq_track_type[d] == 3 && arp_play_basenote) )
{
if (seq_data[seq_patternchain[seq_chain_active_step][d]][seq_step] != 130 )
{ {
handleNoteOn(configuration.dexed[seq_inst_dexed[d]].midi_channel, seq_data[ seq_patternchain[seq_chain_active_step][d] ][seq_step], seq_vel[ seq_patternchain[seq_chain_active_step][d] ][seq_step]); handleNoteOn(configuration.dexed[seq_inst_dexed[d]].midi_channel, seq_data[ seq_patternchain[seq_chain_active_step][d] ][seq_step], seq_vel[ seq_patternchain[seq_chain_active_step][d] ][seq_step]);
seq_prev_note[d] = seq_data[ seq_patternchain[seq_chain_active_step][d] ][seq_step]; seq_prev_note[d] = seq_data[ seq_patternchain[seq_chain_active_step][d] ][seq_step];
seq_prev_vel[d] = seq_vel[ seq_patternchain[seq_chain_active_step][d] ][seq_step]; seq_prev_vel[d] = seq_vel[ seq_patternchain[seq_chain_active_step][d] ][seq_step];
} }
}
else if (seq_track_type[d] == 2 ) //Chords else if (seq_track_type[d] == 2 ) //Chords
{ {
if (seq_vel[ seq_patternchain[seq_chain_active_step][d]][seq_step] > 199) if (seq_vel[ seq_patternchain[seq_chain_active_step][d]][seq_step] > 199)
@ -69,9 +72,7 @@ void sequencer_part1(void)
if (seq_track_type[d] == 3) { //Arp if (seq_track_type[d] == 3) { //Arp
arp_step = 0; arp_step = 0;
arp_counter = 0; arp_counter = 0;
arp_note = seq_data[ seq_patternchain[seq_chain_active_step][d] ][seq_step] + (seq_oct_shift * 12); arp_note = seq_data[ seq_patternchain[seq_chain_active_step][d] ][seq_step] + (seq_oct_shift * 12);
// if (seq_vel[seq_patternchain[seq_chain_active_step][d] ][seq_step] - 200 >= 0)
arp_chord = seq_vel[seq_patternchain[seq_chain_active_step][d] ][seq_step] - 200; arp_chord = seq_vel[seq_patternchain[seq_chain_active_step][d] ][seq_step] - 200;
} }
} }
@ -164,26 +165,30 @@ void sequencer_part2(void)
{ {
if (seq_noteoffsent[d] == false) { if (seq_noteoffsent[d] == false) {
if ( seq_prev_note[d] > 0 && seq_track_type[d] > 0) if ( seq_prev_note[d] > 0 && seq_track_type[d] > 0)
{
if (seq_data[ seq_patternchain[seq_chain_active_step][d] ][seq_step] != 130)
{ {
handleNoteOff(configuration.dexed[seq_inst_dexed[d]].midi_channel, seq_prev_note[d] , 0); handleNoteOff(configuration.dexed[seq_inst_dexed[d]].midi_channel, seq_prev_note[d] , 0);
seq_noteoffsent[d] = true;
}
if (seq_track_type[d] == 2) { //Chords if (seq_track_type[d] == 2) { //Chords
if ( seq_prev_vel[d] > 199) { if ( seq_prev_vel[d] > 199) {
for (uint8_t x = seq_element_shift; x < seq_element_shift + seq_chord_key_ammount; x++) //play chord notes for (uint8_t x = seq_element_shift; x < seq_element_shift + seq_chord_key_ammount; x++) //play chord notes
{ {
handleNoteOff(configuration.dexed[seq_chord_dexed_inst].midi_channel, seq_prev_note[d] + seq_arps[seq_prev_vel[d] - 200][x], 0); handleNoteOff(configuration.dexed[seq_chord_dexed_inst].midi_channel, seq_prev_note[d] + seq_arps[seq_prev_vel[d] - 200][x], 0);
seq_noteoffsent[d] = true;
} }
} }
} }
else if (seq_track_type[d] == 3) else if (seq_track_type[d] == 3)
{ //Arp { //Arp
handleNoteOff(configuration.dexed[seq_chord_dexed_inst].midi_channel, arp_note_prev, 0); handleNoteOff(configuration.dexed[seq_chord_dexed_inst].midi_channel, arp_note_prev, 0);
seq_noteoffsent[d] = true;
} }
} }
seq_noteoffsent[d] = true;
} }
} }
} }
void sequencer(void) void sequencer(void)
{ // Runs in Interrupt Timer. Switches between the Noteon and Noteoff Task, each cycle { // Runs in Interrupt Timer. Switches between the Noteon and Noteoff Task, each cycle

@ -64,18 +64,18 @@ uint8_t seq_data[10][16] = {72 , 0 , 0 , 0 , 72 , 0 , 0 , 0 , 72 , 0 , 0
78 , 78 , 78 , 78 , 78 , 78 , 78 , 78 , 78 , 78 , 78 , 78 , 78 , 78 , 78 , 78 , 78 , 78 , 78 , 78 , 78 , 78 , 78 , 78 , 78 , 78 , 78 , 78 , 78 , 78 , 78 , 78 ,
72 , 0 , 0 , 0 , 72 , 0 , 0 , 0 , 72 , 0 , 0 , 75 , 72 , 0 , 0 , 0 , 72 , 0 , 0 , 0 , 72 , 0 , 0 , 0 , 72 , 0 , 0 , 75 , 72 , 0 , 0 , 0 ,
60 , 61 , 62 , 63 , 64 , 65 , 66 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 60 , 61 , 62 , 63 , 64 , 65 , 66 , 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 , 77 , 77 , 77 , 77 , 77 , 77 , 77 , 77 , 77 , 77 , 77 , 77 , 77 , 77 , 0 , 0 ,
55 , 0 , 0 , 0 , 0 , 0 , 52 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 55 , 0 , 0 , 0 , 0 , 0 , 52 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 ,
57 , 0 , 0 , 0 , 0 , 0 , 53 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 57 , 0 , 0 , 0 , 0 , 0 , 53 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 ,
74 , 0 , 0 , 72 , 0 , 0 , 74 , 0 , 0 , 0 , 76 , 0 , 0 , 0 , 0 , 0 , 74 , 0 , 0 , 72 , 0 , 0 , 74 , 0 , 0 , 0 , 76 , 130 , 130 , 130 , 130 , 0 ,
74 , 0 , 0 , 72 , 0 , 0 , 71 , 0 , 0 , 0 , 67 , 0 , 0 , 0 , 0 , 0 , 74 , 0 , 0 , 72 , 0 , 0 , 71 , 0 , 0 , 0 , 67 , 130 , 0 , 0 , 0 , 0 ,
69 , 0 , 0 , 76 , 0 , 0 , 69 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 69 , 0 , 0 , 76 , 0 , 0 , 69 , 130 , 130 , 130 , 0 , 0 , 0 , 0 , 0 , 0
}; };
uint8_t seq_vel[10][16] = {120, 0, 0, 0, 120, 0, 0, 0, 120, 0, 0, 0, 120, 0, 0, 0, uint8_t seq_vel[10][16] = {120, 0, 0, 0, 120, 0, 0, 0, 120, 0, 0, 0, 120, 0, 0, 0,
105, 80, 105, 70, 106, 98, 106, 70, 126, 97, 106, 70, 106, 99, 90, 65, 105, 80, 105, 70, 106, 98, 106, 70, 126, 97, 106, 70, 106, 99, 90, 65,
120, 0, 0, 0, 120, 0, 0, 0, 120, 0, 120, 60, 120, 120, 0, 0, 120, 0, 0, 0, 120, 0, 0, 0, 120, 0, 120, 60, 120, 120, 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, 200, 0, 0, 1, 10, 30, 50, 70, 90, 100, 127, 100, 60, 40, 30, 0, 200,
200, 200, 200, 200, 200, 200, 201, 0, 0, 0, 0, 0, 0, 0, 0, 200, 200, 200, 200, 200, 200, 200, 201, 0, 0, 0, 0, 0, 0, 0, 0, 200,
201, 200, 200, 200, 200, 200, 200, 200, 0, 0, 0, 0, 0, 0, 0, 0, 201, 200, 200, 200, 200, 200, 200, 200, 0, 0, 0, 0, 0, 0, 0, 0,
98, 120, 0, 88, 120, 0, 127, 120, 0, 0, 125, 120, 0, 0, 0, 0, 98, 120, 0, 88, 120, 0, 127, 120, 0, 0, 125, 120, 0, 0, 0, 0,
@ -85,7 +85,7 @@ uint8_t seq_vel[10][16] = {120, 0, 0, 0, 120, 0, 0, 0, 120, 0, 0, 0, 120, 0, 0,
uint8_t seq_patternchain[4][4] = { 0 , 1 , 6 , 9 , 0 , 1 , 5 , 8 , 0 , 1 , 6 , 9 , 2 , 1 , 5 , 7 uint8_t seq_patternchain[4][4] = { 0 , 1 , 6 , 9 , 0 , 1 , 5 , 8 , 0 , 1 , 6 , 9 , 2 , 1 , 5 , 7
}; };
uint8_t seq_content_type[10] = { 0, 0, 0, 0 , 1, 1, 1 , 1 , 1 , 1 }; // 0 = track is Drumtrack, 1= Instrumenttrack, 2= Chord or Arpeggio uint8_t seq_content_type[10] = { 0, 0, 0, 0 , 2, 2, 1 , 1 , 1 , 1 }; // 0 = track is Drumtrack, 1= Instrumenttrack, 2= Chord or Arpeggio
uint8_t seq_track_type[4] = { 0, 0, 3, 1 }; // 0 = track is Drumtrack, 1 = Instrumenttrack, 2 = Chord, 3 = Arp uint8_t seq_track_type[4] = { 0, 0, 3, 1 }; // 0 = track is Drumtrack, 1 = Instrumenttrack, 2 = Chord, 3 = Arp
//uint8_t seq_reverb[4][16] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, //uint8_t seq_reverb[4][16] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,

Loading…
Cancel
Save