Merge pull request 'Dateien hochladen nach „“' (#54) from positionhigh/MicroDexed:dev into dev
Reviewed-on: https://codeberg.org/dcoredump/MicroDexed/pulls/54pull/55/head
commit
d2a5bcb8d1
@ -0,0 +1,101 @@ |
||||
|
||||
#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 (step recording and live recording)
|
||||
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_note_in = 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)); |
||||
} |
||||
} |
||||
if (seq_data[0][seq_step_timer] > 0) |
||||
{ |
||||
handleNoteOn(DRUM_MIDI_CHANNEL, seq_data[0][seq_step_timer] , 99); |
||||
} |
||||
if (seq_data[1][seq_step_timer] > 0) |
||||
{ |
||||
handleNoteOn(DRUM_MIDI_CHANNEL, seq_data[1][seq_step_timer] , 99); |
||||
} |
||||
if (seq_data[2][seq_step_timer] > 0) |
||||
{ |
||||
handleNoteOn(DRUM_MIDI_CHANNEL, seq_data[2][seq_step_timer] , 99); |
||||
} |
||||
if (seq_data[3][seq_step_timer] > 0) //test instrument sequencer Instance=2
|
||||
{ |
||||
handleNoteOn(configuration.dexed[0].midi_channel, seq_data[3][seq_step_timer] + seq_transpose , 99); |
||||
} |
||||
|
||||
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[3][seq_step_timer - 1] > 0) //test instrument sequencer Instance=2
|
||||
{ |
||||
handleNoteOff(configuration.dexed[0].midi_channel, seq_data[3][seq_step_timer - 1] + seq_transpose , 0); |
||||
} |
||||
} else |
||||
{ |
||||
if (seq_step_timer == 0) { |
||||
if (seq_data[3][15] > 0) //test instrument sequencer Instance=2
|
||||
{ |
||||
handleNoteOff(configuration.dexed[0].midi_channel, seq_data[3][15] + seq_transpose , 0); |
||||
; |
||||
} |
||||
|
||||
} |
||||
} |
||||
seq_noteoffsent = true; |
||||
} |
||||
} |
@ -0,0 +1,17 @@ |
||||
|
||||
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; |
||||
int seq_transpose; |
||||
uint8_t seq_data[4][16] = {72, 0, 0, 0, 72, 0, 0, 0, 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, |
||||
}; |
Loading…
Reference in new issue