diff --git a/sequencer.cpp b/sequencer.cpp index 4b5f01f..5952da7 100644 --- a/sequencer.cpp +++ b/sequencer.cpp @@ -8,6 +8,8 @@ extern LCDMenuLib2 LCDML; extern LiquidCrystal_I2C lcd; extern config_t configuration; extern uint8_t drum_midi_channel; +extern uint8_t activesample; +extern uint8_t get_sample_note(uint8_t sample); extern void handleNoteOn(byte , byte , byte ); extern void handleNoteOff(byte , byte , byte ); extern void UI_func_seq_pattern_editor(uint8_t); @@ -18,6 +20,24 @@ extern float get_sample_vol_max(uint8_t); extern float get_sample_p_offset(uint8_t); boolean interrupt_swapper = false; + +void seq_live_recording(void) +{ + //record to sequencer if sequencer menu is active and recording is active + if (seq_note_in > 0 && seq_recording == true && LCDML.FUNC_getID() == LCDML.OTHER_getIDFromFunction(UI_func_seq_pattern_editor)) + { + seq_data[seq_active_track][seq_step] = seq_note_in; + if ( get_sample_note(activesample) > 209 ) // pitched sample + { + seq_vel[seq_active_track][seq_step] = get_sample_note(activesample); + } + else + seq_vel[seq_active_track][seq_step] = seq_note_in_velocity; + + seq_note_in = 0; + seq_note_in_velocity = 0; + } +} void sequencer_part1(void) { //if (seq_note_in > 0 && seq_note_in < 62 && seq_recording == false ) { @@ -29,14 +49,7 @@ void sequencer_part1(void) //seq_note_in = 0; //} - //record to sequencer if sequencer menu is active and recording is active - if (seq_note_in > 0 && seq_recording == true && LCDML.FUNC_getID() == LCDML.OTHER_getIDFromFunction(UI_func_seq_pattern_editor)) { - seq_data[seq_active_track][seq_step] = seq_note_in; - seq_vel[seq_active_track][seq_step] = seq_note_in_velocity; - seq_note_in = 0; - seq_note_in_velocity = 0; - } - + seq_live_recording(); for (uint8_t d = 0; d < NUM_SEQ_TRACKS; d++) { if (seq_patternchain[seq_chain_active_step][d] < NUM_SEQ_PATTERN ) // sequence not empty or muted @@ -175,6 +188,7 @@ void sequencer_part1(void) void sequencer_part2(void) { + seq_live_recording(); for (uint8_t d = 0; d < NUM_SEQ_TRACKS; d++) { if (seq_noteoffsent[d] == false) {