diff --git a/UI.hpp b/UI.hpp index 8c81137..341957f 100644 --- a/UI.hpp +++ b/UI.hpp @@ -5134,6 +5134,7 @@ void UI_func_seq_pattern_save(uint8_t param) { char tmp[FILENAME_LEN]; yesno = false; + temp_int=0; mode = 0; encoderDir[ENC_R].reset(); lcd.setCursor(0, 0); diff --git a/sequencer.cpp b/sequencer.cpp index b2a4d4d..da84662 100644 --- a/sequencer.cpp +++ b/sequencer.cpp @@ -63,26 +63,61 @@ void sequencer(void) else { if (seq_data[ seq_patternchain[seq_chain_active_step][d] ][seq_step] > 0 && seq_vel[ seq_patternchain[seq_chain_active_step][d] ][seq_step] > 0) // instrument track { - handleNoteOn(configuration.dexed[seq_inst_dexed[d]].midi_channel, seq_data[ seq_patternchain[seq_chain_active_step][d] ][seq_step] + seq_transpose , seq_vel[ seq_patternchain[seq_chain_active_step][d] ][seq_step]); + if (seq_track_type[d] == 1 || seq_track_type[d] == 3 ) + { + handleNoteOn(configuration.dexed[seq_inst_dexed[d]].midi_channel, seq_data[ seq_patternchain[seq_chain_active_step][d] ][seq_step] + seq_transpose , 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_transpose; seq_prev_vel[d] = seq_vel[ seq_patternchain[seq_chain_active_step][d] ][seq_step]; - if (seq_track_type[d] == 2) { + if (seq_track_type[d] == 2) { //Chords if (seq_vel[ seq_patternchain[seq_chain_active_step][d] ][seq_step] > 199) { - handleNoteOn(configuration.dexed[seq_chord_ch].midi_channel, seq_data[ seq_patternchain[seq_chain_active_step][d] ][seq_step] + seq_transpose + seq_chords[seq_vel[ seq_patternchain[seq_chain_active_step][d] ][seq_step] - 200][0], seq_chord_velocity); - handleNoteOn(configuration.dexed[seq_chord_ch].midi_channel, seq_data[ seq_patternchain[seq_chain_active_step][d] ][seq_step] + seq_transpose + seq_chords[seq_vel[ seq_patternchain[seq_chain_active_step][d] ][seq_step] - 200][1], seq_chord_velocity); - handleNoteOn(configuration.dexed[seq_chord_ch].midi_channel, seq_data[ seq_patternchain[seq_chain_active_step][d] ][seq_step] + seq_transpose + seq_chords[seq_vel[ seq_patternchain[seq_chain_active_step][d] ][seq_step] - 200][2], seq_chord_velocity); - handleNoteOn(configuration.dexed[seq_chord_ch].midi_channel, seq_data[ seq_patternchain[seq_chain_active_step][d] ][seq_step] + seq_transpose + seq_chords[seq_vel[ seq_patternchain[seq_chain_active_step][d] ][seq_step] - 200][3], seq_chord_velocity); + handleNoteOn(configuration.dexed[seq_chord_dexed_inst].midi_channel, seq_data[ seq_patternchain[seq_chain_active_step][d] ][seq_step] + seq_transpose + seq_chords[seq_vel[ seq_patternchain[seq_chain_active_step][d] ][seq_step] - 200][0], seq_chord_velocity); + handleNoteOn(configuration.dexed[seq_chord_dexed_inst].midi_channel, seq_data[ seq_patternchain[seq_chain_active_step][d] ][seq_step] + seq_transpose + seq_chords[seq_vel[ seq_patternchain[seq_chain_active_step][d] ][seq_step] - 200][1], seq_chord_velocity); + handleNoteOn(configuration.dexed[seq_chord_dexed_inst].midi_channel, seq_data[ seq_patternchain[seq_chain_active_step][d] ][seq_step] + seq_transpose + seq_chords[seq_vel[ seq_patternchain[seq_chain_active_step][d] ][seq_step] - 200][2], seq_chord_velocity); + handleNoteOn(configuration.dexed[seq_chord_dexed_inst].midi_channel, seq_data[ seq_patternchain[seq_chain_active_step][d] ][seq_step] + seq_transpose + seq_chords[seq_vel[ seq_patternchain[seq_chain_active_step][d] ][seq_step] - 200][3], seq_chord_velocity); } } + + else if (seq_track_type[d] == 3) { //Arp + arp_step = 0; + arp_note = seq_data[ seq_patternchain[seq_chain_active_step][d] ][seq_step] + seq_transpose; + arp_chord = seq_vel[ seq_patternchain[seq_chain_active_step][d] ][seq_step]; + + } + } } + + if (seq_track_type[d] == 3) + { //Arp + if (arp_step == 0 ) { + handleNoteOn(configuration.dexed[seq_chord_dexed_inst].midi_channel, arp_note+ arp_octave * 12 , seq_chord_velocity); + arp_note_prev = arp_note+arp_octave * 12; + + } + else + { + handleNoteOn(configuration.dexed[seq_chord_dexed_inst].midi_channel, arp_note + seq_chords[arp_chord - 200][arp_step - 1] + arp_octave * 12, seq_chord_velocity); + arp_note_prev = arp_note + seq_chords[arp_chord - 200][arp_step - 1] + arp_octave * 12; + + } + } + seq_noteoffsent[d] = false; } seq_step++; + arp_step++; + if (arp_step > 3) { + arp_step = 0; + arp_octave++; + if (arp_octave > 1) arp_octave = 0; + } if (seq_step > 15) { + + seq_step = 0; if (seq_chain_lenght > 0) { seq_chain_active_step++; @@ -100,17 +135,27 @@ void sequencer(void) if ( seq_noteoffsent[d] == false) { if ( seq_prev_note[d] > 0 && seq_track_type[d] > 0) //test instrument sequencer Instance=0 { + handleNoteOff(configuration.dexed[seq_inst_dexed[d]].midi_channel, seq_prev_note[d] , 0); - if (seq_track_type[d] == 2) { + + if (seq_track_type[d] == 2) { //Chords if ( seq_prev_vel[d] > 199) { - handleNoteOff(configuration.dexed[seq_chord_ch].midi_channel, seq_prev_note[d] + seq_chords[seq_prev_vel[d] - 200][0], 0); - handleNoteOff(configuration.dexed[seq_chord_ch].midi_channel, seq_prev_note[d] + seq_chords[seq_prev_vel[d] - 200][1] , 0); - handleNoteOff(configuration.dexed[seq_chord_ch].midi_channel, seq_prev_note[d] + seq_chords[seq_prev_vel[d] - 200][2] , 0); - handleNoteOff(configuration.dexed[seq_chord_ch].midi_channel, seq_prev_note[d] + seq_chords[seq_prev_vel[d] - 200][3] , 0); + handleNoteOff(configuration.dexed[seq_chord_dexed_inst].midi_channel, seq_prev_note[d] + seq_chords[seq_prev_vel[d] - 200][0], 0); + handleNoteOff(configuration.dexed[seq_chord_dexed_inst].midi_channel, seq_prev_note[d] + seq_chords[seq_prev_vel[d] - 200][1] , 0); + handleNoteOff(configuration.dexed[seq_chord_dexed_inst].midi_channel, seq_prev_note[d] + seq_chords[seq_prev_vel[d] - 200][2] , 0); + handleNoteOff(configuration.dexed[seq_chord_dexed_inst].midi_channel, seq_prev_note[d] + seq_chords[seq_prev_vel[d] - 200][3] , 0); } } + + else if (seq_track_type[d] == 3) + { //Arp + + + handleNoteOff(configuration.dexed[seq_chord_dexed_inst].midi_channel, arp_note_prev, 0); + + } } } seq_noteoffsent[d] = true;