Several changes in naming function calls for better matching with MD_next.

Fixes for seq.data[] -> seq.note_data[]
pull/112/head
Holger Wirtz 3 years ago
parent 257d2a9125
commit 4c9f5c4d9b
  1. 5
      MicroDexed.ino
  2. 354
      UI.hpp
  3. 12
      dexed_sd.cpp
  4. 30
      sequencer.cpp
  5. 2
      sequencer.h

@ -439,11 +439,6 @@ void setup()
delay(50); // seems to be needed when no serial debugging is enabled delay(50); // seems to be needed when no serial debugging is enabled
#endif #endif
#ifdef DISPLAY_LCD_SPI
pinMode(SDCARD_CS_PIN, OUTPUT);
pinMode(U8X8_CS_PIN, OUTPUT);
#endif
#ifdef ENABLE_LCD_UI #ifdef ENABLE_LCD_UI
setup_ui(); setup_ui();
#endif #endif

354
UI.hpp

File diff suppressed because it is too large Load Diff

@ -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.data); int total = sizeof(seq.note_data);
int columns = sizeof(seq.data[0]); int columns = sizeof(seq.note_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.data[i][j]; data_json["seq_data"][count] = seq.note_data[i][j];
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.data); int total = sizeof(seq.note_data);
int columns = sizeof(seq.data[0]); int columns = sizeof(seq.note_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.data[i][j] = data_json["seq_data"][count]; seq.note_data[i][j] = data_json["seq_data"][count];
count++; count++;
} }
} }

@ -50,7 +50,7 @@ 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.note_in > 0 && 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.data[seq.active_track][seq.step] = seq.note_in; seq.note_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.vel[seq.active_track][seq.step] = get_sample_note(activesample); seq.vel[seq.active_track][seq.step] = get_sample_note(activesample);
@ -65,8 +65,8 @@ void seq_live_recording(void)
void sequencer_part1(void) void sequencer_part1(void)
{ {
//if (seq.note_in > 0 && seq.note_in < 62 && seq.recording == false ) { //if (seq.note_in > 0 && seq.note_in < 62 && seq.recording == false ) {
//handleNoteOff(configuration.dexed[0].midi_channel, seq.data[3][seq.step] + seq.transpose , 0); //handleNoteOff(configuration.dexed[0].midi_channel, seq.note_data[3][seq.step] + seq.transpose , 0);
//handleNoteOff(configuration.dexed[0].midi_channel, seq.data[3][seq.step - 1] + seq.transpose , 0); //handleNoteOff(configuration.dexed[0].midi_channel, seq.note_data[3][seq.step - 1] + seq.transpose , 0);
//if (seq.note_in>65)seq.note_in=seq.note_in-12; //if (seq.note_in>65)seq.note_in=seq.note_in-12;
//seq.transpose = seq.note_in % 12 ; //seq.transpose = seq.note_in % 12 ;
//seq.transpose=seq.transpose-12; //seq.transpose=seq.transpose-12;
@ -80,27 +80,27 @@ void sequencer_part1(void)
{ {
if ( 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.data[ seq.patternchain[seq.chain_active_step][d] ][seq.step] > 0 ) if (seq.note_data[ seq.patternchain[seq.chain_active_step][d] ][seq.step] > 0 )
{ {
if (seq.vel[ seq.patternchain[seq.chain_active_step][d] ][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.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 ) ); set_sample_pitch(seq.vel[ seq.patternchain[seq.chain_active_step][d] ][seq.step] - 210 , (float)pow (2, (seq.note_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.vel[ seq.patternchain[seq.chain_active_step][d] ][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.data[ seq.patternchain[seq.chain_active_step][d] ][seq.step] , seq.vel[ seq.patternchain[seq.chain_active_step][d] ][seq.step]); handleNoteOn(drum_midi_channel, seq.note_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.data[seq.patternchain[seq.chain_active_step][d]][seq.step] > 0 ) // instrument track if (seq.note_data[seq.patternchain[seq.chain_active_step][d]][seq.step] > 0 ) // instrument track
{ {
if (seq.track_type[d] == 1 || (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.data[seq.patternchain[seq.chain_active_step][d]][seq.step] != 130 ) if (seq.note_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.note_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.note_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];
} }
} }
@ -109,20 +109,20 @@ void sequencer_part1(void)
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)
{ {
//handleNoteOn(configuration.dexed[seq.inst_dexed[d]].midi_channel, seq.data[ seq.patternchain[seq.chain_active_step][d] ][seq.step], seq.chord_velocity); // basenote //handleNoteOn(configuration.dexed[seq.inst_dexed[d]].midi_channel, seq.note_data[ seq.patternchain[seq.chain_active_step][d] ][seq.step], seq.chord_velocity); // basenote
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
{ {
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); handleNoteOn(configuration.dexed[seq.chord_dexed_inst].midi_channel, seq.note_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.prev_note[d] = seq.data[seq.patternchain[seq.chain_active_step][d]][seq.step] + (seq.oct_shift * 12); seq.prev_note[d] = seq.note_data[seq.patternchain[seq.chain_active_step][d]][seq.step] + (seq.oct_shift * 12);
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];
} }
} }
if (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.data[ seq.patternchain[seq.chain_active_step][d] ][seq.step] + (seq.oct_shift * 12); seq.arp_note = seq.note_data[ seq.patternchain[seq.chain_active_step][d] ][seq.step] + (seq.oct_shift * 12);
seq.arp_chord = seq.vel[seq.patternchain[seq.chain_active_step][d] ][seq.step] - 200; seq.arp_chord = seq.vel[seq.patternchain[seq.chain_active_step][d] ][seq.step] - 200;
} }
} }
@ -218,7 +218,7 @@ 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) if (seq.note_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; seq.noteoffsent[d] = true;

@ -95,7 +95,7 @@ typedef struct sequencer_s
uint8_t arp_counter = 0; uint8_t arp_counter = 0;
uint8_t arp_lenght = 8; uint8_t arp_lenght = 8;
uint8_t 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 data[NUM_SEQ_PATTERN][16] = { uint8_t note_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 },

Loading…
Cancel
Save