Renaming of "seq.seq_*" to "seq.*" and "lcd.*" to "display.*"

pull/112/head
Holger Wirtz 3 years ago
parent b999e0c72a
commit 257d2a9125
  1. 94
      MicroDexed.ino
  2. 3794
      UI.hpp
  3. 124
      dexed_sd.cpp
  4. 8
      midi_devices.hpp
  5. 142
      sequencer.cpp
  6. 70
      sequencer.h

@ -690,7 +690,7 @@ void setup()
#ifdef USE_SEQUENCER #ifdef USE_SEQUENCER
// Start timer (to avoid a crash when loading the performance data) // Start timer (to avoid a crash when loading the performance data)
sequencer_timer.begin(sequencer, seq.seq_tempo_ms / 2, false); sequencer_timer.begin(sequencer, seq.tempo_ms / 2, false);
#endif #endif
// Load initial Performance or the last used one // Load initial Performance or the last used one
@ -780,7 +780,7 @@ void setup()
//ep_modchorus.set_bypass(true); //ep_modchorus.set_bypass(true);
strcpy(seq.seq_name, "INIT Perf"); strcpy(seq.name, "INIT Perf");
LCDML.OTHER_jumpToFunc(UI_func_voice_select); LCDML.OTHER_jumpToFunc(UI_func_voice_select);
} }
@ -797,34 +797,34 @@ void loop()
LCDML.loop(); LCDML.loop();
#endif #endif
if (seq.seq_running) if (seq.running)
{ {
if (seq.seq_step != seq_UI_last_step) if (seq.step != seq_UI_last_step)
{ {
seq_UI_last_step = seq.seq_step; seq_UI_last_step = seq.step;
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.seq_step, 1); display.setCursor(seq.step, 1);
lcd.write(124); display.write(124);
if (seq.seq_step == 0) if (seq.step == 0)
{ {
lcd.setCursor(15, 1); display.setCursor(15, 1);
lcd.print(seq_find_shortname(15)[0]); display.print(seq_find_shortname(15)[0]);
} }
else else
{ {
lcd.setCursor(seq.seq_step - 1, 1); display.setCursor(seq.step - 1, 1);
lcd.print(seq_find_shortname(seq.seq_step - 1)[0]); display.print(seq_find_shortname(seq.step - 1)[0]);
} }
} }
else if (LCDML.FUNC_getID() == LCDML.OTHER_getIDFromFunction(UI_func_arpeggio)) //is in UI of Arpeggiator else if (LCDML.FUNC_getID() == LCDML.OTHER_getIDFromFunction(UI_func_arpeggio)) //is in UI of Arpeggiator
{ {
lcd.setCursor(7, 0); display.setCursor(7, 0);
lcd.print( seq.seq_chord_names[seq.arp_chord][0]); display.print( seq.chord_names[seq.arp_chord][0]);
lcd.print( seq.seq_chord_names[seq.arp_chord][1]); display.print( seq.chord_names[seq.arp_chord][1]);
lcd.print( seq.seq_chord_names[seq.arp_chord][2]); display.print( seq.chord_names[seq.arp_chord][2]);
lcd.print( seq.seq_chord_names[seq.arp_chord][3]); display.print( seq.chord_names[seq.arp_chord][3]);
} }
} }
} }
@ -850,29 +850,29 @@ void loop()
if (midi_decay_timer > MIDI_DECAY_TIMER && midi_decay[instance_id] > 0) if (midi_decay_timer > MIDI_DECAY_TIMER && midi_decay[instance_id] > 0)
{ {
midi_decay[instance_id]--; midi_decay[instance_id]--;
lcd.createChar(6 + instance_id, (uint8_t*)special_chars[15 - (7 - midi_decay[instance_id])]); display.createChar(6 + instance_id, (uint8_t*)special_chars[15 - (7 - midi_decay[instance_id])]);
lcd.setCursor(14 + instance_id, 1); display.setCursor(14 + instance_id, 1);
lcd.write(6 + instance_id); display.write(6 + instance_id);
} }
else if (midi_voices[instance_id] == 0 && midi_decay[instance_id] == 0 && !MicroDexed[instance_id]->getSustain()) else if (midi_voices[instance_id] == 0 && midi_decay[instance_id] == 0 && !MicroDexed[instance_id]->getSustain())
{ {
midi_decay[instance_id]--; midi_decay[instance_id]--;
lcd.setCursor(14 + instance_id, 1); display.setCursor(14 + instance_id, 1);
lcd.write(20); // blank display.write(20); // blank
} }
#else #else
static bool midi_playing[NUM_DEXED]; static bool midi_playing[NUM_DEXED];
if (midi_voices[instance_id] > 0 && midi_playing[instance_id] == false) if (midi_voices[instance_id] > 0 && midi_playing[instance_id] == false)
{ {
midi_playing[instance_id] = true; midi_playing[instance_id] = true;
lcd.setCursor(14 + instance_id, 1); display.setCursor(14 + instance_id, 1);
lcd.write(6 + instance_id); display.write(6 + instance_id);
} }
else if (midi_voices[instance_id] == 0 && !MicroDexed[instance_id]->getSustain()) else if (midi_voices[instance_id] == 0 && !MicroDexed[instance_id]->getSustain())
{ {
midi_playing[instance_id] = false; midi_playing[instance_id] = false;
lcd.setCursor(14 + instance_id, 1); display.setCursor(14 + instance_id, 1);
lcd.write(20); // blank display.write(20); // blank
} }
#endif #endif
} }
@ -954,7 +954,7 @@ void handleNoteOn(byte inChannel, byte inNumber, byte inVelocity)
// Drum Sampler // Drum Sampler
// //
#if NUM_DRUMS > 0 #if NUM_DRUMS > 0
if (activesample < 6 && seq.seq_running == false && LCDML.FUNC_getID() == LCDML.OTHER_getIDFromFunction(UI_func_seq_pattern_editor) ) // live play pitched sample if (activesample < 6 && seq.running == false && LCDML.FUNC_getID() == LCDML.OTHER_getIDFromFunction(UI_func_seq_pattern_editor) ) // live play pitched sample
{ {
if (drum_counter >= NUM_DRUMS) if (drum_counter >= NUM_DRUMS)
drum_counter = 0; drum_counter = 0;
@ -976,7 +976,7 @@ void handleNoteOn(byte inChannel, byte inNumber, byte inVelocity)
else else
#endif #endif
//Ignore the note when playing & recording the same note into the sequencer //Ignore the note when playing & recording the same note into the sequencer
if (seq.seq_recording == false || (seq.seq_recording && inNumber != seq.seq_note_in )) if (seq.recording == false || (seq.recording && inNumber != seq.note_in ))
{ {
// Check for MicroDexed // Check for MicroDexed
for (uint8_t instance_id = 0; instance_id < NUM_DEXED; instance_id++) for (uint8_t instance_id = 0; instance_id < NUM_DEXED; instance_id++)
@ -1761,8 +1761,8 @@ void handleSystemExclusive(byte * sysex, uint len)
#ifdef DEBUG #ifdef DEBUG
Serial.println(F("E: Not a SysEx bank bulk upload.")); Serial.println(F("E: Not a SysEx bank bulk upload."));
#endif #endif
lcd.setCursor(0, 1); display.setCursor(0, 1);
lcd.print(F("Error (TYPE) ")); display.print(F("Error (TYPE) "));
delay(MESSAGE_WAIT_TIME); delay(MESSAGE_WAIT_TIME);
LCDML.FUNC_goBackToMenu(); LCDML.FUNC_goBackToMenu();
return; return;
@ -1777,8 +1777,8 @@ void handleSystemExclusive(byte * sysex, uint len)
#ifdef DEBUG #ifdef DEBUG
Serial.println(F("E: Wrong length for SysEx bank bulk upload (not 4096).")); Serial.println(F("E: Wrong length for SysEx bank bulk upload (not 4096)."));
#endif #endif
lcd.setCursor(0, 1); display.setCursor(0, 1);
lcd.print(F("Error (SIZE) ")); display.print(F("Error (SIZE) "));
delay(MESSAGE_WAIT_TIME); delay(MESSAGE_WAIT_TIME);
LCDML.FUNC_goBackToMenu(); LCDML.FUNC_goBackToMenu();
return; return;
@ -1804,8 +1804,8 @@ void handleSystemExclusive(byte * sysex, uint len)
Serial.print(bulk_checksum_calc, HEX); Serial.print(bulk_checksum_calc, HEX);
Serial.println(F("]")); Serial.println(F("]"));
#endif #endif
lcd.setCursor(0, 1); display.setCursor(0, 1);
lcd.print(F("Error (CHECKSUM)")); display.print(F("Error (CHECKSUM)"));
delay(MESSAGE_WAIT_TIME); delay(MESSAGE_WAIT_TIME);
LCDML.FUNC_goBackToMenu(); LCDML.FUNC_goBackToMenu();
return; return;
@ -1822,8 +1822,8 @@ void handleSystemExclusive(byte * sysex, uint len)
Serial.print(receive_bank_filename); Serial.print(receive_bank_filename);
Serial.println(F("]")); Serial.println(F("]"));
#endif #endif
lcd.setCursor(0, 1); display.setCursor(0, 1);
lcd.print(F("Done. ")); display.print(F("Done. "));
delay(MESSAGE_WAIT_TIME); delay(MESSAGE_WAIT_TIME);
LCDML.FUNC_goBackToMenu(); LCDML.FUNC_goBackToMenu();
} }
@ -1834,8 +1834,8 @@ void handleSystemExclusive(byte * sysex, uint len)
Serial.print(receive_bank_filename); Serial.print(receive_bank_filename);
Serial.println(F("]")); Serial.println(F("]"));
#endif #endif
lcd.setCursor(0, 1); display.setCursor(0, 1);
lcd.print(F("Error. ")); display.print(F("Error. "));
delay(MESSAGE_WAIT_TIME); delay(MESSAGE_WAIT_TIME);
LCDML.FUNC_goBackToMenu(); LCDML.FUNC_goBackToMenu();
} }
@ -1946,9 +1946,9 @@ void handleStart(void)
midi_bpm_timer = 0; midi_bpm_timer = 0;
midi_bpm_counter = 0; midi_bpm_counter = 0;
_midi_bpm = -1; _midi_bpm = -1;
seq.seq_step = 0; seq.step = 0;
seq.seq_chain_active_step = 0; seq.chain_active_step = 0;
seq.seq_running = true; seq.running = true;
#ifdef USE_SEQUENCER #ifdef USE_SEQUENCER
sequencer_timer.start(); sequencer_timer.start();
#endif #endif
@ -1965,11 +1965,11 @@ void handleStop(void)
#ifdef USE_SEQUENCER #ifdef USE_SEQUENCER
sequencer_timer.stop(); sequencer_timer.stop();
#endif #endif
seq.seq_running = false; seq.running = false;
seq.seq_recording = false; seq.recording = false;
seq.seq_note_in = 0; seq.note_in = 0;
seq.seq_step = 0; seq.step = 0;
seq.seq_chain_active_step = 0; seq.chain_active_step = 0;
MicroDexed[0]->panic(); MicroDexed[0]->panic();
#if NUM_DEXED > 1 #if NUM_DEXED > 1
@ -2522,7 +2522,7 @@ void set_fx_params(void)
delay_fx[instance_id]->delay(0, constrain(configuration.fx.delay_time[instance_id], DELAY_TIME_MIN, DELAY_TIME_MAX) * 10); delay_fx[instance_id]->delay(0, constrain(configuration.fx.delay_time[instance_id], DELAY_TIME_MIN, DELAY_TIME_MAX) * 10);
if (configuration.fx.delay_sync[instance_id] > 0) if (configuration.fx.delay_sync[instance_id] > 0)
{ {
uint16_t midi_sync_delay_time = uint16_t(60000.0 * midi_ticks_factor[configuration.fx.delay_sync[instance_id]] / seq.seq_bpm); uint16_t midi_sync_delay_time = uint16_t(60000.0 * midi_ticks_factor[configuration.fx.delay_sync[instance_id]] / seq.bpm);
delay_fx[instance_id]->delay(0, constrain(midi_sync_delay_time, DELAY_TIME_MIN, DELAY_TIME_MAX * 10)); delay_fx[instance_id]->delay(0, constrain(midi_sync_delay_time, DELAY_TIME_MIN, DELAY_TIME_MAX * 10));
} }

3794
UI.hpp

File diff suppressed because it is too large Load Diff

@ -1250,8 +1250,8 @@ bool save_sd_seq_sub_vel_json(uint8_t number)
Serial.print(F(" to ")); Serial.print(F(" to "));
Serial.println(filename); Serial.println(filename);
#endif #endif
int total = sizeof(seq.seq_vel); int total = sizeof(seq.vel);
int columns = sizeof(seq.seq_vel[0]); int columns = sizeof(seq.vel[0]);
int rows = total / columns; int rows = total / columns;
AudioNoInterrupts(); AudioNoInterrupts();
SD.begin(); SD.begin();
@ -1262,7 +1262,7 @@ bool save_sd_seq_sub_vel_json(uint8_t number)
for (uint8_t i = 0; i < rows; i++) for (uint8_t i = 0; i < rows; i++)
{ {
for (uint8_t j = 0; j < columns; j++) { for (uint8_t j = 0; j < columns; j++) {
data_json["seq_velocity"][count] = seq.seq_vel[i][j]; data_json["seq_velocity"][count] = seq.vel[i][j];
count++; count++;
} }
} }
@ -1307,8 +1307,8 @@ bool save_sd_seq_sub_patterns_json(uint8_t number)
Serial.print(F(" to ")); Serial.print(F(" to "));
Serial.println(filename); Serial.println(filename);
#endif #endif
int total = sizeof(seq.seq_data); int total = sizeof(seq.data);
int columns = sizeof(seq.seq_data[0]); int columns = sizeof(seq.data[0]);
int rows = total / columns; int rows = total / columns;
AudioNoInterrupts(); AudioNoInterrupts();
SD.begin(); SD.begin();
@ -1319,7 +1319,7 @@ bool save_sd_seq_sub_patterns_json(uint8_t number)
for (uint8_t i = 0; i < rows; i++) for (uint8_t i = 0; i < rows; i++)
{ {
for (uint8_t j = 0; j < columns; j++) { for (uint8_t j = 0; j < columns; j++) {
data_json["seq_data"][count] = seq.seq_data[i][j]; data_json["seq_data"][count] = seq.data[i][j];
count++; count++;
} }
} }
@ -1354,7 +1354,7 @@ bool save_sd_performance_json(uint8_t number)
bool seq_was_running = false; bool seq_was_running = false;
number = constrain(number, PERFORMANCE_NUM_MIN, PERFORMANCE_NUM_MAX); number = constrain(number, PERFORMANCE_NUM_MIN, PERFORMANCE_NUM_MAX);
if (seq.seq_running == true ) { if (seq.running == true ) {
seq_was_running = true; seq_was_running = true;
handleStop(); handleStop();
} }
@ -1394,8 +1394,8 @@ bool save_sd_performance_json(uint8_t number)
Serial.print(F(" to ")); Serial.print(F(" to "));
Serial.println(filename); Serial.println(filename);
#endif #endif
int total = sizeof(seq.seq_patternchain); int total = sizeof(seq.patternchain);
int columns = sizeof(seq.seq_patternchain[0]); int columns = sizeof(seq.patternchain[0]);
int rows = total / columns; int rows = total / columns;
Serial.print(F(" ")); Serial.print(F(" "));
SD.remove(filename); SD.remove(filename);
@ -1411,35 +1411,35 @@ bool save_sd_performance_json(uint8_t number)
for (uint8_t i = 0; i < rows; i++) for (uint8_t i = 0; i < rows; i++)
{ {
for (uint8_t j = 0; j < columns; j++) { for (uint8_t j = 0; j < columns; j++) {
data_json["seq_patternchain"][count] = seq.seq_patternchain[i][j]; data_json["seq_patternchain"][count] = seq.patternchain[i][j];
count++; count++;
} }
} }
count = 0; count = 0;
data_json["seq_tempo_ms"] = seq.seq_tempo_ms ; data_json["seq_tempo_ms"] = seq.tempo_ms ;
data_json["seq_bpm"] = seq.seq_bpm; data_json["seq_bpm"] = seq.bpm;
data_json["arp_play_basenote"] = seq.arp_play_basenote; data_json["arp_play_basenote"] = seq.arp_play_basenote;
data_json["arp_speed"] = seq.arp_speed; data_json["arp_speed"] = seq.arp_speed;
data_json["arp_lenght"] = seq.arp_lenght; data_json["arp_lenght"] = seq.arp_lenght;
data_json["arp_style"] = seq.arp_style; data_json["arp_style"] = seq.arp_style;
data_json["seq_chord_velocity"] = seq.seq_chord_velocity; data_json["seq_chord_velocity"] = seq.chord_velocity;
data_json["seq_chord_dexed_inst"] = seq.seq_chord_dexed_inst; data_json["seq_chord_dexed_inst"] = seq.chord_dexed_inst;
data_json["seq_chain_lenght"] = seq.seq_chain_lenght; data_json["seq_chain_lenght"] = seq.chain_lenght;
data_json["seq_transpose"] = seq.seq_transpose; data_json["seq_transpose"] = seq.transpose;
data_json["chord_key_ammount"] = seq.seq_chord_key_ammount; data_json["chord_key_ammount"] = seq.chord_key_ammount;
data_json["seq_oct_shift"] = seq.seq_oct_shift; data_json["seq_oct_shift"] = seq.oct_shift;
data_json["seq_element_shift"] = seq.seq_element_shift; data_json["seq_element_shift"] = seq.element_shift;
for (uint8_t i = 0; i < sizeof(seq.seq_track_type); i++) { for (uint8_t i = 0; i < sizeof(seq.track_type); i++) {
data_json["track_type"][i] = seq.seq_track_type[i]; data_json["track_type"][i] = seq.track_type[i];
} }
for (uint8_t i = 0; i < sizeof(seq.seq_content_type); i++) { for (uint8_t i = 0; i < sizeof(seq.content_type); i++) {
data_json["content_type"][i] = seq.seq_content_type[i]; data_json["content_type"][i] = seq.content_type[i];
} }
for (uint8_t i = 0; i < sizeof(seq.seq_inst_dexed); i++) { for (uint8_t i = 0; i < sizeof(seq.inst_dexed); i++) {
data_json["seq_inst_dexed"][i] = seq.seq_inst_dexed[i]; data_json["seq_inst_dexed"][i] = seq.inst_dexed[i];
} }
for (uint8_t i = 0; i < FILENAME_LEN; i++) { for (uint8_t i = 0; i < FILENAME_LEN; i++) {
data_json["seq_name"][i] = seq.seq_name[i]; data_json["seq_name"][i] = seq.name[i];
} }
#if defined(DEBUG) && defined(DEBUG_SHOW_JSON) #if defined(DEBUG) && defined(DEBUG_SHOW_JSON)
@ -1513,7 +1513,7 @@ bool check_performance_directory(uint8_t number)
void get_sd_performance_name_json(uint8_t number) void get_sd_performance_name_json(uint8_t number)
{ {
number = constrain(number, PERFORMANCE_NUM_MIN, PERFORMANCE_NUM_MAX); number = constrain(number, PERFORMANCE_NUM_MIN, PERFORMANCE_NUM_MAX);
memset(seq.seq_name_temp, 0, FILENAME_LEN); memset(seq.name_temp, 0, FILENAME_LEN);
if (sd_card > 0) if (sd_card > 0)
{ {
File json; File json;
@ -1538,13 +1538,13 @@ void get_sd_performance_name_json(uint8_t number)
} }
if (data_json["seq_name"][0] != 0) { if (data_json["seq_name"][0] != 0) {
for (uint8_t i = 0; i < FILENAME_LEN; i++) { for (uint8_t i = 0; i < FILENAME_LEN; i++) {
seq.seq_name_temp[i] = data_json["seq_name"][i]; seq.name_temp[i] = data_json["seq_name"][i];
} }
#ifdef DEBUG #ifdef DEBUG
Serial.print(F("Get performance name for ")); Serial.print(F("Get performance name for "));
Serial.print(number); Serial.print(number);
Serial.print(F(": ")); Serial.print(F(": "));
Serial.print(seq.seq_name_temp); Serial.print(seq.name_temp);
Serial.println(); Serial.println();
#endif #endif
} }
@ -1596,14 +1596,14 @@ bool load_sd_seq_sub_vel_json(uint8_t number)
serializeJsonPretty(data_json, Serial); serializeJsonPretty(data_json, Serial);
Serial.println(); Serial.println();
#endif #endif
int total = sizeof(seq.seq_vel); int total = sizeof(seq.vel);
int columns = sizeof(seq.seq_vel[0]); int columns = sizeof(seq.vel[0]);
int rows = total / columns; int rows = total / columns;
int count = 0; int count = 0;
for (uint8_t i = 0; i < rows; i++) for (uint8_t i = 0; i < rows; i++)
{ {
for (uint8_t j = 0; j < columns; j++) { for (uint8_t j = 0; j < columns; j++) {
seq.seq_vel[i][j] = data_json["seq_velocity"][count]; seq.vel[i][j] = data_json["seq_velocity"][count];
count++; count++;
} }
} }
@ -1665,15 +1665,15 @@ bool load_sd_seq_sub_patterns_json(uint8_t number)
serializeJsonPretty(data_json, Serial); serializeJsonPretty(data_json, Serial);
Serial.println(); Serial.println();
#endif #endif
int total = sizeof(seq.seq_data); int total = sizeof(seq.data);
int columns = sizeof(seq.seq_data[0]); int columns = sizeof(seq.data[0]);
int rows = total / columns; int rows = total / columns;
int count = 0; int count = 0;
for (uint8_t i = 0; i < rows; i++) for (uint8_t i = 0; i < rows; i++)
{ {
for (uint8_t j = 0; j < columns; j++) { for (uint8_t j = 0; j < columns; j++) {
seq.seq_data[i][j] = data_json["seq_data"][count]; seq.data[i][j] = data_json["seq_data"][count];
count++; count++;
} }
} }
@ -1703,10 +1703,10 @@ bool load_sd_performance_json(uint8_t number)
#ifdef USE_SEQUENCER #ifdef USE_SEQUENCER
bool seq_was_running = false; bool seq_was_running = false;
if (seq.seq_running) if (seq.running)
{ {
seq_was_running = true; seq_was_running = true;
seq.seq_running = false; seq.running = false;
} }
#endif #endif
@ -1747,52 +1747,52 @@ bool load_sd_performance_json(uint8_t number)
serializeJsonPretty(data_json, Serial); serializeJsonPretty(data_json, Serial);
Serial.println(); Serial.println();
#endif #endif
int total = sizeof(seq.seq_patternchain); int total = sizeof(seq.patternchain);
int columns = sizeof(seq.seq_patternchain[0]); int columns = sizeof(seq.patternchain[0]);
int rows = total / columns; int rows = total / columns;
int count = 0; int count = 0;
for (uint8_t i = 0; i < rows; i++) for (uint8_t i = 0; i < rows; i++)
{ {
for (uint8_t j = 0; j < columns; j++) for (uint8_t j = 0; j < columns; j++)
{ {
seq.seq_patternchain[i][j] = data_json["seq_patternchain"][count]; seq.patternchain[i][j] = data_json["seq_patternchain"][count];
count++; count++;
} }
} }
for (uint8_t i = 0; i < sizeof(seq.seq_track_type); i++) for (uint8_t i = 0; i < sizeof(seq.track_type); i++)
{ {
seq.seq_track_type[i] = data_json["track_type"][i]; seq.track_type[i] = data_json["track_type"][i];
} }
for (uint8_t i = 0; i < sizeof(seq.seq_content_type); i++) for (uint8_t i = 0; i < sizeof(seq.content_type); i++)
{ {
seq.seq_content_type[i] = data_json["content_type"][i]; seq.content_type[i] = data_json["content_type"][i];
} }
for (uint8_t i = 0; i < sizeof(seq.seq_inst_dexed); i++) for (uint8_t i = 0; i < sizeof(seq.inst_dexed); i++)
{ {
seq.seq_inst_dexed[i] = data_json["seq_inst_dexed"][i]; seq.inst_dexed[i] = data_json["seq_inst_dexed"][i];
} }
if (data_json["seq_name"][0] != 0) if (data_json["seq_name"][0] != 0)
{ {
for (uint8_t i = 0; i < FILENAME_LEN; i++) for (uint8_t i = 0; i < FILENAME_LEN; i++)
{ {
seq.seq_name[i] = data_json["seq_name"][i]; seq.name[i] = data_json["seq_name"][i];
} }
} }
count = 0; count = 0;
seq.seq_tempo_ms = data_json["seq_tempo_ms"] ; seq.tempo_ms = data_json["seq_tempo_ms"] ;
seq.seq_bpm = data_json["seq_bpm"]; seq.bpm = data_json["seq_bpm"];
seq.arp_play_basenote = data_json["arp_play_basenote"]; seq.arp_play_basenote = data_json["arp_play_basenote"];
seq.arp_speed = data_json["arp_speed"] ; seq.arp_speed = data_json["arp_speed"] ;
seq.arp_lenght = data_json["arp_lenght"]; seq.arp_lenght = data_json["arp_lenght"];
seq.arp_style = data_json["arp_style"]; seq.arp_style = data_json["arp_style"];
seq.seq_chord_velocity = data_json["seq_chord_velocity"]; seq.chord_velocity = data_json["seq_chord_velocity"];
seq.seq_chord_dexed_inst = data_json["seq_chord_dexed_inst"] ; seq.chord_dexed_inst = data_json["seq_chord_dexed_inst"] ;
seq.seq_chain_lenght = data_json["seq_chain_lenght"]; seq.chain_lenght = data_json["seq_chain_lenght"];
seq.seq_transpose = data_json["seq_transpose"]; seq.transpose = data_json["seq_transpose"];
seq.seq_chord_key_ammount = data_json["chord_key_ammount"]; seq.chord_key_ammount = data_json["chord_key_ammount"];
seq.seq_oct_shift = data_json["seq_oct_shift"]; seq.oct_shift = data_json["seq_oct_shift"];
seq.seq_element_shift = data_json["seq_element_shift"]; seq.element_shift = data_json["seq_element_shift"];
for (uint8_t instance_id = 0; instance_id < NUM_DEXED; instance_id++) for (uint8_t instance_id = 0; instance_id < NUM_DEXED; instance_id++)
{ {
#ifdef DEBUG #ifdef DEBUG
@ -1811,18 +1811,18 @@ bool load_sd_performance_json(uint8_t number)
set_fx_params();*/ set_fx_params();*/
dac_unmute(); dac_unmute();
seq.seq_step = 0; seq.step = 0;
seq.seq_chain_active_step = 0; seq.chain_active_step = 0;
#ifdef USE_SEQUENCER #ifdef USE_SEQUENCER
if (seq_was_running) if (seq_was_running)
{ {
sequencer_timer.begin(sequencer, seq.seq_tempo_ms / 2); sequencer_timer.begin(sequencer, seq.tempo_ms / 2);
seq.seq_running = true; seq.running = true;
} }
else else
sequencer_timer.begin(sequencer, seq.seq_tempo_ms / 2, false); sequencer_timer.begin(sequencer, seq.tempo_ms / 2, false);
#else #else
seq.seq_running = false; seq.running = false;
#endif #endif
return (true); return (true);
} }

@ -84,8 +84,8 @@ void MD_sendControlChange(uint8_t channel, uint8_t cc, uint8_t value);
#ifdef MIDI_DEVICE_DIN #ifdef MIDI_DEVICE_DIN
void handleNoteOn_MIDI_DEVICE_DIN(byte inChannel, byte inNumber, byte inVelocity) void handleNoteOn_MIDI_DEVICE_DIN(byte inChannel, byte inNumber, byte inVelocity)
{ {
seq.seq_note_in=inNumber; seq.note_in=inNumber;
seq.seq_note_in_velocity=inVelocity; seq.note_in_velocity=inVelocity;
handleNoteOn(inChannel, inNumber, inVelocity); handleNoteOn(inChannel, inNumber, inVelocity);
#ifdef DEBUG #ifdef DEBUG
Serial.print(F("[MIDI_DIN] NoteOn")); Serial.print(F("[MIDI_DIN] NoteOn"));
@ -585,8 +585,8 @@ void handleSystemReset_MIDI_DEVICE_DIN(void)
#ifdef MIDI_DEVICE_USB_HOST #ifdef MIDI_DEVICE_USB_HOST
void handleNoteOn_MIDI_DEVICE_USB_HOST(byte inChannel, byte inNumber, byte inVelocity) void handleNoteOn_MIDI_DEVICE_USB_HOST(byte inChannel, byte inNumber, byte inVelocity)
{ {
seq.seq_note_in=inNumber; seq.note_in=inNumber;
seq.seq_note_in_velocity=inVelocity; seq.note_in_velocity=inVelocity;
handleNoteOn(inChannel, inNumber, inVelocity); handleNoteOn(inChannel, inNumber, inVelocity);
#ifdef DEBUG #ifdef DEBUG
Serial.print(F("[MIDI_USB_HOST] NoteOn")); Serial.print(F("[MIDI_USB_HOST] NoteOn"));

@ -28,7 +28,7 @@
#include <LiquidCrystal_I2C.h> #include <LiquidCrystal_I2C.h>
extern LCDMenuLib2 LCDML; extern LCDMenuLib2 LCDML;
extern LiquidCrystal_I2C lcd; //extern LiquidCrystal_I2C lcd;
extern config_t configuration; extern config_t configuration;
extern uint8_t drum_midi_channel; extern uint8_t drum_midi_channel;
extern uint8_t activesample; extern uint8_t activesample;
@ -48,122 +48,122 @@ sequencer_t seq;
void seq_live_recording(void) void seq_live_recording(void)
{ {
//record to sequencer if sequencer menu is active and recording is active //record to sequencer if sequencer menu is active and recording is active
if (seq.seq_note_in > 0 && seq.seq_recording == true && LCDML.FUNC_getID() == LCDML.OTHER_getIDFromFunction(UI_func_seq_pattern_editor)) if (seq.note_in > 0 && seq.recording == true && LCDML.FUNC_getID() == LCDML.OTHER_getIDFromFunction(UI_func_seq_pattern_editor))
{ {
seq.seq_data[seq.seq_active_track][seq.seq_step] = seq.seq_note_in; seq.data[seq.active_track][seq.step] = seq.note_in;
if ( get_sample_note(activesample) > 209 ) // pitched sample if ( get_sample_note(activesample) > 209 ) // pitched sample
{ {
seq.seq_vel[seq.seq_active_track][seq.seq_step] = get_sample_note(activesample); seq.vel[seq.active_track][seq.step] = get_sample_note(activesample);
} }
else else
seq.seq_vel[seq.seq_active_track][seq.seq_step] = seq.seq_note_in_velocity; seq.vel[seq.active_track][seq.step] = seq.note_in_velocity;
seq.seq_note_in = 0; seq.note_in = 0;
seq.seq_note_in_velocity = 0; seq.note_in_velocity = 0;
} }
} }
void sequencer_part1(void) void sequencer_part1(void)
{ {
//if (seq.seq_note_in > 0 && seq.seq_note_in < 62 && seq.seq_recording == false ) { //if (seq.note_in > 0 && seq.note_in < 62 && seq.recording == false ) {
//handleNoteOff(configuration.dexed[0].midi_channel, seq.seq_data[3][seq.seq_step] + seq.seq_transpose , 0); //handleNoteOff(configuration.dexed[0].midi_channel, seq.data[3][seq.step] + seq.transpose , 0);
//handleNoteOff(configuration.dexed[0].midi_channel, seq.seq_data[3][seq.seq_step - 1] + seq.seq_transpose , 0); //handleNoteOff(configuration.dexed[0].midi_channel, seq.data[3][seq.step - 1] + seq.transpose , 0);
//if (seq.seq_note_in>65)seq.seq_note_in=seq.seq_note_in-12; //if (seq.note_in>65)seq.note_in=seq.note_in-12;
//seq.seq_transpose = seq.seq_note_in % 12 ; //seq.transpose = seq.note_in % 12 ;
//seq.seq_transpose=seq.seq_transpose-12; //seq.transpose=seq.transpose-12;
//seq.seq_note_in = 0; //seq.note_in = 0;
//} //}
seq_live_recording(); seq_live_recording();
for (uint8_t d = 0; d < NUM_SEQ_TRACKS; d++) for (uint8_t d = 0; d < NUM_SEQ_TRACKS; d++)
{ {
if (seq.seq_patternchain[seq.seq_chain_active_step][d] < NUM_SEQ_PATTERN ) // sequence not empty or muted if (seq.patternchain[seq.chain_active_step][d] < NUM_SEQ_PATTERN ) // sequence not empty or muted
{ {
if ( seq.seq_track_type[d] == 0) if ( seq.track_type[d] == 0)
{ // drum track (drum samples and pitched one-shot samples) { // drum track (drum samples and pitched one-shot samples)
if (seq.seq_data[ seq.seq_patternchain[seq.seq_chain_active_step][d] ][seq.seq_step] > 0 ) if (seq.data[ seq.patternchain[seq.chain_active_step][d] ][seq.step] > 0 )
{ {
if (seq.seq_vel[ seq.seq_patternchain[seq.seq_chain_active_step][d] ][seq.seq_step] > 209) // it is a pitched sample if (seq.vel[ seq.patternchain[seq.chain_active_step][d] ][seq.step] > 209) // it is a pitched sample
{ {
// Drum[slot]->setPlaybackRate( pow (2, (inNote - 72) / 12.00) * drum_config[sample].pitch ); get_sample_vol_max(sample) // Drum[slot]->setPlaybackRate( pow (2, (inNote - 72) / 12.00) * drum_config[sample].pitch ); get_sample_vol_max(sample)
set_sample_pitch(seq.seq_vel[ seq.seq_patternchain[seq.seq_chain_active_step][d] ][seq.seq_step] - 210 , (float)pow (2, (seq.seq_data[ seq.seq_patternchain[seq.seq_chain_active_step][d] ][seq.seq_step] - 72) / 12.00) * get_sample_p_offset( seq.seq_vel[ seq.seq_patternchain[seq.seq_chain_active_step][d] ][seq.seq_step] - 210 ) ); set_sample_pitch(seq.vel[ seq.patternchain[seq.chain_active_step][d] ][seq.step] - 210 , (float)pow (2, (seq.data[ seq.patternchain[seq.chain_active_step][d] ][seq.step] - 72) / 12.00) * get_sample_p_offset( seq.vel[ seq.patternchain[seq.chain_active_step][d] ][seq.step] - 210 ) );
handleNoteOn(drum_midi_channel, seq.seq_vel[ seq.seq_patternchain[seq.seq_chain_active_step][d] ][seq.seq_step] , 90 ); handleNoteOn(drum_midi_channel, seq.vel[ seq.patternchain[seq.chain_active_step][d] ][seq.step] , 90 );
} }
else // else play normal drum sample else // else play normal drum sample
handleNoteOn(drum_midi_channel, seq.seq_data[ seq.seq_patternchain[seq.seq_chain_active_step][d] ][seq.seq_step] , seq.seq_vel[ seq.seq_patternchain[seq.seq_chain_active_step][d] ][seq.seq_step]); handleNoteOn(drum_midi_channel, seq.data[ seq.patternchain[seq.chain_active_step][d] ][seq.step] , seq.vel[ seq.patternchain[seq.chain_active_step][d] ][seq.step]);
} }
} }
else { else {
if (seq.seq_data[seq.seq_patternchain[seq.seq_chain_active_step][d]][seq.seq_step] > 0 ) // instrument track if (seq.data[seq.patternchain[seq.chain_active_step][d]][seq.step] > 0 ) // instrument track
{ {
if (seq.seq_track_type[d] == 1 || (seq.seq_track_type[d] == 3 && seq.arp_play_basenote) ) if (seq.track_type[d] == 1 || (seq.track_type[d] == 3 && seq.arp_play_basenote) )
{ {
if (seq.seq_data[seq.seq_patternchain[seq.seq_chain_active_step][d]][seq.seq_step] != 130 ) if (seq.data[seq.patternchain[seq.chain_active_step][d]][seq.step] != 130 )
{ {
handleNoteOn(configuration.dexed[seq.seq_inst_dexed[d]].midi_channel, seq.seq_data[ seq.seq_patternchain[seq.seq_chain_active_step][d] ][seq.seq_step], seq.seq_vel[ seq.seq_patternchain[seq.seq_chain_active_step][d] ][seq.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.seq_prev_note[d] = seq.seq_data[ seq.seq_patternchain[seq.seq_chain_active_step][d] ][seq.seq_step]; seq.prev_note[d] = seq.data[ seq.patternchain[seq.chain_active_step][d] ][seq.step];
seq.seq_prev_vel[d] = seq.seq_vel[ seq.seq_patternchain[seq.seq_chain_active_step][d] ][seq.seq_step]; seq.prev_vel[d] = seq.vel[ seq.patternchain[seq.chain_active_step][d] ][seq.step];
} }
} }
else if (seq.seq_track_type[d] == 2 ) //Chords else if (seq.track_type[d] == 2 ) //Chords
{ {
if (seq.seq_vel[ seq.seq_patternchain[seq.seq_chain_active_step][d]][seq.seq_step] > 199) if (seq.vel[ seq.patternchain[seq.chain_active_step][d]][seq.step] > 199)
{ {
//handleNoteOn(configuration.dexed[seq.seq_inst_dexed[d]].midi_channel, seq.seq_data[ seq.seq_patternchain[seq.seq_chain_active_step][d] ][seq.seq_step], seq.seq_chord_velocity); // basenote //handleNoteOn(configuration.dexed[seq.inst_dexed[d]].midi_channel, seq.data[ seq.patternchain[seq.chain_active_step][d] ][seq.step], seq.chord_velocity); // basenote
for (uint8_t x = seq.seq_element_shift; x < seq.seq_element_shift + seq.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
{ {
handleNoteOn(configuration.dexed[seq.seq_chord_dexed_inst].midi_channel, seq.seq_data[ seq.seq_patternchain[seq.seq_chain_active_step][d] ][seq.seq_step] + (seq.seq_oct_shift * 12) + seq.seq_arps[seq.seq_vel[ seq.seq_patternchain[seq.seq_chain_active_step][d] ][seq.seq_step] - 200][x], seq.seq_chord_velocity); handleNoteOn(configuration.dexed[seq.chord_dexed_inst].midi_channel, seq.data[ seq.patternchain[seq.chain_active_step][d] ][seq.step] + (seq.oct_shift * 12) + seq.arps[seq.vel[ seq.patternchain[seq.chain_active_step][d] ][seq.step] - 200][x], seq.chord_velocity);
} }
seq.seq_prev_note[d] = seq.seq_data[seq.seq_patternchain[seq.seq_chain_active_step][d]][seq.seq_step] + (seq.seq_oct_shift * 12); seq.prev_note[d] = seq.data[seq.patternchain[seq.chain_active_step][d]][seq.step] + (seq.oct_shift * 12);
seq.seq_prev_vel[d] = seq.seq_vel[seq.seq_patternchain[seq.seq_chain_active_step][d]][seq.seq_step]; seq.prev_vel[d] = seq.vel[seq.patternchain[seq.chain_active_step][d]][seq.step];
} }
} }
if (seq.seq_track_type[d] == 3) { //Arp if (seq.track_type[d] == 3) { //Arp
seq.arp_step = 0; seq.arp_step = 0;
seq.arp_counter = 0; seq.arp_counter = 0;
seq.arp_note = seq.seq_data[ seq.seq_patternchain[seq.seq_chain_active_step][d] ][seq.seq_step] + (seq.seq_oct_shift * 12); seq.arp_note = seq.data[ seq.patternchain[seq.chain_active_step][d] ][seq.step] + (seq.oct_shift * 12);
seq.arp_chord = seq.seq_vel[seq.seq_patternchain[seq.seq_chain_active_step][d] ][seq.seq_step] - 200; seq.arp_chord = seq.vel[seq.patternchain[seq.chain_active_step][d] ][seq.step] - 200;
} }
} }
// after here not triggered by a key input - arp only // after here not triggered by a key input - arp only
if (seq.seq_track_type[d] == 3) if (seq.track_type[d] == 3)
{ //Arp { //Arp
if (seq.arp_speed == 0 || (seq.arp_speed == 1 && seq.arp_counter == 0) ) { if (seq.arp_speed == 0 || (seq.arp_speed == 1 && seq.arp_counter == 0) ) {
{ if (seq.arp_style == 0) { //arp up { if (seq.arp_style == 0) { //arp up
handleNoteOn(configuration.dexed[seq.seq_chord_dexed_inst].midi_channel, seq.arp_note + seq.seq_arps[seq.arp_chord][seq.arp_step + seq.seq_element_shift], seq.seq_chord_velocity); handleNoteOn(configuration.dexed[seq.chord_dexed_inst].midi_channel, seq.arp_note + seq.arps[seq.arp_chord][seq.arp_step + seq.element_shift], seq.chord_velocity);
seq.arp_note_prev = seq.arp_note + seq.seq_arps[seq.arp_chord][seq.arp_step + seq.seq_element_shift] ; seq.arp_note_prev = seq.arp_note + seq.arps[seq.arp_chord][seq.arp_step + seq.element_shift] ;
} }
else if (seq.arp_style == 1) { //arp down else if (seq.arp_style == 1) { //arp down
handleNoteOn(configuration.dexed[seq.seq_chord_dexed_inst].midi_channel, seq.arp_note + seq.seq_arps[seq.arp_chord][seq.arp_lenght - seq.arp_step + seq.seq_element_shift], seq.seq_chord_velocity); handleNoteOn(configuration.dexed[seq.chord_dexed_inst].midi_channel, seq.arp_note + seq.arps[seq.arp_chord][seq.arp_lenght - seq.arp_step + seq.element_shift], seq.chord_velocity);
seq.arp_note_prev = seq.arp_note + seq.seq_arps[seq.arp_chord][seq.arp_lenght - seq.arp_step + seq.seq_element_shift] ; seq.arp_note_prev = seq.arp_note + seq.arps[seq.arp_chord][seq.arp_lenght - seq.arp_step + seq.element_shift] ;
} }
else if (seq.arp_style == 2) { //arp up & down else if (seq.arp_style == 2) { //arp up & down
if (seq.arp_step <= seq.arp_lenght) { if (seq.arp_step <= seq.arp_lenght) {
handleNoteOn(configuration.dexed[seq.seq_chord_dexed_inst].midi_channel, seq.arp_note + seq.seq_arps[seq.arp_chord][seq.arp_step ], seq.seq_chord_velocity); handleNoteOn(configuration.dexed[seq.chord_dexed_inst].midi_channel, seq.arp_note + seq.arps[seq.arp_chord][seq.arp_step ], seq.chord_velocity);
seq.arp_note_prev = seq.arp_note + seq.seq_arps[seq.arp_chord][seq.arp_step ] ; seq.arp_note_prev = seq.arp_note + seq.arps[seq.arp_chord][seq.arp_step ] ;
} }
else { else {
handleNoteOn(configuration.dexed[seq.seq_chord_dexed_inst].midi_channel, seq.arp_note + seq.seq_arps[seq.arp_chord][seq.arp_lenght * 2 - seq.arp_step ], seq.seq_chord_velocity); handleNoteOn(configuration.dexed[seq.chord_dexed_inst].midi_channel, seq.arp_note + seq.arps[seq.arp_chord][seq.arp_lenght * 2 - seq.arp_step ], seq.chord_velocity);
seq.arp_note_prev = seq.arp_note + seq.seq_arps[seq.arp_chord][seq.arp_lenght * 2 - seq.arp_step ] ; seq.arp_note_prev = seq.arp_note + seq.arps[seq.arp_chord][seq.arp_lenght * 2 - seq.arp_step ] ;
} }
} }
else if (seq.arp_style == 3) { //arp random else if (seq.arp_style == 3) { //arp random
uint8_t rnd1 = random(seq.arp_lenght); uint8_t rnd1 = random(seq.arp_lenght);
handleNoteOn(configuration.dexed[seq.seq_chord_dexed_inst].midi_channel, seq.arp_note + seq.seq_arps[seq.arp_chord][rnd1 + seq.seq_element_shift] + (seq.seq_oct_shift * 12), seq.seq_chord_velocity); handleNoteOn(configuration.dexed[seq.chord_dexed_inst].midi_channel, seq.arp_note + seq.arps[seq.arp_chord][rnd1 + seq.element_shift] + (seq.oct_shift * 12), seq.chord_velocity);
seq.arp_note_prev = seq.arp_note + seq.seq_arps[seq.arp_chord][rnd1 + seq.seq_element_shift] + (seq.seq_oct_shift * 12); seq.arp_note_prev = seq.arp_note + seq.arps[seq.arp_chord][rnd1 + seq.element_shift] + (seq.oct_shift * 12);
} }
} }
} }
} }
} }
} }
seq.seq_noteoffsent[d] = false; seq.noteoffsent[d] = false;
} }
seq.arp_counter++; seq.arp_counter++;
seq.seq_step++; seq.step++;
if (seq.arp_speed == 0) // Arp Speed 1/16 if (seq.arp_speed == 0) // Arp Speed 1/16
{ {
seq.arp_step++; seq.arp_step++;
@ -179,7 +179,7 @@ void sequencer_part1(void)
if (seq.arp_style != 2) { if (seq.arp_style != 2) {
if ( (seq.arp_step > 1 && seq.seq_arps[seq.arp_chord][seq.arp_step] == 0) || seq.arp_step == seq.arp_lenght) if ( (seq.arp_step > 1 && seq.arps[seq.arp_chord][seq.arp_step] == 0) || seq.arp_step == seq.arp_lenght)
{ {
seq.arp_step = 0; seq.arp_step = 0;
} }
@ -191,20 +191,20 @@ void sequencer_part1(void)
} }
if ( seq.arp_style == 2 ) //only for up&down if ( seq.arp_style == 2 ) //only for up&down
{ {
if ( (seq.arp_step > 1 && seq.seq_arps[seq.arp_chord][seq.arp_step] == 0) || seq.arp_step == seq.arp_lenght * 2) if ( (seq.arp_step > 1 && seq.arps[seq.arp_chord][seq.arp_step] == 0) || seq.arp_step == seq.arp_lenght * 2)
{ {
seq.arp_step = 0; seq.arp_step = 0;
} }
} }
if (seq.seq_step > 15) if (seq.step > 15)
{ {
seq.seq_step = 0; seq.step = 0;
if (seq.seq_chain_lenght > 0) { if (seq.chain_lenght > 0) {
seq.seq_chain_active_step++; seq.chain_active_step++;
if (seq.seq_chain_active_step > seq.seq_chain_lenght) if (seq.chain_active_step > seq.chain_lenght)
{ {
seq.seq_chain_active_step = 0; seq.chain_active_step = 0;
} }
} }
} }
@ -215,27 +215,27 @@ void sequencer_part2(void)
seq_live_recording(); seq_live_recording();
for (uint8_t d = 0; d < NUM_SEQ_TRACKS; d++) for (uint8_t d = 0; d < NUM_SEQ_TRACKS; d++)
{ {
if (seq.seq_noteoffsent[d] == false) { if (seq.noteoffsent[d] == false) {
if ( seq.seq_prev_note[d] > 0 && seq.seq_track_type[d] > 0) if ( seq.prev_note[d] > 0 && seq.track_type[d] > 0)
{ {
if (seq.seq_data[ seq.seq_patternchain[seq.seq_chain_active_step][d] ][seq.seq_step] != 130) if (seq.data[ seq.patternchain[seq.chain_active_step][d] ][seq.step] != 130)
{ {
handleNoteOff(configuration.dexed[seq.seq_inst_dexed[d]].midi_channel, seq.seq_prev_note[d] , 0); handleNoteOff(configuration.dexed[seq.inst_dexed[d]].midi_channel, seq.prev_note[d] , 0);
seq.seq_noteoffsent[d] = true; seq.noteoffsent[d] = true;
} }
if (seq.seq_track_type[d] == 2) { //Chords if (seq.track_type[d] == 2) { //Chords
if ( seq.seq_prev_vel[d] > 199) { if ( seq.prev_vel[d] > 199) {
for (uint8_t x = seq.seq_element_shift; x < seq.seq_element_shift + seq.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.seq_chord_dexed_inst].midi_channel, seq.seq_prev_note[d] + seq.seq_arps[seq.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.seq_noteoffsent[d] = true; seq.noteoffsent[d] = true;
} }
} }
} }
else if (seq.seq_track_type[d] == 3) else if (seq.track_type[d] == 3)
{ //Arp { //Arp
handleNoteOff(configuration.dexed[seq.seq_chord_dexed_inst].midi_channel, seq.arp_note_prev, 0); handleNoteOff(configuration.dexed[seq.chord_dexed_inst].midi_channel, seq.arp_note_prev, 0);
seq.seq_noteoffsent[d] = true; seq.noteoffsent[d] = true;
} }
} }
} }

@ -28,29 +28,29 @@
typedef struct sequencer_s typedef struct sequencer_s
{ {
float drums_volume; float drums_volume;
uint8_t seq_active_track = 0; uint8_t active_track = 0;
uint8_t seq_menu; uint8_t menu;
bool seq_noteoffsent[NUM_SEQ_TRACKS] = {false, false, false, false, false, false}; bool noteoffsent[NUM_SEQ_TRACKS] = {false, false, false, false, false, false};
uint8_t seq_inst_dexed[NUM_SEQ_TRACKS] = { 0, 0, 1, 1 , 1, 1 }; uint8_t inst_dexed[NUM_SEQ_TRACKS] = { 0, 0, 1, 1 , 1, 1 };
uint8_t seq_step = 0; uint8_t step = 0;
bool seq_running = false; bool running = false;
bool seq_recording = false; bool recording = false;
bool smartfilter = true; bool smartfilter = true;
uint8_t seq_state_last_loadsave = 200; uint8_t state_last_loadsave = 200;
char seq_name[FILENAME_LEN]; char name[FILENAME_LEN];
char seq_name_temp[FILENAME_LEN]; char name_temp[FILENAME_LEN];
uint8_t seq_note_in; uint8_t note_in;
uint8_t seq_note_in_velocity; uint8_t note_in_velocity;
int seq_transpose; int transpose;
uint8_t seq_chord_dexed_inst = 0; uint8_t chord_dexed_inst = 0;
uint8_t seq_chord_velocity = 60; uint8_t chord_velocity = 60;
uint8_t seq_chord_key_ammount = 4; uint8_t chord_key_ammount = 4;
uint8_t seq_element_shift = 0; uint8_t element_shift = 0;
int seq_oct_shift = 0; int oct_shift = 0;
uint8_t arp_style = 0; // up, down, up&down, random uint8_t arp_style = 0; // up, down, up&down, random
const uint8_t seq_arps[6][23] = { const uint8_t arps[6][23] = {
{ 0, 4, 7, 12, 16, 19, 24, 28, 31, 36, 40, 43, 48, 52, 55, 60, 64, 67, 72, 76, 79, 84, 0}, //major { 0, 4, 7, 12, 16, 19, 24, 28, 31, 36, 40, 43, 48, 52, 55, 60, 64, 67, 72, 76, 79, 84, 0}, //major
{ 0, 3, 7, 12, 15, 19, 24, 27, 31, 36, 39, 43, 48, 51, 55, 60, 63, 67, 72, 75, 79, 84, 0}, //minor { 0, 3, 7, 12, 15, 19, 24, 27, 31, 36, 39, 43, 48, 51, 55, 60, 63, 67, 72, 75, 79, 84, 0}, //minor
{ 0, 4, 7, 10, 12, 16, 19, 22, 24, 28, 31, 34, 36, 40, 43, 46, 48, 52, 55, 58, 60, 64, 0}, //seventh { 0, 4, 7, 10, 12, 16, 19, 22, 24, 28, 31, 34, 36, 40, 43, 46, 48, 52, 55, 58, 60, 64, 0}, //seventh
@ -59,7 +59,7 @@ typedef struct sequencer_s
{ 0, 4, 7, 11, 12, 16, 19, 23, 24, 28, 31, 35, 36, 40, 43, 47, 48, 52, 55, 59, 60, 64, 0} //maj7 { 0, 4, 7, 11, 12, 16, 19, 23, 24, 28, 31, 35, 36, 40, 43, 47, 48, 52, 55, 59, 60, 64, 0} //maj7
}; };
const char seq_chord_names[7][4] = { const char chord_names[7][4] = {
{'M', 'a', 'j', ' '}, //major {'M', 'a', 'j', ' '}, //major
{'M', 'i', 'n', ' '}, {'M', 'i', 'n', ' '},
{'s', 'e', 'v', ' '}, {'s', 'e', 'v', ' '},
@ -75,15 +75,15 @@ typedef struct sequencer_s
{'u', '&', 'd'}, {'u', '&', 'd'},
{'R', 'N', 'D'} {'R', 'N', 'D'}
}; };
int seq_tempo_ms = 180000; int tempo_ms = 180000;
int seq_bpm = 102; int bpm = 102;
uint8_t seq_temp_select_menu; uint8_t temp_select_menu;
uint8_t seq_temp_active_menu = 99; uint8_t temp_active_menu = 99;
uint8_t seq_chain_active_chainstep; uint8_t chain_active_chainstep;
uint8_t seq_chain_lenght = 3; // 0 = 16 steps, 1 = 32 Steps, 2 = 46 Steps, 3 = 64 Steps uint8_t chain_lenght = 3; // 0 = 16 steps, 1 = 32 Steps, 2 = 46 Steps, 3 = 64 Steps
uint8_t seq_chain_active_step = 0; uint8_t chain_active_step = 0;
uint8_t seq_prev_note[NUM_SEQ_TRACKS]; // note_offs for every (instr.) track uint8_t prev_note[NUM_SEQ_TRACKS]; // note_offs for every (instr.) track
uint8_t seq_prev_vel[NUM_SEQ_TRACKS]; uint8_t prev_vel[NUM_SEQ_TRACKS];
uint8_t arp_step; uint8_t arp_step;
uint8_t arp_note; uint8_t arp_note;
uint8_t arp_chord = 6; uint8_t arp_chord = 6;
@ -94,8 +94,8 @@ typedef struct sequencer_s
uint8_t arp_speed = 0; uint8_t arp_speed = 0;
uint8_t arp_counter = 0; uint8_t arp_counter = 0;
uint8_t arp_lenght = 8; uint8_t arp_lenght = 8;
uint8_t seq_data_buffer[16] = { 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 }; uint8_t data_buffer[16] = { 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 };
uint8_t seq_data[NUM_SEQ_PATTERN][16] = { uint8_t data[NUM_SEQ_PATTERN][16] = {
{ 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 }, { 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 },
@ -107,7 +107,7 @@ typedef struct sequencer_s
{ 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[NUM_SEQ_PATTERN][16] = { uint8_t vel[NUM_SEQ_PATTERN][16] = {
{ 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 }, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
@ -119,14 +119,14 @@ typedef struct sequencer_s
{ 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_content_type[NUM_SEQ_PATTERN] = { 0, 0, 0, 0 , 0, 0, 0 , 0 , 0 , 0 }; // 0 = track is Drumtrack, 1 = Instrumenttrack, 2 = Chord or Arpeggio uint8_t content_type[NUM_SEQ_PATTERN] = { 0, 0, 0, 0 , 0, 0, 0 , 0 , 0 , 0 }; // 0 = track is Drumtrack, 1 = Instrumenttrack, 2 = Chord or Arpeggio
uint8_t seq_patternchain[4][NUM_SEQ_TRACKS] = { uint8_t patternchain[4][NUM_SEQ_TRACKS] = {
{ 0 , 2 , 6 , 9 , 99, 99 }, { 0 , 2 , 6 , 9 , 99, 99 },
{ 1 , 2 , 5 , 8 , 99, 99 }, { 1 , 2 , 5 , 8 , 99, 99 },
{ 0 , 2 , 6 , 9 , 99, 99 }, { 0 , 2 , 6 , 9 , 99, 99 },
{ 1 , 2 , 5 , 7 , 99, 99 } { 1 , 2 , 5 , 7 , 99, 99 }
}; };
uint8_t seq_track_type[NUM_SEQ_TRACKS] = { 0, 0, 1, 1, 1, 1 }; // 0 = track is Drumtrack, 1 = Instrumenttrack, 2 = Chord, 3 = Arp uint8_t track_type[NUM_SEQ_TRACKS] = { 0, 0, 1, 1, 1, 1 }; // 0 = track is Drumtrack, 1 = Instrumenttrack, 2 = Chord, 3 = Arp
} sequencer_t; } sequencer_t;
#endif #endif

Loading…
Cancel
Save