Merge pull request 'All Arp Modes now working as intended' (#77) from positionhigh/MicroDexed:dev into dev

Reviewed-on: https://codeberg.org/dcoredump/MicroDexed/pulls/77
pull/85/head
Holger Wirtz 3 years ago
commit b4145a9e97
  1. 2
      MicroDexed.ino
  2. 35
      UI.hpp
  3. 49
      UI_FX.h
  4. 49
      UI_FX_T4.h
  5. 47
      UI_NO_FX.h
  6. 2
      config.h
  7. 196
      dexed_sd.cpp
  8. 3
      drums.h
  9. 54
      sequencer.cpp

@ -811,7 +811,7 @@ void handleNoteOn(byte inChannel, byte inNumber, byte inVelocity)
#if NUM_DRUMS > 0
// Check for Drum
if (inChannel == DRUM_MIDI_CHANNEL)
if (inChannel == drum_midi_channel)
{
if (drum_counter >= NUM_DRUMS)
drum_counter = 0;

@ -257,6 +257,7 @@ void UI_func_reverb_send(uint8_t param);
void UI_func_filter_cutoff(uint8_t param);
void UI_func_filter_resonance(uint8_t param);
void UI_func_drum_reverb_send(uint8_t param);
void UI_func_drum_midi_channel(uint8_t param);
#endif
void UI_func_transpose(uint8_t param);
void UI_func_tune(uint8_t param);
@ -3692,6 +3693,38 @@ void UI_func_drum_reverb_send(uint8_t param)
}
}
void UI_func_drum_midi_channel(uint8_t param)
{
if (LCDML.FUNC_setup()) // ****** SETUP *********
{
encoderDir[ENC_R].reset();
lcd.setCursor(0, 0);
lcd.print(F("MIDI Channel"));
}
if (LCDML.FUNC_loop()) // ****** LOOP *********
{
if (LCDML.BT_checkDown() && encoderDir[ENC_R].Down())
drum_midi_channel = constrain(drum_midi_channel + ENCODER[ENC_R].speed(), MIDI_CHANNEL_MIN, MIDI_CHANNEL_MAX);
else if (LCDML.BT_checkUp() && encoderDir[ENC_R].Up())
drum_midi_channel = constrain(drum_midi_channel - ENCODER[ENC_R].speed(), MIDI_CHANNEL_MIN, MIDI_CHANNEL_MAX);
lcd.setCursor(0, 1);
if (drum_midi_channel == 0)
{
lcd.print(F("[OMNI]"));
}
else
{
lcd_display_int(drum_midi_channel, 4, false, true, false);
}
}
if (LCDML.FUNC_close()) // ****** STABLE END *********
{
encoderDir[ENC_R].reset();
// EEPROM.update(EEPROM_START_ADDRESS + offsetof(configuration_s, dexed[0].midi_channel), configuration.dexed[0].midi_channel); }
}
}
void UI_func_drums_main_volume(uint8_t param)
{
char displayname[4] = {0, 0, 0, 0};
@ -5057,7 +5090,7 @@ void UI_func_arpeggio(uint8_t param)
}
}
lcd.setCursor( 4, 0);
if (arp_lenght==0) lcd.print("A");else lcd.print(arp_lenght); //play all elements or from 1-xx elements
if (arp_lenght == 0) lcd.print("A"); else lcd.print(arp_lenght); //play all elements or from 1-xx elements
lcd.setCursor( 6, 1);
lcd.print( arp_style_names[arp_style][0] );
lcd.print( arp_style_names[arp_style][1] );

@ -119,28 +119,29 @@ LCDML_add(84, LCDML_0_4, 1, "Drums Main Vol", UI_func_drum_main_volume);
LCDML_add(85, LCDML_0_4, 2, "Drum Volumes", UI_func_drum_volume);
LCDML_add(86, LCDML_0_4, 3, "Drum Pan", UI_func_drum_pan);
LCDML_add(87, LCDML_0_4, 4, "Drum Rev.Send", UI_func_drum_reverb_send);
LCDML_add(88, LCDML_0, 5, "Sequencer", NULL);
LCDML_add(89, LCDML_0_5, 1, "Sequencer", UI_func_sequencer);
LCDML_add(90, LCDML_0_5, 2, "Vel./Chrd Edit", UI_func_seq_vel_editor);
LCDML_add(91, LCDML_0_5, 3, "Pattern Chain", UI_func_seq_pat_chain);
LCDML_add(92, LCDML_0_5, 4, "Arpeggio", UI_func_arpeggio);
LCDML_add(93, LCDML_0_5, 5, "Seq. Settings", NULL);
LCDML_add(94, LCDML_0_5_5, 1, "Tempo", UI_func_seq_tempo);
LCDML_add(95, LCDML_0_5_5, 2, "Seq. Length", UI_func_seq_lenght);
LCDML_add(96, LCDML_0_5_5, 3, "Track Setup", UI_func_seq_track_setup);
LCDML_add(97, LCDML_0_5_5, 4, "Seq.Disp.Style", UI_func_seq_display_style);
LCDML_add(98, LCDML_0_5_5, 5, "dexed assign", UI_func_dexed_assign);
LCDML_add(99, LCDML_0_5_5, 6, "shift&transp.", UI_func_arp_shift);
LCDML_add(100, LCDML_0_5_5, 8, "ChordTrack Keys", UI_func_seq_chord_keys_ammount);
LCDML_add(101, LCDML_0_5_5, 6, "L.Transp.Key", UI_func_seq_live_transpose_oct);
LCDML_add(102, LCDML_0_5, 6, "LOAD Seq.Data", UI_func_seq_state_load);
LCDML_add(103, LCDML_0_5, 7, "SAVE Seq.Data", UI_func_seq_state_save);
LCDML_add(104, LCDML_0, 6, "System", NULL);
LCDML_add(105, LCDML_0_6, 1, "Stereo/Mono", UI_func_stereo_mono);
LCDML_add(106, LCDML_0_6, 2, "MIDI Soft THRU", UI_func_midi_soft_thru);
LCDML_add(107, LCDML_0_6, 3, "Favorites", UI_func_favorites);
LCDML_add(108, LCDML_0_6, 4, "EEPROM Reset", UI_func_eeprom_reset);
LCDML_add(109, LCDML_0, 7, "Info", UI_func_information);
LCDML_addAdvanced(110, LCDML_0, 8, COND_hide, "Volume", UI_func_volume, 0, _LCDML_TYPE_default);
#define _LCDML_DISP_cnt 110
LCDML_add(88, LCDML_0_4, 5, "MIDI Channel", UI_func_drum_midi_channel);
LCDML_add(89, LCDML_0, 5, "Sequencer", NULL);
LCDML_add(90, LCDML_0_5, 1, "Sequencer", UI_func_sequencer);
LCDML_add(91, LCDML_0_5, 2, "Vel./Chrd Edit", UI_func_seq_vel_editor);
LCDML_add(92, LCDML_0_5, 3, "Pattern Chain", UI_func_seq_pat_chain);
LCDML_add(93, LCDML_0_5, 4, "Arpeggio", UI_func_arpeggio);
LCDML_add(94, LCDML_0_5, 5, "Seq. Settings", NULL);
LCDML_add(95, LCDML_0_5_5, 1, "Tempo", UI_func_seq_tempo);
LCDML_add(96, LCDML_0_5_5, 2, "Seq. Length", UI_func_seq_lenght);
LCDML_add(97, LCDML_0_5_5, 3, "Track Setup", UI_func_seq_track_setup);
LCDML_add(98, LCDML_0_5_5, 4, "Seq.Disp.Style", UI_func_seq_display_style);
LCDML_add(99, LCDML_0_5_5, 5, "dexed assign", UI_func_dexed_assign);
LCDML_add(100, LCDML_0_5_5, 6, "shift&transp.", UI_func_arp_shift);
LCDML_add(101, LCDML_0_5_5, 8, "ChordTrack Keys", UI_func_seq_chord_keys_ammount);
LCDML_add(102, LCDML_0_5_5, 6, "L.Transp.Key", UI_func_seq_live_transpose_oct);
LCDML_add(103, LCDML_0_5, 6, "LOAD Seq.Data", UI_func_seq_state_load);
LCDML_add(104, LCDML_0_5, 7, "SAVE Seq.Data", UI_func_seq_state_save);
LCDML_add(105, LCDML_0, 6, "System", NULL);
LCDML_add(106, LCDML_0_6, 1, "Stereo/Mono", UI_func_stereo_mono);
LCDML_add(107, LCDML_0_6, 2, "MIDI Soft THRU", UI_func_midi_soft_thru);
LCDML_add(108, LCDML_0_6, 3, "Favorites", UI_func_favorites);
LCDML_add(109, LCDML_0_6, 4, "EEPROM Reset", UI_func_eeprom_reset);
LCDML_add(110, LCDML_0, 7, "Info", UI_func_information);
LCDML_addAdvanced(111, LCDML_0, 8, COND_hide, "Volume", UI_func_volume, 0, _LCDML_TYPE_default);
#define _LCDML_DISP_cnt 111
#endif

@ -122,28 +122,29 @@ LCDML_add(88, LCDML_0_4, 1, "Drums Main Vol", UI_func_drums_main_volume);
LCDML_add(89, LCDML_0_4, 2, "Drum Volumes", UI_func_drum_volume);
LCDML_add(90, LCDML_0_4, 3, "Drum Pan", UI_func_drum_pan);
LCDML_add(91, LCDML_0_4, 4, "Drum Rev.Send", UI_func_drum_reverb_send);
LCDML_add(92, LCDML_0, 5, "Sequencer", NULL);
LCDML_add(93, LCDML_0_5, 1, "Sequencer", UI_func_sequencer);
LCDML_add(94, LCDML_0_5, 2, "Vel./Chrd Edit", UI_func_seq_vel_editor);
LCDML_add(95, LCDML_0_5, 3, "Pattern Chain", UI_func_seq_pat_chain);
LCDML_add(96, LCDML_0_5, 4, "Arpeggio", UI_func_arpeggio);
LCDML_add(97, LCDML_0_5, 5, "Seq. Settings", NULL);
LCDML_add(98, LCDML_0_5_5, 1, "Tempo", UI_func_seq_tempo);
LCDML_add(99, LCDML_0_5_5, 2, "Seq. Length", UI_func_seq_lenght);
LCDML_add(100, LCDML_0_5_5, 3, "Track Setup", UI_func_seq_track_setup);
LCDML_add(101, LCDML_0_5_5, 4, "Seq.Disp.Style", UI_func_seq_display_style);
LCDML_add(102, LCDML_0_5_5, 5, "dexed assign", UI_func_dexed_assign);
LCDML_add(103, LCDML_0_5_5, 6, "shift&transp.", UI_func_arp_shift);
LCDML_add(104, LCDML_0_5_5, 7, "L.Transp.Key", UI_func_seq_live_transpose_oct);
LCDML_add(105, LCDML_0_5_5, 8, "ChordTrack Keys", UI_func_seq_chord_keys_ammount);
LCDML_add(106, LCDML_0_5, 6, "LOAD Seq.Data", UI_func_seq_state_load);
LCDML_add(107, LCDML_0_5, 7, "SAVE Seq.Data", UI_func_seq_state_save);
LCDML_add(108, LCDML_0, 6, "System", NULL);
LCDML_add(109, LCDML_0_6, 1, "Stereo/Mono", UI_func_stereo_mono);
LCDML_add(110, LCDML_0_6, 2, "MIDI Soft THRU", UI_func_midi_soft_thru);
LCDML_add(111, LCDML_0_6, 3, "Favorites", UI_func_favorites);
LCDML_add(112, LCDML_0_6, 4, "EEPROM Reset", UI_func_eeprom_reset);
LCDML_add(113, LCDML_0, 7, "Info", UI_func_information);
LCDML_addAdvanced(114, LCDML_0, 8, COND_hide, "Volume", UI_func_volume, 0, _LCDML_TYPE_default);
#define _LCDML_DISP_cnt 114
LCDML_add(92, LCDML_0_4, 5, "MIDI Channel", UI_func_drum_midi_channel);
LCDML_add(93, LCDML_0, 5, "Sequencer", NULL);
LCDML_add(94, LCDML_0_5, 1, "Sequencer", UI_func_sequencer);
LCDML_add(95, LCDML_0_5, 2, "Vel./Chrd Edit", UI_func_seq_vel_editor);
LCDML_add(96, LCDML_0_5, 3, "Pattern Chain", UI_func_seq_pat_chain);
LCDML_add(97, LCDML_0_5, 4, "Arpeggio", UI_func_arpeggio);
LCDML_add(98, LCDML_0_5, 5, "Seq. Settings", NULL);
LCDML_add(99, LCDML_0_5_5, 1, "Tempo", UI_func_seq_tempo);
LCDML_add(100, LCDML_0_5_5, 2, "Seq. Length", UI_func_seq_lenght);
LCDML_add(101, LCDML_0_5_5, 3, "Track Setup", UI_func_seq_track_setup);
LCDML_add(102, LCDML_0_5_5, 4, "Seq.Disp.Style", UI_func_seq_display_style);
LCDML_add(103, LCDML_0_5_5, 5, "dexed assign", UI_func_dexed_assign);
LCDML_add(104, LCDML_0_5_5, 6, "shift&transp.", UI_func_arp_shift);
LCDML_add(105, LCDML_0_5_5, 7, "L.Transp.Key", UI_func_seq_live_transpose_oct);
LCDML_add(106, LCDML_0_5_5, 8, "ChordTrack Keys", UI_func_seq_chord_keys_ammount);
LCDML_add(107, LCDML_0_5, 6, "LOAD Seq.Data", UI_func_seq_state_load);
LCDML_add(108, LCDML_0_5, 7, "SAVE Seq.Data", UI_func_seq_state_save);
LCDML_add(109, LCDML_0, 6, "System", NULL);
LCDML_add(110, LCDML_0_6, 1, "Stereo/Mono", UI_func_stereo_mono);
LCDML_add(111, LCDML_0_6, 2, "MIDI Soft THRU", UI_func_midi_soft_thru);
LCDML_add(112, LCDML_0_6, 3, "Favorites", UI_func_favorites);
LCDML_add(113, LCDML_0_6, 4, "EEPROM Reset", UI_func_eeprom_reset);
LCDML_add(114, LCDML_0, 7, "Info", UI_func_information);
LCDML_addAdvanced(115, LCDML_0, 8, COND_hide, "Volume", UI_func_volume, 0, _LCDML_TYPE_default);
#define _LCDML_DISP_cnt 115
#endif

@ -90,28 +90,29 @@ LCDML_add(56, LCDML_0_4, 1, "Drums Main Vol", UI_func_drums_main_volume);
LCDML_add(57, LCDML_0_4, 2, "Drum Volumes", UI_func_drum_volume);
LCDML_add(58, LCDML_0_4, 3, "Drum Pan", UI_func_drum_pan);
LCDML_add(59, LCDML_0_4, 4, "Drum Rev.Send", UI_func_drum_reverb_send);
LCDML_add(60, LCDML_0, 5, "Sequencer", NULL);
LCDML_add(61, LCDML_0_5, 1, "Sequencer", UI_func_sequencer);
LCDML_add(62, LCDML_0_5, 2, "Vel./Chrd Edit", UI_func_seq_vel_editor);
LCDML_add(63, LCDML_0_5, 3, "Pattern Chain", UI_func_seq_pat_chain);
LCDML_add(64, LCDML_0_5, 4, "Arpeggio", UI_func_arpeggio);
LCDML_add(65, LCDML_0_5, 5, "Seq. Settings", NULL);
LCDML_add(66, LCDML_0_5_5, 1, "Tempo", UI_func_seq_tempo);
LCDML_add(67, LCDML_0_5_5, 2, "Seq. Length", UI_func_seq_lenght);
LCDML_add(68, LCDML_0_5_5, 3, "Track Setup", UI_func_seq_track_setup);
LCDML_add(69, LCDML_0_5_5, 4, "Seq.Disp.Style", UI_func_seq_display_style);
LCDML_add(70, LCDML_0_5_5, 5, "dexed assign", UI_func_dexed_assign);
LCDML_add(71, LCDML_0_5_5, 6, "L.Transp.Key", UI_func_seq_live_transpose_oct);
LCDML_add(72, LCDML_0_5_5, 8, "ChordTrack Keys", UI_func_seq_chord_keys_ammount);
LCDML_add(73, LCDML_0_5, 6, "LOAD Seq.Data", UI_func_seq_state_load);
LCDML_add(74, LCDML_0_5, 7, "SAVE Seq.Data", UI_func_seq_state_save);
LCDML_add(75, LCDML_0, 5, "System", NULL);
LCDML_add(76, LCDML_0_5, 1, "Stereo/Mono", UI_func_stereo_mono);
LCDML_add(77, LCDML_0_5, 2, "MIDI Soft THRU", UI_func_midi_soft_thru);
LCDML_add(78, LCDML_0_5, 3, "Favorites", UI_func_favorites);
LCDML_add(79, LCDML_0_5, 4, "EEPROM Reset", UI_func_eeprom_reset);
LCDML_add(80, LCDML_0, 6, "Info", UI_func_information);
LCDML_addAdvanced(81, LCDML_0, 5, COND_hide, "Volume", UI_func_volume, 0, _LCDML_TYPE_default);
#define _LCDML_DISP_cnt 81
LCDML_add(60, LCDML_0_4, 5, "MIDI Channel", UI_func_drum_midi_channel);
LCDML_add(61, LCDML_0, 5, "Sequencer", NULL);
LCDML_add(62, LCDML_0_5, 1, "Sequencer", UI_func_sequencer);
LCDML_add(63, LCDML_0_5, 2, "Vel./Chrd Edit", UI_func_seq_vel_editor);
LCDML_add(64, LCDML_0_5, 3, "Pattern Chain", UI_func_seq_pat_chain);
LCDML_add(65, LCDML_0_5, 4, "Arpeggio", UI_func_arpeggio);
LCDML_add(66, LCDML_0_5, 5, "Seq. Settings", NULL);
LCDML_add(67, LCDML_0_5_5, 1, "Tempo", UI_func_seq_tempo);
LCDML_add(68, LCDML_0_5_5, 2, "Seq. Length", UI_func_seq_lenght);
LCDML_add(69, LCDML_0_5_5, 3, "Track Setup", UI_func_seq_track_setup);
LCDML_add(70, LCDML_0_5_5, 4, "Seq.Disp.Style", UI_func_seq_display_style);
LCDML_add(71, LCDML_0_5_5, 5, "dexed assign", UI_func_dexed_assign);
LCDML_add(72, LCDML_0_5_5, 6, "L.Transp.Key", UI_func_seq_live_transpose_oct);
LCDML_add(73, LCDML_0_5_5, 8, "ChordTrack Keys", UI_func_seq_chord_keys_ammount);
LCDML_add(74, LCDML_0_5, 6, "LOAD Seq.Data", UI_func_seq_state_load);
LCDML_add(75, LCDML_0_5, 7, "SAVE Seq.Data", UI_func_seq_state_save);
LCDML_add(76, LCDML_0, 5, "System", NULL);
LCDML_add(77, LCDML_0_5, 1, "Stereo/Mono", UI_func_stereo_mono);
LCDML_add(78, LCDML_0_5, 2, "MIDI Soft THRU", UI_func_midi_soft_thru);
LCDML_add(79, LCDML_0_5, 3, "Favorites", UI_func_favorites);
LCDML_add(80, LCDML_0_5, 4, "EEPROM Reset", UI_func_eeprom_reset);
LCDML_add(81, LCDML_0, 6, "Info", UI_func_information);
LCDML_addAdvanced(82, LCDML_0, 5, COND_hide, "Volume", UI_func_volume, 0, _LCDML_TYPE_default);
#define _LCDML_DISP_cnt 82
#endif

@ -111,8 +111,6 @@
// NUMBER OF PARALLEL SAMPLEDRUMS
#define NUM_DRUMS 8
// DEFULT MIDI CHANNEL FOR SAMPLEDRUMS
#define DRUM_MIDI_CHANNEL 1
// CHORUS parameters
#define MOD_DELAY_SAMPLE_BUFFER int32_t(TIME_MS2SAMPLES(20.0)) // 20.0 ms delay buffer.

@ -837,104 +837,7 @@ bool load_sd_seq_drumsettings_json(uint8_t number)
}
}
AudioInterrupts();
return (false);
}
bool load_sd_seq_voicesettings_json(uint8_t number)
{
uint8_t bank[MAX_DEXED];
uint8_t voice[MAX_DEXED];
if (number < 0)
return (false);
number = constrain(number, 0, 99);
if (sd_card > 0)
{
File json;
char filename[FILENAME_LEN];
sprintf(filename, "/%s/%s%d-v.json", SEQ_CONFIG_PATH, SEQ_CONFIG_NAME, number);
// first check if file exists...
AudioNoInterrupts();
if (SD.exists(filename))
{
// ... and if: load
#ifdef DEBUG
Serial.print(F("Found Sequencer configuration ["));
Serial.print(filename);
Serial.println(F("]... loading..."));
#endif
json = SD.open(filename);
if (json)
{
deserializeJson(data_json, json);
json.close();
AudioInterrupts();
//check_configuration_fx();
#ifdef DEBUG
Serial.println(F("Read JSON data:"));
serializeJsonPretty(data_json, Serial);
Serial.println();
#endif
for (uint8_t i = 0; i < MAX_DEXED; i++)
{
bank[i] = data_json["bank"][i];
voice[i] = data_json["voice"][i];
configuration.fx.reverb_send[i] = data_json["rev_send"][i];
configuration.dexed[i].midi_channel = data_json["midi_ch"][i];
configuration.dexed[i].sound_intensity = data_json["vol"][i];
configuration.dexed[i].transpose = data_json["v_trans"][i];
}
/*
configuration.fx.reverb_roomsize = data_json["rev_roomsize"];
configuration.fx.reverb_damping = data_json["rev_damping"];
configuration.fx.reverb_lowpass = data_json["rev_lowpass"];
configuration.fx.reverb_lodamp = data_json["rev_lodamp"];
configuration.fx.reverb_hidamp = data_json["rev_hidamp"];
configuration.fx.reverb_diffusion = data_json["rev_diffusion"];
configuration.fx.reverb_level = data_json["rev_level"];
configuration.fx.eq_bass = data_json["eq_bass"];
configuration.fx.eq_treble = data_json["eq_treble"]; */
for (uint8_t i = 0; i < NUM_DEXED; i++)
{
load_sd_voice(bank[i], voice[i], i);
MicroDexed[i]->doRefreshVoice();
MicroDexed[i]->panic();
}
seq_tempo_ms = 60000000 / seq_bpm / 4;
timer1.begin(sequencer, seq_tempo_ms / 2, false);
//set_fx_params();
return (true);
}
#ifdef DEBUG
else
{
Serial.print(F("E : Cannot open "));
Serial.print(filename);
Serial.println(F(" on SD."));
}
}
else
{
Serial.print(F("No "));
Serial.print(filename);
Serial.println(F(" available."));
#endif
}
}
AudioInterrupts();
return (false);
}
@ -980,6 +883,7 @@ bool save_sd_seq_drumsettings_json(uint8_t number)
return (true);
}
json.close();
AudioInterrupts();
}
else
{
@ -989,75 +893,6 @@ bool save_sd_seq_drumsettings_json(uint8_t number)
Serial.println(F(" on SD."));
#endif
}
AudioInterrupts();
return (false);
}
bool save_sd_seq_voicesettings_json(uint8_t number)
{
char filename[FILENAME_LEN];
number = constrain(number, 0, 99);
if (sd_card > 0)
{
File json;
sprintf(filename, "/%s/%s%d-v.json", SEQ_CONFIG_PATH, SEQ_CONFIG_NAME, number);
#ifdef DEBUG
Serial.print(F("Saving sequencer voice config "));
Serial.print(number);
Serial.print(F(" to "));
Serial.println(filename);
#endif
AudioNoInterrupts();
json = SD.open(filename, FILE_WRITE);
if (json)
{
for (uint8_t i = 0; i < MAX_DEXED; i++)
{
data_json["bank"][i] = configuration.performance.bank[i];
data_json["voice"][i] = configuration.performance.voice[i];
data_json["rev_send"][i] = configuration.fx.reverb_send[i];
data_json["midi_ch"][i] = configuration.dexed[i].midi_channel;
data_json["vol"][i] = configuration.dexed[i].sound_intensity;
data_json["v_trans"][i] = configuration.dexed[i].transpose;
}
/*
data_json["rev_roomsize"] = configuration.fx.reverb_roomsize;
data_json["rev_damping"] = configuration.fx.reverb_damping;
data_json["rev_lowpass"] = configuration.fx.reverb_lowpass;
data_json["rev_lodamp"] = configuration.fx.reverb_lodamp;
data_json["rev_hidamp"] = configuration.fx.reverb_hidamp;
data_json["rev_diffusion"] = configuration.fx.reverb_diffusion;
data_json["rev_level"] = configuration.fx.reverb_level;
data_json["eq_bass"] = configuration.fx.eq_bass;
data_json["eq_treble"] = configuration.fx.eq_treble; */
#ifdef DEBUG
Serial.println(F("Write JSON data:"));
serializeJsonPretty(data_json, Serial);
Serial.println();
#endif
serializeJsonPretty(data_json, json);
json.close();
AudioInterrupts();
return (true);
}
json.close();
}
else
{
#ifdef DEBUG
Serial.print(F("E : Cannot open "));
Serial.print(filename);
Serial.println(F(" on SD."));
#endif
}
AudioInterrupts();
return (false);
}
@ -1067,23 +902,8 @@ bool save_sd_seq_json(uint8_t seq_number)
int count = 0;
seq_number = constrain(seq_number, 0, 99);
save_sd_seq_drumsettings_json(seq_number);
save_sd_seq_voicesettings_json(seq_number);
if (sd_card > 0)
{
sprintf(filename, "/%s/%s%d.json", SEQ_CONFIG_PATH, SEQ_CONFIG_NAME, seq_number);
AudioNoInterrupts();
if (SD.exists(filename)) {
Serial.println("Remove");
Serial.print(filename);
SD.remove(filename);
}
AudioInterrupts();
File json;
sprintf(filename, "/%s/%s%d.json", SEQ_CONFIG_PATH, SEQ_CONFIG_NAME, seq_number);
@ -1175,11 +995,11 @@ bool save_sd_seq_json(uint8_t seq_number)
#endif
serializeJsonPretty(data_json, json);
json.close();
AudioInterrupts();
return (true);
}
json.close();
AudioInterrupts();
}
else
{
@ -1189,7 +1009,6 @@ bool save_sd_seq_json(uint8_t seq_number)
Serial.println(F(" on SD."));
#endif
}
AudioInterrupts();
return (false);
}
@ -1201,9 +1020,6 @@ bool load_sd_seq_json(uint8_t seq_number)
seq_number = constrain(seq_number, 0, 99);
load_sd_seq_drumsettings_json(seq_number);
load_sd_seq_voicesettings_json(seq_number);
if (sd_card > 0)
{
File json;
@ -1227,9 +1043,7 @@ bool load_sd_seq_json(uint8_t seq_number)
deserializeJson(data_json, json);
json.close();
AudioInterrupts();
//check_configuration_fx();
#ifdef DEBUG
Serial.println(F("Read JSON data:"));
@ -1292,9 +1106,9 @@ bool load_sd_seq_json(uint8_t seq_number)
seq_oct_shift = data_json["seq_oct_shift"];
seq_element_shift = data_json["seq_element_shift"];
//set_fx_params();
return (true);
}
#ifdef DEBUG
else
@ -1312,8 +1126,6 @@ bool load_sd_seq_json(uint8_t seq_number)
#endif
}
}
AudioInterrupts();
return (false);
}

@ -46,6 +46,9 @@ typedef struct drum_config_s {
enum {DRUM_NONE, DRUM_BASS, DRUM_SNARE, DRUM_HIHAT, DRUM_HANDCLAP, DRUM_RIDE, DRUM_CHRASH, DRUM_LOWTOM, DRUM_MIDTOM, DRUM_HIGHTOM, DRUM_PERCUSSION};
// DEFAULT MIDI CHANNEL FOR SAMPLEDRUMS
uint8_t drum_midi_channel=10;
#define NUM_DRUMSET_CONFIG 20
drum_config_t drum_config[NUM_DRUMSET_CONFIG] =
{

@ -7,6 +7,7 @@
extern LCDMenuLib2 LCDML;
extern LiquidCrystal_I2C lcd;
extern config_t configuration;
extern uint8_t drum_midi_channel;
extern void handleNoteOn(byte , byte , byte );
extern void handleNoteOff(byte , byte , byte );
extern void UI_func_sequencer(uint8_t);
@ -38,7 +39,7 @@ void sequencer_part1(void)
if ( seq_track_type[d] == 0) { // drum track
if (seq_data[ seq_patternchain[seq_chain_active_step][d] ][seq_step] > 0 )
{
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_data[ seq_patternchain[seq_chain_active_step][d] ][seq_step] , seq_vel[ seq_patternchain[seq_chain_active_step][d] ][seq_step]);
}
}
else {
@ -61,16 +62,17 @@ void sequencer_part1(void)
{
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_prev_note[d] = seq_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_note[d] = seq_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];
}
}
if (seq_track_type[d] == 3) { //Arp
arp_step = 0;
arp_counter = 0;
arp_note = seq_data[ seq_patternchain[seq_chain_active_step][d] ][seq_step] + (seq_oct_shift * 12);
if (seq_vel[seq_patternchain[seq_chain_active_step][d] ][seq_step] - 200 >= 0)
arp_chord = seq_vel[seq_patternchain[seq_chain_active_step][d] ][seq_step] - 200;
// if (seq_vel[seq_patternchain[seq_chain_active_step][d] ][seq_step] - 200 >= 0)
arp_chord = seq_vel[seq_patternchain[seq_chain_active_step][d] ][seq_step] - 200;
}
}
@ -80,23 +82,21 @@ void sequencer_part1(void)
if (arp_speed == 0 || (arp_speed == 1 && arp_counter == 0) ) {
{ if (arp_style == 0) { //arp up
handleNoteOn(configuration.dexed[seq_chord_dexed_inst].midi_channel, arp_note + seq_arps[arp_chord][arp_step + seq_element_shift] , seq_chord_velocity);
handleNoteOn(configuration.dexed[seq_chord_dexed_inst].midi_channel, arp_note + seq_arps[arp_chord][arp_step + seq_element_shift], seq_chord_velocity);
arp_note_prev = arp_note + seq_arps[arp_chord][arp_step + seq_element_shift] ;
}
else if (arp_style == 1) { //arp down
handleNoteOn(configuration.dexed[seq_chord_dexed_inst].midi_channel, arp_note + seq_arps[arp_chord][10 - arp_step + seq_element_shift] , seq_chord_velocity);
arp_note_prev = arp_note + seq_arps[arp_chord][10 - arp_step + seq_element_shift] ;
handleNoteOn(configuration.dexed[seq_chord_dexed_inst].midi_channel, arp_note + seq_arps[arp_chord][arp_lenght - arp_step + seq_element_shift], seq_chord_velocity);
arp_note_prev = arp_note + seq_arps[arp_chord][arp_lenght - arp_step + seq_element_shift] ;
}
else if (arp_style == 2) { //arp up & down
if (seq_step < arp_lenght) {
handleNoteOn(configuration.dexed[seq_chord_dexed_inst].midi_channel, arp_note + seq_arps[arp_chord][arp_step+1] , seq_chord_velocity);
arp_note_prev = arp_note + seq_arps[arp_chord][arp_step +1] ;
if (arp_step <= arp_lenght) {
handleNoteOn(configuration.dexed[seq_chord_dexed_inst].midi_channel, arp_note + seq_arps[arp_chord][arp_step ], seq_chord_velocity);
arp_note_prev = arp_note + seq_arps[arp_chord][arp_step ] ;
}
else {
handleNoteOn(configuration.dexed[seq_chord_dexed_inst].midi_channel, arp_note + seq_arps[arp_chord][arp_lenght*2-2 - arp_step ] , seq_chord_velocity);
arp_note_prev = arp_note + seq_arps[arp_chord][arp_lenght*2- - arp_step ] ;
handleNoteOn(configuration.dexed[seq_chord_dexed_inst].midi_channel, arp_note + seq_arps[arp_chord][arp_lenght * 2 - arp_step ], seq_chord_velocity);
arp_note_prev = arp_note + seq_arps[arp_chord][arp_lenght * 2 - arp_step ] ;
}
}
else if (arp_style == 3) { //arp random
@ -118,26 +118,28 @@ void sequencer_part1(void)
}
else
{
if (arp_speed == 1) // Arp Speed 1/8
{
if (arp_counter > 1) {
arp_counter = 0;
arp_step++;
}
// Arp Speed 1/8
if (arp_counter > 1) {
arp_counter = 0;
arp_step++;
}
}
if (arp_style != 2){
if (arp_style != 2) {
if ( (arp_step > 1 && seq_arps[arp_chord][arp_step] == 0) || arp_step == arp_lenght)
{
arp_step = 0;
}
}
else
if (arp_style == 1 || arp_style == 2 )
{
if (arp_lenght == 0)arp_lenght = 9;
{
if ( (arp_step > 1 && seq_arps[arp_chord][arp_step] == 0) || arp_step == arp_lenght*2)
}
if ( arp_style == 2 ) //only for up&down
{
if ( (arp_step > 1 && seq_arps[arp_chord][arp_step] == 0) || arp_step == arp_lenght * 2)
{
arp_step = 0;
}
@ -165,7 +167,7 @@ void sequencer_part2(void)
{
handleNoteOff(configuration.dexed[seq_inst_dexed[d]].midi_channel, seq_prev_note[d] , 0);
if (seq_track_type[d] == 2) { //Chords
if ( seq_prev_vel[d] > 199) {
if ( seq_prev_vel[d] > 199) {
for (uint8_t x = seq_element_shift; x < seq_element_shift + seq_chord_key_ammount; x++) //play chord notes
{
handleNoteOff(configuration.dexed[seq_chord_dexed_inst].midi_channel, seq_prev_note[d] + seq_arps[seq_prev_vel[d] - 200][x], 0);

Loading…
Cancel
Save