Several fixes.

Several additions for multi-instances of MicroDexed (may cause problems).
pull/15/head
Holger Wirtz 5 years ago
parent ec58659db8
commit 9d72cc2a3a
  1. 406
      MicroDexed.ino
  2. 384
      UI.hpp
  3. 55
      config.h

@ -117,7 +117,7 @@ AudioOutputAnalogStereo dacOut;
AudioConnection patchCord32(stereomono1, 0, dacOut, 0); AudioConnection patchCord32(stereomono1, 0, dacOut, 0);
AudioConnection patchCord33(stereomono1, 1, dacOut, 1); AudioConnection patchCord33(stereomono1, 1, dacOut, 1);
#endif #endif
AudioConnection * dynamicConnections[NUM_DEXED * 7]; AudioConnection * dynamicConnections[NUM_DEXED * 6];
int nDynamic = 0; int nDynamic = 0;
void create_audio_connections(AudioSourceMicroDexed &d) void create_audio_connections(AudioSourceMicroDexed &d)
@ -183,21 +183,26 @@ void change_disp_sd(bool disp)
void setup() void setup()
{ {
//while (!Serial) ; // wait for Arduino Serial Monitor // Start audio system
AudioNoInterrupts();
AudioMemory(AUDIO_MEM);
Serial.begin(SERIAL_SPEED); Serial.begin(SERIAL_SPEED);
//while (!Serial) ; // wait for Serial Monitor
#ifdef DISPLAY_LCD_SPI #ifdef DISPLAY_LCD_SPI
pinMode(SDCARD_CS_PIN, OUTPUT); pinMode(SDCARD_CS_PIN, OUTPUT);
pinMode(U8X8_CS_PIN, OUTPUT); pinMode(U8X8_CS_PIN, OUTPUT);
#endif #endif
delay(220); // necessary, because before this time no serial output is done :(
#ifdef ENABLE_LCD_UI #ifdef ENABLE_LCD_UI
setup_ui(); setup_ui();
#else #else
Serial.println(F("NO LCD DISPLAY ENABLED!")); Serial.println(F("NO LCD DISPLAY ENABLED!"));
#endif #endif
delay(220); // necessary, because before this time no serial output is done :(
Serial.println(F("MicroDexed based on https://github.com/asb2m10/dexed")); Serial.println(F("MicroDexed based on https://github.com/asb2m10/dexed"));
Serial.println(F("(c)2018,2019 H. Wirtz <wirtz@parasitstudio.de>")); Serial.println(F("(c)2018,2019 H. Wirtz <wirtz@parasitstudio.de>"));
Serial.println(F("https://codeberg.org/dcoredump/MicroDexed")); Serial.println(F("https://codeberg.org/dcoredump/MicroDexed"));
@ -205,24 +210,33 @@ void setup()
Serial.println(VERSION); Serial.println(VERSION);
Serial.println(F("<setup start>")); Serial.println(F("<setup start>"));
setup_midi_devices();
for (uint8_t i = 0; i < NUM_DEXED; i++) for (uint8_t i = 0; i < NUM_DEXED; i++)
{ {
Serial.print(F("Creating MicroDexed engine ")); AudioSourceMicroDexed* microdexed;
Serial.println(i, DEC);
MicroDexed[i] = new AudioSourceMicroDexed(SAMPLE_RATE);
if (MicroDexed[i] == NULL) {
Serial.print(F("Unable to create MicroDexed engine!"));
}
create_audio_connections(*MicroDexed[i]);
}
initial_values_from_eeprom();
setup_midi_devices(); Serial.print(F("Creating MicroDexed instance "));
Serial.print(i, DEC);
microdexed = new AudioSourceMicroDexed(SAMPLE_RATE);
create_audio_connections(*microdexed);
MicroDexed[i] = microdexed;
Serial.println(F("... created"));
}
// start audio card // Init EEPROM if both buttons are pressed at startup
AudioNoInterrupts(); /* if (digitalRead(BUT_R_PIN) == LOW)
AudioMemory(AUDIO_MEM); {
Serial.println(F("Init EEPROM"));
lcd.clear();
lcd.setCursor(0, 0);
lcd.print(F("INIT"));
lcd.setCursor(0, 1);
lcd.print(F("EEPROM"));
initial_values_from_eeprom(true);
}
else*/
initial_values_from_eeprom(true);
#if defined(TEENSY_AUDIO_BOARD) #if defined(TEENSY_AUDIO_BOARD)
sgtl5000_1.enable(); sgtl5000_1.enable();
@ -293,13 +307,13 @@ void setup()
{ {
// read all bank names // read all bank names
max_loaded_banks = get_bank_names(instance_id); max_loaded_banks = get_bank_names(instance_id);
strip_extension(bank_names[instance_id][configuration.bank[instance_id]], bank_name[instance_id]); strip_extension(bank_names[instance_id][configuration.dexed[instance_id].bank], bank_name[instance_id]);
// read all voice name for actual bank // read all voice name for actual bank
get_voice_names_from_bank(configuration.bank[instance_id], instance_id); get_voice_names_from_bank(configuration.dexed[instance_id].bank, instance_id);
#ifdef DEBUG #ifdef DEBUG
Serial.print(F("Bank [")); Serial.print(F("Bank ["));
Serial.print(bank_names[instance_id][configuration.bank[instance_id]]); Serial.print(bank_names[instance_id][configuration.dexed[instance_id].bank]);
Serial.print(F("/")); Serial.print(F("/"));
Serial.print(bank_name[instance_id]); Serial.print(bank_name[instance_id]);
Serial.println(F("]")); Serial.println(F("]"));
@ -316,7 +330,7 @@ void setup()
#endif #endif
// load default SYSEX data // load default SYSEX data
load_sysex(configuration.bank[0], configuration.voice[0], instance_id); load_sysex(configuration.dexed[instance_id].bank, configuration.dexed[instance_id].voice, instance_id);
} }
} }
@ -341,8 +355,11 @@ void setup()
// INIT REVERB // INIT REVERB
freeverbs1.roomsize(mapfloat(configuration.reverb_roomsize, REVERB_ROOMSIZE_MIN, REVERB_ROOMSIZE_MAX, 0.0, 1.0)); freeverbs1.roomsize(mapfloat(configuration.reverb_roomsize, REVERB_ROOMSIZE_MIN, REVERB_ROOMSIZE_MAX, 0.0, 1.0));
freeverbs1.damping(mapfloat(configuration.reverb_damping, REVERB_DAMPING_MIN, REVERB_DAMPING_MAX, 0.0, 1.0)); freeverbs1.damping(mapfloat(configuration.reverb_damping, REVERB_DAMPING_MIN, REVERB_DAMPING_MAX, 0.0, 1.0));
master_mixer_r.gain(REVERB, mapfloat(configuration.reverb_level[0], REVERB_LEVEL_MIN, REVERB_LEVEL_MAX, 0.0, 1.0)); for (uint8_t instance_id = 0; instance_id < NUM_DEXED; instance_id++)
master_mixer_l.gain(REVERB, mapfloat(configuration.reverb_level[0], REVERB_LEVEL_MIN, REVERB_LEVEL_MAX, 0.0, 1.0)); {
master_mixer_r.gain(REVERB, mapfloat(configuration.dexed[instance_id].reverb_level, REVERB_LEVEL_MIN, REVERB_LEVEL_MAX, 0.0, 1.0));
master_mixer_l.gain(REVERB, mapfloat(configuration.dexed[instance_id].reverb_level, REVERB_LEVEL_MIN, REVERB_LEVEL_MAX, 0.0, 1.0));
}
#endif #endif
// INIT DELAY // INIT DELAY
@ -351,8 +368,11 @@ void setup()
//delay_fb_mixer.gain(0, 1.0 - (mapfloat(configuration.delay_feedback, DELAY_FEEDBACK_MIN, DELAY_FEEDBACK_MAX, 0.0, 1.0))); // original signal //delay_fb_mixer.gain(0, 1.0 - (mapfloat(configuration.delay_feedback, DELAY_FEEDBACK_MIN, DELAY_FEEDBACK_MAX, 0.0, 1.0))); // original signal
delay_fb_mixer.gain(0, 1.0); // original signal delay_fb_mixer.gain(0, 1.0); // original signal
delay_fb_mixer.gain(1, mapfloat(configuration.delay_feedback, DELAY_FEEDBACK_MIN, DELAY_FEEDBACK_MAX, 0.0, 1.0)); // amount of feedback delay_fb_mixer.gain(1, mapfloat(configuration.delay_feedback, DELAY_FEEDBACK_MIN, DELAY_FEEDBACK_MAX, 0.0, 1.0)); // amount of feedback
master_mixer_r.gain(DELAY, mapfloat(configuration.delay_level[0], DELAY_LEVEL_MIN, DELAY_LEVEL_MAX, 0.0, 1.0)); for (uint8_t instance_id = 0; instance_id < NUM_DEXED; instance_id++)
master_mixer_l.gain(DELAY, mapfloat(configuration.delay_level[0], DELAY_LEVEL_MIN, DELAY_LEVEL_MAX, 0.0, 1.0)); {
master_mixer_r.gain(DELAY, mapfloat(configuration.dexed[instance_id].delay_level, DELAY_LEVEL_MIN, DELAY_LEVEL_MAX, 0.0, 1.0));
master_mixer_l.gain(DELAY, mapfloat(configuration.dexed[instance_id].delay_level, DELAY_LEVEL_MIN, DELAY_LEVEL_MAX, 0.0, 1.0));
}
// INIT CHORUS // INIT CHORUS
switch (configuration.chorus_waveform) switch (configuration.chorus_waveform)
@ -383,21 +403,24 @@ void setup()
modchorus_inverter.gain(-1.0); // stereo mode modchorus_inverter.gain(-1.0); // stereo mode
else else
modchorus_inverter.gain(1.0); // mono mode modchorus_inverter.gain(1.0); // mono mode
master_mixer_r.gain(CHORUS, mapfloat(configuration.chorus_level[0], CHORUS_LEVEL_MIN, CHORUS_LEVEL_MAX, 0.0, 1.0)); for (uint8_t instance_id = 0; instance_id < NUM_DEXED; instance_id++)
master_mixer_l.gain(CHORUS, mapfloat(configuration.chorus_level[0], CHORUS_LEVEL_MIN, CHORUS_LEVEL_MAX, 0.0, 1.0));
for (uint8_t i = 0; i < NUM_DEXED; i++)
{ {
soften_filter_res[i].init(configuration.filter_resonance[i]); master_mixer_r.gain(CHORUS, mapfloat(configuration.dexed[instance_id].chorus_level, CHORUS_LEVEL_MIN, CHORUS_LEVEL_MAX, 0.0, 1.0));
soften_filter_cut[i].init(configuration.filter_cutoff[i]); master_mixer_l.gain(CHORUS, mapfloat(configuration.dexed[instance_id].chorus_level, CHORUS_LEVEL_MIN, CHORUS_LEVEL_MAX, 0.0, 1.0));
MicroDexed[i]->fx.Gain = mapfloat(configuration.loudness[i], LOUDNESS_MIN, LOUDNESS_MAX, 0.0, 1.0);
MicroDexed[i]->fx.Reso = mapfloat(configuration.filter_resonance[i], FILTER_RESONANCE_MIN, FILTER_RESONANCE_MAX, 0.0, 1.0); soften_filter_res[instance_id].init(configuration.dexed[instance_id].filter_resonance);
MicroDexed[i]->fx.Cutoff = mapfloat(configuration.filter_cutoff[i], FILTER_CUTOFF_MIN, FILTER_CUTOFF_MAX, 0.0, 1.0); soften_filter_cut[instance_id].init(configuration.dexed[instance_id].filter_cutoff);
MicroDexed[i]->doRefreshVoice(); MicroDexed[instance_id]->fx.Gain = mapfloat(configuration.dexed[instance_id].loudness, LOUDNESS_MIN, LOUDNESS_MAX, 0.0, 1.0);
MicroDexed[instance_id]->fx.Reso = mapfloat(configuration.dexed[instance_id].filter_resonance, FILTER_RESONANCE_MIN, FILTER_RESONANCE_MAX, 0.0, 1.0);
MicroDexed[instance_id]->fx.Cutoff = mapfloat(configuration.dexed[instance_id].filter_cutoff, FILTER_CUTOFF_MIN, FILTER_CUTOFF_MAX, 0.0, 1.0);
MicroDexed[instance_id]->doRefreshVoice();
} }
// set initial volume and pan (read from EEPROM) // set initial volume and pan (read from EEPROM)
set_volume(configuration.vol, configuration.pan[0], configuration.mono); for (uint8_t instance_id = 0; instance_id < NUM_DEXED; instance_id++)
{
set_volume(configuration.vol, configuration.dexed[instance_id].pan, configuration.mono);
}
soften_volume.init(configuration.vol); soften_volume.init(configuration.vol);
#if defined (DEBUG) && defined (SHOW_CPU_LOAD_MSEC) #if defined (DEBUG) && defined (SHOW_CPU_LOAD_MSEC)
@ -410,9 +433,9 @@ void setup()
{ {
#ifdef DEBUG #ifdef DEBUG
Serial.print(F("Bank/Voice from EEPROM [")); Serial.print(F("Bank/Voice from EEPROM ["));
Serial.print(configuration.bank[instance_id], DEC); Serial.print(configuration.dexed[instance_id].bank, DEC);
Serial.print(F("/")); Serial.print(F("/"));
Serial.print(configuration.voice[instance_id], DEC); Serial.print(configuration.dexed[instance_id].voice, DEC);
Serial.println(F("]")); Serial.println(F("]"));
show_patch(instance_id); show_patch(instance_id);
#endif #endif
@ -534,7 +557,10 @@ void loop()
} }
if (soften_volume.running()) if (soften_volume.running())
{ {
set_volume(soften_volume.value(), configuration.pan[0], configuration.mono); for (uint8_t instance_id = 0; instance_id < NUM_DEXED; instance_id++)
{
set_volume(soften_volume.value(), configuration.dexed[instance_id].pan, configuration.mono);
}
#ifdef DEBUG #ifdef DEBUG
Serial.print(F("Volume: ")); Serial.print(F("Volume: "));
Serial.print(configuration.vol, DEC); Serial.print(configuration.vol, DEC);
@ -605,7 +631,7 @@ void handleControlChange(byte inChannel, byte inCtrl, byte inValue)
case 0: case 0:
if (inValue < MAX_BANKS) if (inValue < MAX_BANKS)
{ {
configuration.bank[instance_id] = inValue; configuration.dexed[instance_id].bank = inValue;
} }
break; break;
case 1: case 1:
@ -625,11 +651,11 @@ void handleControlChange(byte inChannel, byte inCtrl, byte inValue)
soften_volume.update(configuration.vol, SOFTEN_VALUE_CHANGE_STEPS); soften_volume.update(configuration.vol, SOFTEN_VALUE_CHANGE_STEPS);
break; break;
case 10: // Pan case 10: // Pan
configuration.pan[instance_id] = map(inValue, 0, 0x7f, PANORAMA_MIN, PANORAMA_MAX); configuration.dexed[instance_id].pan = map(inValue, 0, 0x7f, PANORAMA_MIN, PANORAMA_MAX);
set_volume(configuration.vol, configuration.pan[instance_id], configuration.mono); set_volume(configuration.vol, configuration.dexed[instance_id].pan, configuration.mono);
break; break;
case 32: // BankSelect LSB case 32: // BankSelect LSB
configuration.bank[instance_id] = inValue; configuration.dexed[instance_id].bank = inValue;
break; break;
case 64: case 64:
MicroDexed[instance_id]->setSustain(inValue > 63); MicroDexed[instance_id]->setSustain(inValue > 63);
@ -643,12 +669,12 @@ void handleControlChange(byte inChannel, byte inCtrl, byte inValue)
} }
break; break;
case 103: // CC 103: filter resonance case 103: // CC 103: filter resonance
configuration.filter_resonance[instance_id] = map(inValue, 0, 0x7f, FILTER_RESONANCE_MIN, FILTER_RESONANCE_MAX); configuration.dexed[instance_id].filter_resonance = map(inValue, 0, 0x7f, FILTER_RESONANCE_MIN, FILTER_RESONANCE_MAX);
MicroDexed[instance_id]->fx.Reso = configuration.filter_resonance[instance_id] / 100.0; MicroDexed[instance_id]->fx.Reso = configuration.dexed[instance_id].filter_resonance / 100.0;
break; break;
case 104: // CC 104: filter cutoff case 104: // CC 104: filter cutoff
configuration.filter_cutoff[instance_id] = map(inValue, 0, 0x7f, FILTER_CUTOFF_MIN, FILTER_CUTOFF_MAX); configuration.dexed[instance_id].filter_cutoff = map(inValue, 0, 0x7f, FILTER_CUTOFF_MIN, FILTER_CUTOFF_MAX);
MicroDexed[instance_id]->fx.Cutoff = configuration.filter_cutoff[instance_id] / 100.0; MicroDexed[instance_id]->fx.Cutoff = configuration.dexed[instance_id].filter_cutoff / 100.0;
break; break;
case 105: // CC 105: delay time case 105: // CC 105: delay time
configuration.delay_time = map(inValue, 0, 0x7f, DELAY_TIME_MIN, DELAY_TIME_MAX); configuration.delay_time = map(inValue, 0, 0x7f, DELAY_TIME_MIN, DELAY_TIME_MAX);
@ -659,9 +685,9 @@ void handleControlChange(byte inChannel, byte inCtrl, byte inValue)
delay_fb_mixer.gain(0, 1.0 - configuration.delay_feedback / 100.0); // original signalbreak; delay_fb_mixer.gain(0, 1.0 - configuration.delay_feedback / 100.0); // original signalbreak;
break; break;
case 107: // CC 107: delay volume case 107: // CC 107: delay volume
configuration.delay_level[instance_id] = map(inValue, 0, 0x7f, DELAY_LEVEL_MIN, DELAY_LEVEL_MAX); configuration.dexed[instance_id].delay_level = map(inValue, 0, 0x7f, DELAY_LEVEL_MIN, DELAY_LEVEL_MAX);
master_mixer_r.gain(DELAY, configuration.delay_level[instance_id] / 100.0); master_mixer_r.gain(DELAY, configuration.dexed[instance_id].delay_level / 100.0);
master_mixer_l.gain(2, configuration.delay_level[instance_id] / 100.0); master_mixer_l.gain(2, configuration.dexed[instance_id].delay_level / 100.0);
break; break;
case 120: case 120:
MicroDexed[instance_id]->panic(); MicroDexed[instance_id]->panic();
@ -717,7 +743,7 @@ void handleProgramChange(byte inChannel, byte inProgram)
#ifdef DISPLAY_LCD_SPI #ifdef DISPLAY_LCD_SPI
change_disp_sd(false); change_disp_sd(false);
#endif #endif
load_sysex(configuration.bank[instance_id], inProgram, instance_id); load_sysex(configuration.dexed[instance_id].bank, inProgram, instance_id);
#ifdef DISPLAY_LCD_SPI #ifdef DISPLAY_LCD_SPI
change_disp_sd(true); change_disp_sd(true);
#endif #endif
@ -992,11 +1018,11 @@ void handleSystemReset(void)
bool checkMidiChannel(byte inChannel, uint8_t instance_id) bool checkMidiChannel(byte inChannel, uint8_t instance_id)
{ {
// check for MIDI channel // check for MIDI channel
if (configuration.midi_channel[instance_id] == MIDI_CHANNEL_OMNI) if (configuration.dexed[instance_id].midi_channel == MIDI_CHANNEL_OMNI)
{ {
return (true); return (true);
} }
else if (inChannel != configuration.midi_channel[instance_id]) else if (inChannel != configuration.dexed[instance_id].midi_channel)
{ {
#ifdef DEBUG #ifdef DEBUG
Serial.print(F("INSTANCE ")); Serial.print(F("INSTANCE "));
@ -1004,7 +1030,7 @@ bool checkMidiChannel(byte inChannel, uint8_t instance_id)
Serial.print(F(": Ignoring MIDI data on channel ")); Serial.print(F(": Ignoring MIDI data on channel "));
Serial.print(inChannel); Serial.print(inChannel);
Serial.print(F("(listening on ")); Serial.print(F("(listening on "));
Serial.print(configuration.midi_channel[instance_id]); Serial.print(configuration.dexed[instance_id].midi_channel);
Serial.println(F(")")); Serial.println(F(")"));
#endif #endif
return (false); return (false);
@ -1018,12 +1044,21 @@ bool checkMidiChannel(byte inChannel, uint8_t instance_id)
void set_volume(uint8_t v, int8_t p, uint8_t m) void set_volume(uint8_t v, int8_t p, uint8_t m)
{ {
float tmp2;
configuration.vol = v; configuration.vol = v;
configuration.pan[0] = p; //configuration.dexed[instance_id].pan = p; // TODO: Fixing pan per Dexed
for (uint8_t instance_id = 0; instance_id < NUM_DEXED; instance_id++)
{
configuration.dexed[instance_id].pan = p;
}
configuration.mono = m; configuration.mono = m;
uint16_t tmp = v / 100.0 * 1023.0 + 0.5; uint16_t tmp = v / 100.0 * 1023.0 + 0.5;
float tmp2 = mapfloat(configuration.pan[0], PANORAMA_MIN, PANORAMA_MAX, 0.0, 1.0); for (uint8_t instance_id = 0; instance_id < NUM_DEXED; instance_id++)
{
tmp2 = mapfloat(configuration.dexed[instance_id].pan, PANORAMA_MIN, PANORAMA_MAX, 0.0, 1.0);
}
float tmp3 = (float)(tmp * (tmp + 2)) / (float)(1 << 20); float tmp3 = (float)(tmp * (tmp + 2)) / (float)(1 << 20);
#ifdef DEBUG #ifdef DEBUG
@ -1054,19 +1089,28 @@ void set_volume(uint8_t v, int8_t p, uint8_t m)
break; break;
case 1: // mono both case 1: // mono both
stereomono1.stereo(false); stereomono1.stereo(false);
configuration.pan[0] = 0.5; for (uint8_t instance_id = 0; instance_id < NUM_DEXED; instance_id++)
{
configuration.dexed[instance_id].pan = 0.5;
}
modchorus_inverter.gain(1.0); // stereo mode modchorus_inverter.gain(1.0); // stereo mode
break; break;
case 2: // mono right case 2: // mono right
volume_l.gain(0.0); volume_l.gain(0.0);
stereomono1.stereo(false); stereomono1.stereo(false);
configuration.pan[0] = 0.5; for (uint8_t instance_id = 0; instance_id < NUM_DEXED; instance_id++)
{
configuration.dexed[instance_id].pan = 0.5;
}
modchorus_inverter.gain(1.0); // stereo mode modchorus_inverter.gain(1.0); // stereo mode
break; break;
case 3: // mono left case 3: // mono left
volume_r.gain(0.0); volume_r.gain(0.0);
stereomono1.stereo(false); stereomono1.stereo(false);
configuration.pan[0] = 0.5; for (uint8_t instance_id = 0; instance_id < NUM_DEXED; instance_id++)
{
configuration.dexed[instance_id].pan = 0.5;
}
modchorus_inverter.gain(1.0); // stereo mode modchorus_inverter.gain(1.0); // stereo mode
break; break;
} }
@ -1082,11 +1126,15 @@ inline float logvol(float x)
EEPROM HELPER EEPROM HELPER
******************************************************************************/ ******************************************************************************/
void initial_values_from_eeprom(void) void initial_values_from_eeprom(bool init)
{ {
uint32_t checksum; uint32_t checksum;
config_t tmp_conf; config_t tmp_conf;
if (init == true)
init_configuration();
else
{
EEPROM_readAnything(EEPROM_START_ADDRESS, tmp_conf); EEPROM_readAnything(EEPROM_START_ADDRESS, tmp_conf);
checksum = crc32((byte*)&tmp_conf + 4, sizeof(tmp_conf) - 4); checksum = crc32((byte*)&tmp_conf + 4, sizeof(tmp_conf) - 4);
@ -1102,6 +1150,73 @@ void initial_values_from_eeprom(void)
#ifdef DEBUG #ifdef DEBUG
Serial.println(F("Checksum mismatch -> initializing EEPROM!")); Serial.println(F("Checksum mismatch -> initializing EEPROM!"));
#endif #endif
init_configuration();
}
else
{
/*
configuration.instances = INSTANCES_MAX;
configuration.instance_mode = INSTANCE_MODE_MAX;
configuration.instance_splitpoint = INSTANCE_SPLITPOINT_MAX;
configuration.vol = VOLUME_MAX;
configuration.mono = MONO_MAX;
configuration.reverb_roomsize = REVERB_ROOMSIZE_MAX;
configuration.reverb_damping = REVERB_DAMPING_MAX;
configuration.chorus_frequency = CHORUS_FREQUENCY_MAX;
configuration.chorus_waveform = CHORUS_WAVEFORM_MAX;
configuration.chorus_depth = CHORUS_DEPTH_MAX;
configuration.delay_time = DELAY_TIME_MAX;
configuration.delay_feedback = DELAY_FEEDBACK_MAX; */
for (uint8_t instance_id = 0; instance_id < NUM_DEXED; instance_id++)
{
/*
configuration.dexed[instance_id].midi_channel = MIDI_CHANNEL_MAX;
configuration.dexed[instance_id].bank = MAX_BANKS;
configuration.dexed[instance_id].voice = MAX_VOICES;
configuration.dexed[instance_id].pan = PANORAMA_MAX;
configuration.dexed[instance_id].reverb_level = REVERB_LEVEL_MAX;
configuration.dexed[instance_id].chorus_level = CHORUS_LEVEL_MAX;
configuration.dexed[instance_id].delay_level = DELAY_LEVEL_MAX;
configuration.dexed[instance_id].filter_cutoff = FILTER_CUTOFF_MAX;
configuration.dexed[instance_id].filter_resonance = FILTER_RESONANCE_MAX;
configuration.dexed[instance_id].loudness = LOUDNESS_MAX;
configuration.dexed[instance_id].polyphony = POLYPHONY_MAX;
configuration.dexed[instance_id].engine = ENGINE_MAX;
configuration.dexed[instance_id].monopoly = MONOPOLY_MAX;
configuration.dexed[instance_id].pb_range = PB_RANGE_MAX;
configuration.dexed[instance_id].pb_step = PB_STEP_MAX;
configuration.dexed[instance_id].mw_range = MW_RANGE_MAX;
configuration.dexed[instance_id].mw_assign = MW_ASSIGN_MAX;
configuration.dexed[instance_id].fc_range = FC_RANGE_MAX;
configuration.dexed[instance_id].fc_assign = FC_ASSIGN_MAX;
configuration.dexed[instance_id].bc_range = BC_RANGE_MAX;
configuration.dexed[instance_id].bc_assign = BC_ASSIGN_MAX;
configuration.dexed[instance_id].at_range = AT_RANGE_MAX;
configuration.dexed[instance_id].at_assign = AT_ASSIGN_MAX;
configuration.dexed[instance_id].op_enabled = 0x3f; */
MicroDexed[instance_id]->setPBController(configuration.dexed[instance_id].pb_range, configuration.dexed[instance_id].pb_step);
MicroDexed[instance_id]->setMWController(configuration.dexed[instance_id].mw_range, configuration.dexed[instance_id].mw_assign);
MicroDexed[instance_id]->setFCController(configuration.dexed[instance_id].fc_range, configuration.dexed[instance_id].fc_assign);
MicroDexed[instance_id]->setBCController(configuration.dexed[instance_id].bc_range, configuration.dexed[instance_id].bc_assign);
MicroDexed[instance_id]->setATController(configuration.dexed[instance_id].at_range, configuration.dexed[instance_id].at_assign);
MicroDexed[instance_id]-> setOPs(configuration.dexed[instance_id].op_enabled);
}
Serial.println(F("OK, loaded!"));
}
}
#ifdef DEBUG
show_configuration();
#endif
if (configuration.vol > 100)
configuration.vol = 100;
}
void init_configuration(void)
{
configuration.checksum = 0xffff; configuration.checksum = 0xffff;
configuration.instances = INSTANCES_DEFAULT; configuration.instances = INSTANCES_DEFAULT;
@ -1116,95 +1231,33 @@ void initial_values_from_eeprom(void)
configuration.chorus_depth = CHORUS_DEPTH_DEFAULT; configuration.chorus_depth = CHORUS_DEPTH_DEFAULT;
configuration.delay_time = DELAY_TIME_DEFAULT; configuration.delay_time = DELAY_TIME_DEFAULT;
configuration.delay_feedback = DELAY_FEEDBACK_DEFAULT; configuration.delay_feedback = DELAY_FEEDBACK_DEFAULT;
for (uint8_t i = 0; i < NUM_DEXED; i++) for (uint8_t instance_id = 0; instance_id < NUM_DEXED; instance_id++)
{
configuration.midi_channel[i] = DEFAULT_MIDI_CHANNEL;
configuration.bank[i] = SYSEXBANK_DEFAULT;
configuration.voice[i] = SYSEXSOUND_DEFAULT;
configuration.pan[i] = PANORAMA_DEFAULT;
configuration.reverb_level[i] = REVERB_LEVEL_DEFAULT;
configuration.chorus_level[i] = CHORUS_LEVEL_DEFAULT;
configuration.delay_level[i] = DELAY_LEVEL_DEFAULT;
configuration.filter_cutoff[i] = FILTER_CUTOFF_DEFAULT;
configuration.filter_resonance[i] = FILTER_RESONANCE_DEFAULT;
configuration.loudness[i] = LOUDNESS_DEFAULT;
configuration.polyphony[i] = POLYPHONY_DEFAULT;
configuration.engine[i] = ENGINE_DEFAULT;
configuration.monopoly[i] = MONOPOLY_DEFAULT;
configuration.pb_range[i] = PB_RANGE_DEFAULT;
configuration.pb_step[i] = PB_STEP_DEFAULT;
configuration.mw_range[i] = MW_RANGE_DEFAULT;
configuration.mw_assign[i] = MW_ASSIGN_DEFAULT;
configuration.fc_range[i] = FC_RANGE_DEFAULT;
configuration.fc_assign[i] = FC_ASSIGN_DEFAULT;
configuration.bc_range[i] = BC_RANGE_DEFAULT;
configuration.bc_assign[i] = BC_ASSIGN_DEFAULT;
configuration.at_range[i] = AT_RANGE_DEFAULT;
configuration.at_assign[i] = AT_ASSIGN_DEFAULT;
configuration.op_enabled[i] = OP_ENABLED_DEFAULT;
}
}
else
{
EEPROM_readAnything(EEPROM_START_ADDRESS, configuration);
configuration.instances %= INSTANCES_MAX;
configuration.instance_mode %= INSTANCE_MODE_MAX;
configuration.instance_splitpoint %= INSTANCE_SPLITPOINT_MAX;
configuration.vol %= VOLUME_MAX;
configuration.mono %= MONO_MAX;
configuration.reverb_roomsize %= REVERB_ROOMSIZE_MAX;
configuration.reverb_damping %= REVERB_DAMPING_MAX;
configuration.chorus_frequency %= CHORUS_FREQUENCY_MAX;
configuration.chorus_waveform %= CHORUS_WAVEFORM_MAX;
configuration.chorus_depth %= CHORUS_DEPTH_MAX;
configuration.delay_time %= DELAY_TIME_MAX;
configuration.delay_feedback %= DELAY_FEEDBACK_MAX;
for (uint8_t i = 0; i < NUM_DEXED; i++)
{ {
configuration.midi_channel[i] %= MIDI_CHANNEL_MAX; configuration.dexed[instance_id].midi_channel = DEFAULT_MIDI_CHANNEL;
configuration.bank[i] %= MAX_BANKS; configuration.dexed[instance_id].bank = SYSEXBANK_DEFAULT;
configuration.voice[i] %= MAX_VOICES; configuration.dexed[instance_id].voice = SYSEXSOUND_DEFAULT;
configuration.pan[i] %= PANORAMA_MAX; configuration.dexed[instance_id].pan = PANORAMA_DEFAULT;
configuration.reverb_level[i] %= REVERB_LEVEL_MAX; configuration.dexed[instance_id].reverb_level = REVERB_LEVEL_DEFAULT;
configuration.chorus_level[i] %= CHORUS_LEVEL_MAX; configuration.dexed[instance_id].chorus_level = CHORUS_LEVEL_DEFAULT;
configuration.delay_level[i] %= DELAY_LEVEL_MAX; configuration.dexed[instance_id].delay_level = DELAY_LEVEL_DEFAULT;
configuration.filter_cutoff[i] %= FILTER_CUTOFF_MAX; configuration.dexed[instance_id].filter_cutoff = FILTER_CUTOFF_DEFAULT;
configuration.filter_resonance[i] %= FILTER_RESONANCE_MAX; configuration.dexed[instance_id].filter_resonance = FILTER_RESONANCE_DEFAULT;
configuration.loudness[i] %= LOUDNESS_MAX; configuration.dexed[instance_id].loudness = LOUDNESS_DEFAULT;
configuration.polyphony[i] %= POLYPHONY_MAX; configuration.dexed[instance_id].polyphony = POLYPHONY_DEFAULT;
configuration.engine[i] %= ENGINE_MAX; configuration.dexed[instance_id].engine = ENGINE_DEFAULT;
configuration.monopoly[i] %= MONOPOLY_MAX; configuration.dexed[instance_id].monopoly = MONOPOLY_DEFAULT;
configuration.pb_range[i] %= PB_RANGE_MAX; configuration.dexed[instance_id].pb_range = PB_RANGE_DEFAULT;
configuration.pb_step[i] %= PB_STEP_MAX; configuration.dexed[instance_id].pb_step = PB_STEP_DEFAULT;
configuration.mw_range[i] %= MW_RANGE_MAX; configuration.dexed[instance_id].mw_range = MW_RANGE_DEFAULT;
configuration.mw_assign[i] %= MW_ASSIGN_MAX; configuration.dexed[instance_id].mw_assign = MW_ASSIGN_DEFAULT;
configuration.fc_range[i] %= FC_RANGE_MAX; configuration.dexed[instance_id].fc_range = FC_RANGE_DEFAULT;
configuration.fc_assign[i] %= FC_ASSIGN_MAX; configuration.dexed[instance_id].fc_assign = FC_ASSIGN_DEFAULT;
configuration.bc_range[i] %= BC_RANGE_MAX; configuration.dexed[instance_id].bc_range = BC_RANGE_DEFAULT;
configuration.bc_assign[i] %= BC_ASSIGN_MAX; configuration.dexed[instance_id].bc_assign = BC_ASSIGN_DEFAULT;
configuration.at_range[i] %= AT_RANGE_MAX; configuration.dexed[instance_id].at_range = AT_RANGE_DEFAULT;
configuration.at_assign[i] %= AT_ASSIGN_MAX; configuration.dexed[instance_id].at_assign = AT_ASSIGN_DEFAULT;
configuration.op_enabled[i] %= 0x3f; configuration.dexed[instance_id].op_enabled = OP_ENABLED_DEFAULT;
MicroDexed[i]->setPBController(configuration.pb_range[i], configuration.pb_step[i]);
MicroDexed[i]->setMWController(configuration.mw_range[i], configuration.mw_assign[i]);
MicroDexed[i]->setFCController(configuration.fc_range[i], configuration.fc_assign[i]);
MicroDexed[i]->setBCController(configuration.bc_range[i], configuration.bc_assign[i]);
MicroDexed[i]->setATController(configuration.at_range[i], configuration.at_assign[i]);
MicroDexed[i]-> setOPs(configuration.op_enabled[i]);
} }
Serial.println(F("OK, loaded!"));
}
eeprom_update();
#ifdef DEBUG
show_configuration();
#endif
if (configuration.vol > 100)
configuration.vol = 100;
} }
void eeprom_write(void) void eeprom_write(void)
@ -1218,7 +1271,10 @@ void eeprom_update(void)
eeprom_update_flag = false; eeprom_update_flag = false;
configuration.checksum = crc32((byte*)&configuration + 4, sizeof(configuration) - 4); configuration.checksum = crc32((byte*)&configuration + 4, sizeof(configuration) - 4);
EEPROM_writeAnything(EEPROM_START_ADDRESS, configuration); EEPROM_writeAnything(EEPROM_START_ADDRESS, configuration);
Serial.println(F("Updating EEPROM with configuration data")); Serial.println(F("Updating EEPROM with configuration data:"));
#ifdef DEBUG
show_configuration();
#endif
} }
uint32_t crc32(byte * calc_start, uint16_t calc_bytes) // base code from https://www.arduino.cc/en/Tutorial/EEPROMCrc uint32_t crc32(byte * calc_start, uint16_t calc_bytes) // base code from https://www.arduino.cc/en/Tutorial/EEPROMCrc
@ -1304,35 +1360,35 @@ void show_configuration(void)
Serial.print(F("Chorus Depth ")); Serial.println(configuration.chorus_depth, DEC); Serial.print(F("Chorus Depth ")); Serial.println(configuration.chorus_depth, DEC);
Serial.print(F("Delay Time ")); Serial.println(configuration.delay_time, DEC); Serial.print(F("Delay Time ")); Serial.println(configuration.delay_time, DEC);
Serial.print(F("Delay Feedback ")); Serial.println(configuration.delay_feedback, DEC); Serial.print(F("Delay Feedback ")); Serial.println(configuration.delay_feedback, DEC);
for (uint8_t i = 0; i < NUM_DEXED; i++) for (uint8_t instance_id = 0; instance_id < NUM_DEXED; instance_id++)
{ {
Serial.print(F("=== DEXED INSTANCE ")); Serial.print(F("=== DEXED INSTANCE "));
Serial.print(i, DEC); Serial.print(instance_id, DEC);
Serial.println(" ==="); Serial.println(" ===");
Serial.print(F(" MIDI-Channel ")); Serial.println(configuration.midi_channel[i], DEC); Serial.print(F(" MIDI-Channel ")); Serial.println(configuration.dexed[instance_id].midi_channel, DEC);
Serial.print(F(" Bank ")); Serial.println(configuration.bank[i], DEC); Serial.print(F(" Bank ")); Serial.println(configuration.dexed[instance_id].bank, DEC);
Serial.print(F(" Voice ")); Serial.println(configuration.voice[i], DEC); Serial.print(F(" Voice ")); Serial.println(configuration.dexed[instance_id].voice, DEC);
Serial.print(F(" Panorama ")); Serial.println(configuration.pan[i], DEC); Serial.print(F(" Panorama ")); Serial.println(configuration.dexed[instance_id].pan, DEC);
Serial.print(F(" Reverb Level ")); Serial.println(configuration.reverb_level[i], DEC); Serial.print(F(" Reverb Level ")); Serial.println(configuration.dexed[instance_id].reverb_level, DEC);
Serial.print(F(" Chorus Level ")); Serial.println(configuration.chorus_level[i], DEC); Serial.print(F(" Chorus Level ")); Serial.println(configuration.dexed[instance_id].chorus_level, DEC);
Serial.print(F(" Delay Level ")); Serial.println(configuration.delay_level[i], DEC); Serial.print(F(" Delay Level ")); Serial.println(configuration.dexed[instance_id].delay_level, DEC);
Serial.print(F(" Filter Cutoff ")); Serial.println(configuration.filter_cutoff[i], DEC); Serial.print(F(" Filter Cutoff ")); Serial.println(configuration.dexed[instance_id].filter_cutoff, DEC);
Serial.print(F(" Filter Resonance ")); Serial.println(configuration.filter_resonance[i], DEC); Serial.print(F(" Filter Resonance ")); Serial.println(configuration.dexed[instance_id].filter_resonance, DEC);
Serial.print(F(" Loudness ")); Serial.println(configuration.loudness[i], DEC); Serial.print(F(" Loudness ")); Serial.println(configuration.dexed[instance_id].loudness, DEC);
Serial.print(F(" Polyphony ")); Serial.println(configuration.polyphony[i], DEC); Serial.print(F(" Polyphony ")); Serial.println(configuration.dexed[instance_id].polyphony, DEC);
Serial.print(F(" Engine ")); Serial.println(configuration.engine[i], DEC); Serial.print(F(" Engine ")); Serial.println(configuration.dexed[instance_id].engine, DEC);
Serial.print(F(" Mono/Poly ")); Serial.println(configuration.monopoly[i], DEC); Serial.print(F(" Mono/Poly ")); Serial.println(configuration.dexed[instance_id].monopoly, DEC);
Serial.print(F(" Pitchbend Range ")); Serial.println(configuration.pb_range[i], DEC); Serial.print(F(" Pitchbend Range ")); Serial.println(configuration.dexed[instance_id].pb_range, DEC);
Serial.print(F(" Pitchbend Step ")); Serial.println(configuration.pb_step[i], DEC); Serial.print(F(" Pitchbend Step ")); Serial.println(configuration.dexed[instance_id].pb_step, DEC);
Serial.print(F(" Modwheel Range ")); Serial.println(configuration.mw_range[i], DEC); Serial.print(F(" Modwheel Range ")); Serial.println(configuration.dexed[instance_id].mw_range, DEC);
Serial.print(F(" Modwheel Assign ")); Serial.println(configuration.mw_assign[i], DEC); Serial.print(F(" Modwheel Assign ")); Serial.println(configuration.dexed[instance_id].mw_assign, DEC);
Serial.print(F(" Footctrl Range ")); Serial.println(configuration.fc_range[i], DEC); Serial.print(F(" Footctrl Range ")); Serial.println(configuration.dexed[instance_id].fc_range, DEC);
Serial.print(F(" Footctrl Assign ")); Serial.println(configuration.fc_assign[i], DEC); Serial.print(F(" Footctrl Assign ")); Serial.println(configuration.dexed[instance_id].fc_assign, DEC);
Serial.print(F(" BreathCtrl Range ")); Serial.println(configuration.bc_range[i], DEC); Serial.print(F(" BreathCtrl Range ")); Serial.println(configuration.dexed[instance_id].bc_range, DEC);
Serial.print(F(" Breathctrl Assign ")); Serial.println(configuration.bc_assign[i], DEC); Serial.print(F(" Breathctrl Assign ")); Serial.println(configuration.dexed[instance_id].bc_assign, DEC);
Serial.print(F(" Aftertouch Range ")); Serial.println(configuration.at_range[i], DEC); Serial.print(F(" Aftertouch Range ")); Serial.println(configuration.dexed[instance_id].at_range, DEC);
Serial.print(F(" Aftertouch Assign ")); Serial.println(configuration.at_assign[i], DEC); Serial.print(F(" Aftertouch Assign ")); Serial.println(configuration.dexed[instance_id].at_assign, DEC);
Serial.print(F(" OP Enabled ")); Serial.println(configuration.op_enabled[i], DEC); Serial.print(F(" OP Enabled ")); Serial.println(configuration.dexed[instance_id].op_enabled, DEC);
} }
Serial.println(); Serial.println();
} }

384
UI.hpp

@ -368,7 +368,7 @@ void setup_ui(void) {
lcd.clear(); lcd.clear();
lcd.setFont(u8x8_font_amstrad_cpc_extended_f); lcd.setFont(u8x8_font_amstrad_cpc_extended_f);
#endif #endif
lcd.setCursor(1, 0); lcd.setCursor(3, 0);
lcd.print(F("MicroDexed")); lcd.print(F("MicroDexed"));
lcd.setCursor(0, 1); lcd.setCursor(0, 1);
lcd.print(F("(c)parasiTstudio")); lcd.print(F("(c)parasiTstudio"));
@ -556,14 +556,14 @@ void encoder_right_up(void)
switch (menu_voice) switch (menu_voice)
{ {
case MENU_VOICE_BANK: case MENU_VOICE_BANK:
if (configuration.bank[instance_id] < MAX_BANKS) if (configuration.dexed[instance_id].bank < MAX_BANKS)
{ {
configuration.bank[instance_id]++; configuration.dexed[instance_id].bank++;
#ifdef DISPLAY_LCD_SPI #ifdef DISPLAY_LCD_SPI
change_disp_sd(false); change_disp_sd(false);
#endif #endif
load_sysex(configuration.bank[instance_id], configuration.voice[instance_id], instance_id); load_sysex(configuration.dexed[instance_id].bank, configuration.dexed[instance_id].voice, instance_id);
get_voice_names_from_bank(configuration.bank[instance_id], instance_id); get_voice_names_from_bank(configuration.dexed[instance_id].bank, instance_id);
#ifdef DISPLAY_LCD_SPI #ifdef DISPLAY_LCD_SPI
change_disp_sd(true); change_disp_sd(true);
#endif #endif
@ -571,21 +571,21 @@ void encoder_right_up(void)
} }
break; break;
case MENU_VOICE_SOUND: case MENU_VOICE_SOUND:
if (configuration.voice[instance_id] < MAX_VOICES - 1) if (configuration.dexed[instance_id].voice < MAX_VOICES - 1)
configuration.voice[instance_id]++; configuration.dexed[instance_id].voice++;
else else
{ {
if (configuration.bank[instance_id] < MAX_BANKS) if (configuration.dexed[instance_id].bank < MAX_BANKS)
{ {
configuration.bank[instance_id]++; configuration.dexed[instance_id].bank++;
configuration.voice[instance_id] = 0; configuration.dexed[instance_id].voice = 0;
} }
} }
#ifdef DISPLAY_LCD_SPI #ifdef DISPLAY_LCD_SPI
change_disp_sd(false); change_disp_sd(false);
#endif #endif
load_sysex(configuration.bank[instance_id], configuration.voice[instance_id], instance_id); load_sysex(configuration.dexed[instance_id].bank, configuration.dexed[instance_id].voice, instance_id);
get_voice_names_from_bank(configuration.bank[instance_id], instance_id); get_voice_names_from_bank(configuration.dexed[instance_id].bank, instance_id);
#ifdef DISPLAY_LCD_SPI #ifdef DISPLAY_LCD_SPI
change_disp_sd(true); change_disp_sd(true);
#endif #endif
@ -618,15 +618,15 @@ void encoder_right_down(void)
switch (menu_voice) switch (menu_voice)
{ {
case MENU_VOICE_BANK: case MENU_VOICE_BANK:
if (configuration.bank[instance_id] > 0) if (configuration.dexed[instance_id].bank > 0)
{ {
configuration.bank[instance_id]--; configuration.dexed[instance_id].bank--;
#ifdef DISPLAY_LCD_SPI #ifdef DISPLAY_LCD_SPI
change_disp_sd(false); change_disp_sd(false);
#endif #endif
load_sysex(configuration.bank[instance_id], configuration.voice[instance_id], instance_id); load_sysex(configuration.dexed[instance_id].bank, configuration.dexed[instance_id].voice, instance_id);
get_voice_names_from_bank(configuration.bank[instance_id], instance_id); get_voice_names_from_bank(configuration.dexed[instance_id].bank, instance_id);
#ifdef DISPLAY_LCD_SPI #ifdef DISPLAY_LCD_SPI
change_disp_sd(true); change_disp_sd(true);
#endif #endif
@ -634,21 +634,21 @@ void encoder_right_down(void)
} }
break; break;
case MENU_VOICE_SOUND: case MENU_VOICE_SOUND:
if (configuration.voice[instance_id] > 0) if (configuration.dexed[instance_id].voice > 0)
configuration.voice[instance_id]--; configuration.dexed[instance_id].voice--;
else else
{ {
if (configuration.bank[instance_id] > 0) if (configuration.dexed[instance_id].bank > 0)
{ {
configuration.bank[instance_id]--; configuration.dexed[instance_id].bank--;
configuration.voice[instance_id] = 31; configuration.dexed[instance_id].voice = 31;
} }
} }
#ifdef DISPLAY_LCD_SPI #ifdef DISPLAY_LCD_SPI
change_disp_sd(false); change_disp_sd(false);
#endif #endif
load_sysex(configuration.bank[instance_id], configuration.voice[instance_id], instance_id); load_sysex(configuration.dexed[instance_id].bank, configuration.dexed[instance_id].voice, instance_id);
get_voice_names_from_bank(configuration.bank[instance_id], instance_id); get_voice_names_from_bank(configuration.dexed[instance_id].bank, instance_id);
#ifdef DISPLAY_LCD_SPI #ifdef DISPLAY_LCD_SPI
change_disp_sd(true); change_disp_sd(true);
#endif #endif
@ -906,6 +906,11 @@ void UI_func_reverb_roomsize(uint8_t param)
// setup function // setup function
lcd.setCursor(0, 0); lcd.setCursor(0, 0);
lcd.print(F("Reverb Roomsize")); lcd.print(F("Reverb Roomsize"));
#ifdef DEBUG
Serial.println(F("Entering UI_func_reverb_roomsize()"));
Serial.print(F("configuration.roomsize="));
Serial.println(configuration.reverb_roomsize, DEC);
#endif
} }
if (LCDML.FUNC_loop()) // ****** LOOP ********* if (LCDML.FUNC_loop()) // ****** LOOP *********
@ -937,7 +942,11 @@ void UI_func_reverb_roomsize(uint8_t param)
if (LCDML.FUNC_close()) // ****** STABLE END ********* if (LCDML.FUNC_close()) // ****** STABLE END *********
{ {
// you can here reset some global vars or do nothing #ifdef DEBUG
Serial.println(F("Leaving UI_func_reverb_roomsize()"));
Serial.print(F("reverb_roomsize="));
Serial.println(configuration.reverb_roomsize, DEC);
#endif
eeprom_write(); eeprom_write();
} }
#else #else
@ -953,6 +962,11 @@ void UI_func_reverb_damping(uint8_t param)
// setup function // setup function
lcd.setCursor(0, 0); lcd.setCursor(0, 0);
lcd.print(F("Reverb Damping")); lcd.print(F("Reverb Damping"));
#ifdef DEBUG
Serial.println(F("Entering UI_func_reverb_damping()"));
Serial.print(F("reverb_damping="));
Serial.println(configuration.reverb_damping, DEC);
#endif
} }
if (LCDML.FUNC_loop()) // ****** LOOP ********* if (LCDML.FUNC_loop()) // ****** LOOP *********
@ -984,7 +998,11 @@ void UI_func_reverb_damping(uint8_t param)
if (LCDML.FUNC_close()) // ****** STABLE END ********* if (LCDML.FUNC_close()) // ****** STABLE END *********
{ {
// you can here reset some global vars or do nothing #ifdef DEBUG
Serial.println(F("Leaving UI_func_reverb_damping()"));
Serial.print(F("configuration.reverb_damping="));
Serial.println(configuration.reverb_damping, DEC);
#endif
eeprom_write(); eeprom_write();
} }
#else #else
@ -1005,6 +1023,13 @@ void UI_func_reverb_level(uint8_t param)
// setup function // setup function
lcd.setCursor(0, 0); lcd.setCursor(0, 0);
lcd.print(F("Reverb Level")); lcd.print(F("Reverb Level"));
#ifdef DEBUG
Serial.println(F("Entering UI_func_reverb_level()"));
Serial.print(F("configuration.dexed["));
Serial.print(instance_id, DEC);
Serial.print(F("].reverb_level="));
Serial.println(configuration.dexed[instance_id].reverb_level, DEC);
#endif
} }
if (LCDML.FUNC_loop()) // ****** LOOP ********* if (LCDML.FUNC_loop()) // ****** LOOP *********
@ -1015,30 +1040,36 @@ void UI_func_reverb_level(uint8_t param)
} }
else if (LCDML.BT_checkDown()) else if (LCDML.BT_checkDown())
{ {
if (configuration.reverb_level[instance_id] < REVERB_LEVEL_MAX) if (configuration.dexed[instance_id].reverb_level < REVERB_LEVEL_MAX)
{ {
configuration.reverb_level[instance_id]++; configuration.dexed[instance_id].reverb_level++;
} }
} }
else if (LCDML.BT_checkUp()) else if (LCDML.BT_checkUp())
{ {
if (configuration.reverb_level[instance_id] > REVERB_LEVEL_MIN) if (configuration.dexed[instance_id].reverb_level > REVERB_LEVEL_MIN)
{ {
configuration.reverb_level[instance_id]--; configuration.dexed[instance_id].reverb_level--;
} }
} }
lcd.setCursor(0, 1); lcd.setCursor(0, 1);
lcd_display_int(configuration.reverb_level[instance_id], 3, true, true, false); lcd_display_int(configuration.dexed[instance_id].reverb_level, 3, true, true, false);
master_mixer_r.gain(REVERB, configuration.reverb_level[instance_id] / 100.0); master_mixer_r.gain(REVERB, configuration.dexed[instance_id].reverb_level / 100.0);
master_mixer_l.gain(REVERB, configuration.reverb_level[instance_id] / 100.0); master_mixer_l.gain(REVERB, configuration.dexed[instance_id].reverb_level / 100.0);
} }
if (LCDML.FUNC_close()) // ****** STABLE END ********* if (LCDML.FUNC_close()) // ****** STABLE END *********
{ {
// you can here reset some global vars or do nothing #ifdef DEBUG
Serial.println(F("Leaving UI_func_reverb_level()"));
Serial.print(F("configuration.dexed["));
Serial.print(instance_id, DEC);
Serial.print(F("].reverb_level="));
Serial.println(configuration.dexed[instance_id].reverb_level, DEC);
#endif
eeprom_write(); eeprom_write();
} }
#else #else
@ -1053,6 +1084,11 @@ void UI_func_chorus_frequency(uint8_t param)
// setup function // setup function
lcd.setCursor(0, 0); lcd.setCursor(0, 0);
lcd.print(F("Chorus Frequency")); lcd.print(F("Chorus Frequency"));
#ifdef DEBUG
Serial.println(F("Entering UI_func_chorus_frequency()"));
Serial.print(F("configuration.chorus_frequency="));
Serial.println(configuration.chorus_frequency, DEC);
#endif
} }
if (LCDML.FUNC_loop()) // ****** LOOP ********* if (LCDML.FUNC_loop()) // ****** LOOP *********
@ -1085,7 +1121,11 @@ void UI_func_chorus_frequency(uint8_t param)
if (LCDML.FUNC_close()) // ****** STABLE END ********* if (LCDML.FUNC_close()) // ****** STABLE END *********
{ {
// you can here reset some global vars or do nothing #ifdef DEBUG
Serial.println(F("Leaving UI_func_chorus_frequency()"));
Serial.print(F("configuration.chorus_frequency="));
Serial.println(configuration.chorus_frequency, DEC);
#endif
eeprom_write(); eeprom_write();
} }
} }
@ -1210,24 +1250,24 @@ void UI_func_chorus_level(uint8_t param)
} }
else if (LCDML.BT_checkDown()) else if (LCDML.BT_checkDown())
{ {
if (configuration.chorus_level[instance_id] < CHORUS_LEVEL_MAX) if (configuration.dexed[instance_id].chorus_level < CHORUS_LEVEL_MAX)
{ {
configuration.chorus_level[instance_id]++; configuration.dexed[instance_id].chorus_level++;
} }
} }
else if (LCDML.BT_checkUp()) else if (LCDML.BT_checkUp())
{ {
if (configuration.chorus_level[instance_id] > CHORUS_LEVEL_MIN) if (configuration.dexed[instance_id].chorus_level > CHORUS_LEVEL_MIN)
{ {
configuration.chorus_level[instance_id]--; configuration.dexed[instance_id].chorus_level--;
} }
} }
lcd.setCursor(0, 1); lcd.setCursor(0, 1);
lcd_display_int(configuration.chorus_level[instance_id], 3, true, true, false); lcd_display_int(configuration.dexed[instance_id].chorus_level, 3, true, true, false);
master_mixer_r.gain(CHORUS, configuration.chorus_level[instance_id] / 100.0); master_mixer_r.gain(CHORUS, configuration.dexed[instance_id].chorus_level / 100.0);
master_mixer_l.gain(CHORUS, configuration.chorus_level[instance_id] / 100.0); master_mixer_l.gain(CHORUS, configuration.dexed[instance_id].chorus_level / 100.0);
} }
if (LCDML.FUNC_close()) // ****** STABLE END ********* if (LCDML.FUNC_close()) // ****** STABLE END *********
@ -1347,24 +1387,24 @@ void UI_func_delay_level(uint8_t param)
} }
else if (LCDML.BT_checkDown()) else if (LCDML.BT_checkDown())
{ {
if (configuration.delay_level[instance_id] < DELAY_LEVEL_MAX) if (configuration.dexed[instance_id].delay_level < DELAY_LEVEL_MAX)
{ {
configuration.delay_level[instance_id]++; configuration.dexed[instance_id].delay_level++;
} }
} }
else if (LCDML.BT_checkUp()) else if (LCDML.BT_checkUp())
{ {
if (configuration.delay_level[instance_id] > DELAY_LEVEL_MIN) if (configuration.dexed[instance_id].delay_level > DELAY_LEVEL_MIN)
{ {
configuration.delay_level[instance_id]--; configuration.dexed[instance_id].delay_level--;
} }
} }
lcd.setCursor(0, 1); lcd.setCursor(0, 1);
lcd_display_int(configuration.delay_level[instance_id], 3, true, true, false); lcd_display_int(configuration.dexed[instance_id].delay_level, 3, true, true, false);
master_mixer_r.gain(DELAY, configuration.delay_level[instance_id] / 100.0); master_mixer_r.gain(DELAY, configuration.dexed[instance_id].delay_level / 100.0);
master_mixer_l.gain(DELAY, configuration.delay_level[instance_id] / 100.0); master_mixer_l.gain(DELAY, configuration.dexed[instance_id].delay_level / 100.0);
} }
if (LCDML.FUNC_close()) // ****** STABLE END ********* if (LCDML.FUNC_close()) // ****** STABLE END *********
@ -1396,30 +1436,27 @@ void UI_func_filter_cutoff(uint8_t param)
} }
else if (LCDML.BT_checkDown()) else if (LCDML.BT_checkDown())
{ {
if (configuration.filter_cutoff[instance_id] < FILTER_CUTOFF_MAX) if (configuration.dexed[instance_id].filter_cutoff < FILTER_CUTOFF_MAX)
{ {
configuration.filter_cutoff[instance_id]++; configuration.dexed[instance_id].filter_cutoff++;
} }
} }
else if (LCDML.BT_checkUp()) else if (LCDML.BT_checkUp())
{ {
if (configuration.filter_cutoff[instance_id] > FILTER_CUTOFF_MIN) if (configuration.dexed[instance_id].filter_cutoff > FILTER_CUTOFF_MIN)
{ {
configuration.filter_cutoff[instance_id]--; configuration.dexed[instance_id].filter_cutoff--;
} }
} }
lcd.setCursor(0, 1); lcd.setCursor(0, 1);
lcd_display_int(configuration.filter_cutoff[instance_id], 3, true, true, false); lcd_display_int(configuration.dexed[instance_id].filter_cutoff, 3, true, true, false);
Serial.print(LCDML.FUNC_getID(), DEC); Serial.print(LCDML.FUNC_getID(), DEC);
Serial.print(" ");
Serial.print(MENU_ID_OF_INSTANCE_2, DEC);
Serial.print(" INSTANCE: ");
Serial.print(instance_id, DEC); Serial.print(instance_id, DEC);
Serial.print(" value: "); Serial.print(" value: ");
Serial.println(configuration.filter_cutoff[instance_id] / 100.0, 3); Serial.println(configuration.dexed[instance_id].filter_cutoff / 100.0, 3);
MicroDexed[instance_id]->fx.Cutoff = configuration.filter_cutoff[instance_id] / 100.0; MicroDexed[instance_id]->fx.Cutoff = configuration.dexed[instance_id].filter_cutoff / 100.0;
} }
if (LCDML.FUNC_close()) // ****** STABLE END ********* if (LCDML.FUNC_close()) // ****** STABLE END *********
@ -1451,23 +1488,23 @@ void UI_func_filter_resonance(uint8_t param)
} }
else if (LCDML.BT_checkDown()) else if (LCDML.BT_checkDown())
{ {
if (configuration.filter_resonance[instance_id] < FILTER_RESONANCE_MAX) if (configuration.dexed[instance_id].filter_resonance < FILTER_RESONANCE_MAX)
{ {
configuration.filter_resonance[instance_id]++; configuration.dexed[instance_id].filter_resonance++;
} }
} }
else if (LCDML.BT_checkUp()) else if (LCDML.BT_checkUp())
{ {
if (configuration.filter_resonance[instance_id] > FILTER_RESONANCE_MIN) if (configuration.dexed[instance_id].filter_resonance > FILTER_RESONANCE_MIN)
{ {
configuration.filter_resonance[instance_id]--; configuration.dexed[instance_id].filter_resonance--;
} }
} }
lcd.setCursor(0, 1); lcd.setCursor(0, 1);
lcd_display_int(configuration.filter_resonance[instance_id], 3, true, true, false); lcd_display_int(configuration.dexed[instance_id].filter_resonance, 3, true, true, false);
MicroDexed[instance_id]->fx.Reso = configuration.filter_resonance[instance_id] / 100.0; MicroDexed[instance_id]->fx.Reso = configuration.dexed[instance_id].filter_resonance / 100.0;
} }
if (LCDML.FUNC_close()) // ****** STABLE END ********* if (LCDML.FUNC_close()) // ****** STABLE END *********
@ -1499,27 +1536,27 @@ void UI_func_midi_channel(uint8_t param)
} }
else if (LCDML.BT_checkDown()) else if (LCDML.BT_checkDown())
{ {
if (configuration.midi_channel[instance_id] < MIDI_CHANNEL_MAX) if (configuration.dexed[instance_id].midi_channel < MIDI_CHANNEL_MAX)
{ {
configuration.midi_channel[instance_id]++; configuration.dexed[instance_id].midi_channel++;
} }
} }
else if (LCDML.BT_checkUp()) else if (LCDML.BT_checkUp())
{ {
if (configuration.midi_channel[instance_id] > MIDI_CHANNEL_MIN) if (configuration.dexed[instance_id].midi_channel > MIDI_CHANNEL_MIN)
{ {
configuration.midi_channel[instance_id]--; configuration.dexed[instance_id].midi_channel--;
} }
} }
lcd.setCursor(0, 1); lcd.setCursor(0, 1);
if (configuration.midi_channel[instance_id] == 0) if (configuration.dexed[instance_id].midi_channel == 0)
{ {
lcd.print(F("[OMNI]")); lcd.print(F("[OMNI]"));
} }
else else
{ {
lcd_display_int(configuration.midi_channel[instance_id], 4, false, true, false); lcd_display_int(configuration.dexed[instance_id].midi_channel, 4, false, true, false);
} }
} }
@ -1552,23 +1589,23 @@ void UI_func_loudness(uint8_t param)
} }
else if (LCDML.BT_checkDown()) else if (LCDML.BT_checkDown())
{ {
if (configuration.loudness[instance_id] < LOUDNESS_MAX) if (configuration.dexed[instance_id].loudness < LOUDNESS_MAX)
{ {
configuration.loudness[instance_id]++; configuration.dexed[instance_id].loudness++;
} }
} }
else if (LCDML.BT_checkUp()) else if (LCDML.BT_checkUp())
{ {
if (configuration.loudness[instance_id] > LOUDNESS_MIN) if (configuration.dexed[instance_id].loudness > LOUDNESS_MIN)
{ {
configuration.loudness[instance_id]--; configuration.dexed[instance_id].loudness--;
} }
} }
lcd.setCursor(0, 1); lcd.setCursor(0, 1);
lcd_display_int(configuration.loudness[instance_id], 3, true, true, false); lcd_display_int(configuration.dexed[instance_id].loudness, 3, true, true, false);
MicroDexed[instance_id]->fx.Gain = configuration.loudness[instance_id] / 100.0; MicroDexed[instance_id]->fx.Gain = configuration.dexed[instance_id].loudness / 100.0;
} }
if (LCDML.FUNC_close()) // ****** STABLE END ********* if (LCDML.FUNC_close()) // ****** STABLE END *********
@ -1605,25 +1642,25 @@ void UI_func_panorama(uint8_t param)
} }
else if (LCDML.BT_checkDown() && configuration.mono == 0) else if (LCDML.BT_checkDown() && configuration.mono == 0)
{ {
if (configuration.pan[instance_id] < PANORAMA_MAX) if (configuration.dexed[instance_id].pan < PANORAMA_MAX)
{ {
configuration.pan[instance_id]++; configuration.dexed[instance_id].pan++;
} }
} }
else if (LCDML.BT_checkUp() && configuration.mono == 0) else if (LCDML.BT_checkUp() && configuration.mono == 0)
{ {
if (configuration.pan[instance_id] > PANORAMA_MIN) if (configuration.dexed[instance_id].pan > PANORAMA_MIN)
{ {
configuration.pan[instance_id]--; configuration.dexed[instance_id].pan--;
} }
} }
if (configuration.mono == 0) if (configuration.mono == 0)
{ {
lcd.setCursor(0, 1); lcd.setCursor(0, 1);
lcd_display_int(configuration.pan[instance_id], 2, false, true, true); lcd_display_int(configuration.dexed[instance_id].pan, 2, false, true, true);
set_volume(configuration.vol, configuration.pan[instance_id], configuration.mono); set_volume(configuration.vol, configuration.dexed[instance_id].pan, configuration.mono);
} }
} }
@ -1688,7 +1725,7 @@ void UI_func_stereo_mono(uint8_t param)
stereomono1.stereo(false); stereomono1.stereo(false);
break; break;
} }
set_volume(configuration.vol, configuration.pan[instance_id], configuration.mono); set_volume(configuration.vol, configuration.dexed[instance_id].pan, configuration.mono);
} }
if (LCDML.FUNC_close()) // ****** STABLE END ********* if (LCDML.FUNC_close()) // ****** STABLE END *********
@ -1720,23 +1757,23 @@ void UI_func_polyphony(uint8_t param)
} }
else if (LCDML.BT_checkDown()) else if (LCDML.BT_checkDown())
{ {
if (configuration.polyphony[instance_id] < POLYPHONY_MAX) if (configuration.dexed[instance_id].polyphony < POLYPHONY_MAX)
{ {
configuration.polyphony[instance_id]++; configuration.dexed[instance_id].polyphony++;
} }
} }
else if (LCDML.BT_checkUp()) else if (LCDML.BT_checkUp())
{ {
if (configuration.polyphony[instance_id] > POLYPHONY_MIN) if (configuration.dexed[instance_id].polyphony > POLYPHONY_MIN)
{ {
configuration.polyphony[instance_id]--; configuration.dexed[instance_id].polyphony--;
} }
} }
lcd.setCursor(0, 1); lcd.setCursor(0, 1);
lcd_display_int(configuration.polyphony[instance_id], 2, false, true, false); lcd_display_int(configuration.dexed[instance_id].polyphony, 2, false, true, false);
MicroDexed[instance_id]->setMaxNotes(configuration.polyphony[instance_id]); MicroDexed[instance_id]->setMaxNotes(configuration.dexed[instance_id].polyphony);
} }
if (LCDML.FUNC_close()) // ****** STABLE END ********* if (LCDML.FUNC_close()) // ****** STABLE END *********
@ -1768,21 +1805,21 @@ void UI_func_engine(uint8_t param)
} }
else if (LCDML.BT_checkDown()) else if (LCDML.BT_checkDown())
{ {
if (configuration.engine[instance_id] < ENGINE_MAX) if (configuration.dexed[instance_id].engine < ENGINE_MAX)
{ {
configuration.engine[instance_id]++; configuration.dexed[instance_id].engine++;
} }
} }
else if (LCDML.BT_checkUp()) else if (LCDML.BT_checkUp())
{ {
if (configuration.engine[instance_id] > ENGINE_MIN) if (configuration.dexed[instance_id].engine > ENGINE_MIN)
{ {
configuration.engine[instance_id]--; configuration.dexed[instance_id].engine--;
} }
} }
lcd.setCursor(0, 1); lcd.setCursor(0, 1);
switch (configuration.engine[instance_id]) switch (configuration.dexed[instance_id].engine)
{ {
case 0: case 0:
lcd.print(F("[MODERN]")); lcd.print(F("[MODERN]"));
@ -1795,7 +1832,7 @@ void UI_func_engine(uint8_t param)
break; break;
} }
MicroDexed[instance_id]->setEngineType(configuration.engine[instance_id]); MicroDexed[instance_id]->setEngineType(configuration.dexed[instance_id].engine);
} }
if (LCDML.FUNC_close()) // ****** STABLE END ********* if (LCDML.FUNC_close()) // ****** STABLE END *********
@ -1827,21 +1864,21 @@ void UI_func_mono_poly(uint8_t param)
} }
else if (LCDML.BT_checkDown()) else if (LCDML.BT_checkDown())
{ {
if (configuration.monopoly[instance_id] < MONOPOLY_MAX) if (configuration.dexed[instance_id].monopoly < MONOPOLY_MAX)
{ {
configuration.monopoly[instance_id]++; configuration.dexed[instance_id].monopoly++;
} }
} }
else if (LCDML.BT_checkUp()) else if (LCDML.BT_checkUp())
{ {
if (configuration.monopoly[instance_id] > MONOPOLY_MIN) if (configuration.dexed[instance_id].monopoly > MONOPOLY_MIN)
{ {
configuration.monopoly[instance_id]--; configuration.dexed[instance_id].monopoly--;
} }
} }
lcd.setCursor(0, 1); lcd.setCursor(0, 1);
switch (configuration.monopoly[instance_id]) switch (configuration.dexed[instance_id].monopoly)
{ {
case 0: case 0:
lcd.print(F("[MONOPHONIC]")); lcd.print(F("[MONOPHONIC]"));
@ -1851,7 +1888,7 @@ void UI_func_mono_poly(uint8_t param)
break; break;
} }
MicroDexed[instance_id]->setMonoMode(configuration.monopoly[instance_id]); MicroDexed[instance_id]->setMonoMode(configuration.dexed[instance_id].monopoly);
} }
if (LCDML.FUNC_close()) // ****** STABLE END ********* if (LCDML.FUNC_close()) // ****** STABLE END *********
@ -1873,6 +1910,13 @@ void UI_func_pb_range(uint8_t param)
// setup function // setup function
lcd.setCursor(0, 0); lcd.setCursor(0, 0);
lcd.print(F("PB Range")); lcd.print(F("PB Range"));
#ifdef DEBUG
Serial.println(F("Entering UI_func_pb_range()"));
Serial.print(F("configuration.dexed["));
Serial.print(instance_id, DEC);
Serial.print(F("].pb_range="));
Serial.println(configuration.dexed[instance_id].pb_range, DEC);
#endif
} }
if (LCDML.FUNC_loop()) // ****** LOOP ********* if (LCDML.FUNC_loop()) // ****** LOOP *********
@ -1883,28 +1927,34 @@ void UI_func_pb_range(uint8_t param)
} }
else if (LCDML.BT_checkDown()) else if (LCDML.BT_checkDown())
{ {
if (configuration.pb_range[instance_id] < PB_RANGE_MAX) if (configuration.dexed[instance_id].pb_range < PB_RANGE_MAX)
{ {
configuration.pb_range[instance_id]++; configuration.dexed[instance_id].pb_range++;
} }
} }
else if (LCDML.BT_checkUp()) else if (LCDML.BT_checkUp())
{ {
if (configuration.pb_range[instance_id] > PB_RANGE_MIN) if (configuration.dexed[instance_id].pb_range > PB_RANGE_MIN)
{ {
configuration.pb_range[instance_id]--; configuration.dexed[instance_id].pb_range--;
} }
} }
lcd.setCursor(0, 1); lcd.setCursor(0, 1);
lcd_display_int(configuration.pb_range[instance_id], 2, false, true, false); lcd_display_int(configuration.dexed[instance_id].pb_range, 2, false, true, false);
MicroDexed[instance_id]->setPBController(configuration.pb_range[instance_id], configuration.pb_step[instance_id]); MicroDexed[instance_id]->setPBController(configuration.dexed[instance_id].pb_range, configuration.dexed[instance_id].pb_step);
} }
if (LCDML.FUNC_close()) // ****** STABLE END ********* if (LCDML.FUNC_close()) // ****** STABLE END *********
{ {
// you can here reset some global vars or do nothing #ifdef DEBUG
Serial.println(F("Entering UI_func_pb_range()"));
Serial.print(F("configuration.dexed["));
Serial.print(instance_id, DEC);
Serial.print(F("].pb_range="));
Serial.println(configuration.dexed[instance_id].pb_range, DEC);
#endif
eeprom_write(); eeprom_write();
} }
} }
@ -1931,23 +1981,23 @@ void UI_func_pb_step(uint8_t param)
} }
else if (LCDML.BT_checkDown()) else if (LCDML.BT_checkDown())
{ {
if (configuration.pb_step[instance_id] < PB_STEP_MAX) if (configuration.dexed[instance_id].pb_step < PB_STEP_MAX)
{ {
configuration.pb_step[instance_id]++; configuration.dexed[instance_id].pb_step++;
} }
} }
else if (LCDML.BT_checkUp()) else if (LCDML.BT_checkUp())
{ {
if (configuration.pb_step[instance_id] > PB_STEP_MIN) if (configuration.dexed[instance_id].pb_step > PB_STEP_MIN)
{ {
configuration.pb_step[instance_id]--; configuration.dexed[instance_id].pb_step--;
} }
} }
lcd.setCursor(0, 1); lcd.setCursor(0, 1);
lcd_display_int(configuration.pb_step[instance_id], 2, false, true, false); lcd_display_int(configuration.dexed[instance_id].pb_step, 2, false, true, false);
MicroDexed[instance_id]->setPBController(configuration.pb_range[instance_id], configuration.pb_step[instance_id]); MicroDexed[instance_id]->setPBController(configuration.dexed[instance_id].pb_range, configuration.dexed[instance_id].pb_step);
} }
if (LCDML.FUNC_close()) // ****** STABLE END ********* if (LCDML.FUNC_close()) // ****** STABLE END *********
@ -1979,23 +2029,23 @@ void UI_func_mw_range(uint8_t param)
} }
else if (LCDML.BT_checkDown()) else if (LCDML.BT_checkDown())
{ {
if (configuration.mw_range[instance_id] < MW_RANGE_MAX) if (configuration.dexed[instance_id].mw_range < MW_RANGE_MAX)
{ {
configuration.mw_range[instance_id]++; configuration.dexed[instance_id].mw_range++;
} }
} }
else if (LCDML.BT_checkUp()) else if (LCDML.BT_checkUp())
{ {
if (configuration.mw_range[instance_id] > MW_RANGE_MIN) if (configuration.dexed[instance_id].mw_range > MW_RANGE_MIN)
{ {
configuration.mw_range[instance_id]--; configuration.dexed[instance_id].mw_range--;
} }
} }
lcd.setCursor(0, 1); lcd.setCursor(0, 1);
lcd_display_int(configuration.mw_range[instance_id], 2, false, true, false); lcd_display_int(configuration.dexed[instance_id].mw_range, 2, false, true, false);
MicroDexed[instance_id]->setMWController(configuration.mw_range[instance_id], configuration.mw_assign[instance_id]); MicroDexed[instance_id]->setMWController(configuration.dexed[instance_id].mw_range, configuration.dexed[instance_id].mw_assign);
} }
if (LCDML.FUNC_close()) // ****** STABLE END ********* if (LCDML.FUNC_close()) // ****** STABLE END *********
@ -2027,21 +2077,21 @@ void UI_func_mw_assign(uint8_t param)
} }
else if (LCDML.BT_checkDown()) else if (LCDML.BT_checkDown())
{ {
if (configuration.mw_assign[instance_id] < MW_ASSIGN_MAX) if (configuration.dexed[instance_id].mw_assign < MW_ASSIGN_MAX)
{ {
configuration.mw_assign[instance_id]++; configuration.dexed[instance_id].mw_assign++;
} }
} }
else if (LCDML.BT_checkUp()) else if (LCDML.BT_checkUp())
{ {
if (configuration.mw_assign[instance_id] > MW_ASSIGN_MIN) if (configuration.dexed[instance_id].mw_assign > MW_ASSIGN_MIN)
{ {
configuration.mw_assign[instance_id]--; configuration.dexed[instance_id].mw_assign--;
} }
} }
lcd.setCursor(0, 1); lcd.setCursor(0, 1);
switch (configuration.mw_assign[instance_id]) switch (configuration.dexed[instance_id].mw_assign)
{ {
case 0: case 0:
lcd.print(F("[ NONE ]")); lcd.print(F("[ NONE ]"));
@ -2069,7 +2119,7 @@ void UI_func_mw_assign(uint8_t param)
break; break;
} }
MicroDexed[instance_id]->setMWController(configuration.mw_range[instance_id], configuration.mw_assign[instance_id]); MicroDexed[instance_id]->setMWController(configuration.dexed[instance_id].mw_range, configuration.dexed[instance_id].mw_assign);
} }
if (LCDML.FUNC_close()) // ****** STABLE END ********* if (LCDML.FUNC_close()) // ****** STABLE END *********
@ -2101,23 +2151,23 @@ void UI_func_fc_range(uint8_t param)
} }
else if (LCDML.BT_checkDown()) else if (LCDML.BT_checkDown())
{ {
if (configuration.fc_range[instance_id] < FC_RANGE_MAX) if (configuration.dexed[instance_id].fc_range < FC_RANGE_MAX)
{ {
configuration.fc_range[instance_id]++; configuration.dexed[instance_id].fc_range++;
} }
} }
else if (LCDML.BT_checkUp()) else if (LCDML.BT_checkUp())
{ {
if (configuration.fc_range[instance_id] > FC_RANGE_MIN) if (configuration.dexed[instance_id].fc_range > FC_RANGE_MIN)
{ {
configuration.fc_range[instance_id]--; configuration.dexed[instance_id].fc_range--;
} }
} }
lcd.setCursor(0, 1); lcd.setCursor(0, 1);
lcd_display_int(configuration.fc_range[instance_id], 2, false, true, false); lcd_display_int(configuration.dexed[instance_id].fc_range, 2, false, true, false);
MicroDexed[instance_id]->setFCController(configuration.fc_range[instance_id], configuration.fc_assign[instance_id]); MicroDexed[instance_id]->setFCController(configuration.dexed[instance_id].fc_range, configuration.dexed[instance_id].fc_assign);
} }
if (LCDML.FUNC_close()) // ****** STABLE END ********* if (LCDML.FUNC_close()) // ****** STABLE END *********
@ -2149,21 +2199,21 @@ void UI_func_fc_assign(uint8_t param)
} }
else if (LCDML.BT_checkDown()) else if (LCDML.BT_checkDown())
{ {
if (configuration.fc_assign[instance_id] < FC_ASSIGN_MAX) if (configuration.dexed[instance_id].fc_assign < FC_ASSIGN_MAX)
{ {
configuration.fc_assign[instance_id]++; configuration.dexed[instance_id].fc_assign++;
} }
} }
else if (LCDML.BT_checkUp()) else if (LCDML.BT_checkUp())
{ {
if (configuration.fc_assign[instance_id] > FC_ASSIGN_MIN) if (configuration.dexed[instance_id].fc_assign > FC_ASSIGN_MIN)
{ {
configuration.fc_assign[instance_id]--; configuration.dexed[instance_id].fc_assign--;
} }
} }
lcd.setCursor(0, 1); lcd.setCursor(0, 1);
switch (configuration.fc_assign[instance_id]) switch (configuration.dexed[instance_id].fc_assign)
{ {
case 0: case 0:
lcd.print(F("[ NONE ]")); lcd.print(F("[ NONE ]"));
@ -2191,7 +2241,7 @@ void UI_func_fc_assign(uint8_t param)
break; break;
} }
MicroDexed[instance_id]->setFCController(configuration.fc_range[instance_id], configuration.fc_assign[instance_id]); MicroDexed[instance_id]->setFCController(configuration.dexed[instance_id].fc_range, configuration.dexed[instance_id].fc_assign);
} }
if (LCDML.FUNC_close()) // ****** STABLE END ********* if (LCDML.FUNC_close()) // ****** STABLE END *********
@ -2223,23 +2273,23 @@ void UI_func_bc_range(uint8_t param)
} }
else if (LCDML.BT_checkDown()) else if (LCDML.BT_checkDown())
{ {
if (configuration.bc_range[instance_id] < BC_RANGE_MAX) if (configuration.dexed[instance_id].bc_range < BC_RANGE_MAX)
{ {
configuration.bc_range[instance_id]++; configuration.dexed[instance_id].bc_range++;
} }
} }
else if (LCDML.BT_checkUp()) else if (LCDML.BT_checkUp())
{ {
if (configuration.bc_range[instance_id] > BC_RANGE_MIN) if (configuration.dexed[instance_id].bc_range > BC_RANGE_MIN)
{ {
configuration.bc_range[instance_id]--; configuration.dexed[instance_id].bc_range--;
} }
} }
lcd.setCursor(0, 1); lcd.setCursor(0, 1);
lcd_display_int(configuration.bc_range[instance_id], 2, false, true, false); lcd_display_int(configuration.dexed[instance_id].bc_range, 2, false, true, false);
MicroDexed[instance_id]->setBCController(configuration.bc_range[instance_id], configuration.bc_assign[instance_id]); MicroDexed[instance_id]->setBCController(configuration.dexed[instance_id].bc_range, configuration.dexed[instance_id].bc_assign);
} }
if (LCDML.FUNC_close()) // ****** STABLE END ********* if (LCDML.FUNC_close()) // ****** STABLE END *********
@ -2271,21 +2321,21 @@ void UI_func_bc_assign(uint8_t param)
} }
else if (LCDML.BT_checkDown()) else if (LCDML.BT_checkDown())
{ {
if (configuration.bc_assign[instance_id] < BC_ASSIGN_MAX) if (configuration.dexed[instance_id].bc_assign < BC_ASSIGN_MAX)
{ {
configuration.bc_assign[instance_id]++; configuration.dexed[instance_id].bc_assign++;
} }
} }
else if (LCDML.BT_checkUp()) else if (LCDML.BT_checkUp())
{ {
if (configuration.bc_assign[instance_id] > BC_ASSIGN_MIN) if (configuration.dexed[instance_id].bc_assign > BC_ASSIGN_MIN)
{ {
configuration.bc_assign[instance_id]--; configuration.dexed[instance_id].bc_assign--;
} }
} }
lcd.setCursor(0, 1); lcd.setCursor(0, 1);
switch (configuration.bc_assign[instance_id]) switch (configuration.dexed[instance_id].bc_assign)
{ {
case 0: case 0:
lcd.print(F("[ NONE ]")); lcd.print(F("[ NONE ]"));
@ -2313,7 +2363,7 @@ void UI_func_bc_assign(uint8_t param)
break; break;
} }
MicroDexed[instance_id]->setBCController(configuration.bc_range[instance_id], configuration.bc_assign[instance_id]); MicroDexed[instance_id]->setBCController(configuration.dexed[instance_id].bc_range, configuration.dexed[instance_id].bc_assign);
} }
if (LCDML.FUNC_close()) // ****** STABLE END ********* if (LCDML.FUNC_close()) // ****** STABLE END *********
@ -2345,23 +2395,23 @@ void UI_func_at_range(uint8_t param)
} }
else if (LCDML.BT_checkDown()) else if (LCDML.BT_checkDown())
{ {
if (configuration.at_range[instance_id] < AT_RANGE_MAX) if (configuration.dexed[instance_id].at_range < AT_RANGE_MAX)
{ {
configuration.at_range[instance_id]++; configuration.dexed[instance_id].at_range++;
} }
} }
else if (LCDML.BT_checkUp()) else if (LCDML.BT_checkUp())
{ {
if (configuration.at_range[instance_id] > AT_RANGE_MIN) if (configuration.dexed[instance_id].at_range > AT_RANGE_MIN)
{ {
configuration.at_range[instance_id]--; configuration.dexed[instance_id].at_range--;
} }
} }
lcd.setCursor(0, 1); lcd.setCursor(0, 1);
lcd_display_int(configuration.at_range[instance_id], 2, false, true, false); lcd_display_int(configuration.dexed[instance_id].at_range, 2, false, true, false);
MicroDexed[instance_id]->setATController(configuration.at_range[instance_id], configuration.at_assign[instance_id]); MicroDexed[instance_id]->setATController(configuration.dexed[instance_id].at_range, configuration.dexed[instance_id].at_assign);
} }
if (LCDML.FUNC_close()) // ****** STABLE END ********* if (LCDML.FUNC_close()) // ****** STABLE END *********
@ -2393,21 +2443,21 @@ void UI_func_at_assign(uint8_t param)
} }
else if (LCDML.BT_checkDown()) else if (LCDML.BT_checkDown())
{ {
if (configuration.at_assign[instance_id] < AT_ASSIGN_MAX) if (configuration.dexed[instance_id].at_assign < AT_ASSIGN_MAX)
{ {
configuration.at_assign[instance_id]++; configuration.dexed[instance_id].at_assign++;
} }
} }
else if (LCDML.BT_checkUp()) else if (LCDML.BT_checkUp())
{ {
if (configuration.at_assign[instance_id] > AT_ASSIGN_MIN) if (configuration.dexed[instance_id].at_assign > AT_ASSIGN_MIN)
{ {
configuration.at_assign[instance_id]--; configuration.dexed[instance_id].at_assign--;
} }
} }
lcd.setCursor(0, 1); lcd.setCursor(0, 1);
switch (configuration.at_assign[instance_id]) switch (configuration.dexed[instance_id].at_assign)
{ {
case 0: case 0:
lcd.print(F("[ NONE ]")); lcd.print(F("[ NONE ]"));
@ -2435,7 +2485,7 @@ void UI_func_at_assign(uint8_t param)
break; break;
} }
MicroDexed[instance_id]->setATController(configuration.at_range[instance_id], configuration.at_assign[instance_id]); MicroDexed[instance_id]->setATController(configuration.dexed[instance_id].at_range, configuration.dexed[instance_id].at_assign);
} }
if (LCDML.FUNC_close()) // ****** STABLE END ********* if (LCDML.FUNC_close()) // ****** STABLE END *********
@ -2480,17 +2530,17 @@ void UI_func_voice_selection(uint8_t param)
menu_state = MENU_VOICE; menu_state = MENU_VOICE;
strip_extension(bank_names[selected_dexed_instance][configuration.bank[selected_dexed_instance]], bank_name[selected_dexed_instance]); strip_extension(bank_names[selected_dexed_instance][configuration.dexed[selected_dexed_instance].bank], bank_name[selected_dexed_instance]);
//LCDML.DISP_clear(); //LCDML.DISP_clear();
// display bank and voice number // display bank and voice number
lcd.show(0, 0, 2, configuration.bank[selected_dexed_instance]); lcd.show(0, 0, 2, configuration.dexed[selected_dexed_instance].bank);
lcd.show(1, 0, 2, configuration.voice[selected_dexed_instance] + 1); lcd.show(1, 0, 2, configuration.dexed[selected_dexed_instance].voice + 1);
// display names // display names
lcd.show(0, 4, 10, bank_name[selected_dexed_instance]); lcd.show(0, 4, 10, bank_name[selected_dexed_instance]);
lcd.show(1, 4, 10, voice_names[selected_dexed_instance][configuration.voice[selected_dexed_instance]]); lcd.show(1, 4, 10, voice_names[selected_dexed_instance][configuration.dexed[selected_dexed_instance].voice]);
// display selected Dexed instance // display selected Dexed instance
if (selected_dexed_instance == 1) if (selected_dexed_instance == 1)
@ -2564,7 +2614,7 @@ void UI_func_volume(uint8_t param)
else else
lcd.print(F(" ")); lcd.print(F(" "));
} }
set_volume(configuration.vol, configuration.pan[instance_id], configuration.mono); set_volume(configuration.vol, configuration.dexed[instance_id].pan, configuration.mono);
eeprom_write(); eeprom_write();
} }

@ -150,7 +150,7 @@
//* DEBUG OUTPUT SETTINGS //* DEBUG OUTPUT SETTINGS
//************************************************************************************************* //*************************************************************************************************
#define DEBUG 1 #define DEBUG 1
//#define SERIAL_SPEED 38400 //#define SERIAL_SPEED 230400
#define SERIAL_SPEED 9600 #define SERIAL_SPEED 9600
#define SHOW_XRUN 1 #define SHOW_XRUN 1
#define SHOW_CPU_LOAD_MSEC 5000 #define SHOW_CPU_LOAD_MSEC 5000
@ -412,6 +412,34 @@ enum { DEXED, REVERB, DELAY, CHORUS };
#define INSTANCE_SPLITPOINT_MAX MIDI_B7 #define INSTANCE_SPLITPOINT_MAX MIDI_B7
#define INSTANCE_SPLITPOINT_DEFAULT MIDI_C3 #define INSTANCE_SPLITPOINT_DEFAULT MIDI_C3
//
struct dexed_t {
uint8_t midi_channel;
uint8_t bank;
uint8_t voice;
int8_t pan;
uint8_t reverb_level;
uint8_t chorus_level;
uint8_t delay_level;
uint8_t filter_cutoff;
uint8_t filter_resonance;
uint8_t loudness;
uint8_t polyphony;
uint8_t engine;
uint8_t monopoly;
uint8_t pb_range;
uint8_t pb_step;
uint8_t mw_range;
uint8_t mw_assign;
uint8_t fc_range;
uint8_t fc_assign;
uint8_t bc_range;
uint8_t bc_assign;
uint8_t at_range;
uint8_t at_assign;
uint8_t op_enabled;
};
// struct for holding the current configuration // struct for holding the current configuration
struct config_t { struct config_t {
uint32_t checksum; uint32_t checksum;
@ -427,30 +455,7 @@ struct config_t {
uint8_t chorus_depth; uint8_t chorus_depth;
uint8_t delay_time; uint8_t delay_time;
uint8_t delay_feedback; uint8_t delay_feedback;
uint8_t midi_channel[NUM_DEXED]; struct dexed_t dexed[NUM_DEXED];
uint8_t bank[NUM_DEXED];
uint8_t voice[NUM_DEXED];
int8_t pan[NUM_DEXED];
uint8_t reverb_level[NUM_DEXED];
uint8_t chorus_level[NUM_DEXED];
uint8_t delay_level[NUM_DEXED];
uint8_t filter_cutoff[NUM_DEXED];
uint8_t filter_resonance[NUM_DEXED];
uint8_t loudness[NUM_DEXED];
uint8_t polyphony[NUM_DEXED];
uint8_t engine[NUM_DEXED];
uint8_t monopoly[NUM_DEXED];
uint8_t pb_range[NUM_DEXED];
uint8_t pb_step[NUM_DEXED];
uint8_t mw_range[NUM_DEXED];
uint8_t mw_assign[NUM_DEXED];
uint8_t fc_range[NUM_DEXED];
uint8_t fc_assign[NUM_DEXED];
uint8_t bc_range[NUM_DEXED];
uint8_t bc_assign[NUM_DEXED];
uint8_t at_range[NUM_DEXED];
uint8_t at_assign[NUM_DEXED];
uint8_t op_enabled[NUM_DEXED];
}; };
inline float mapfloat(float val, float in_min, float in_max, float out_min, float out_max) inline float mapfloat(float val, float in_min, float in_max, float out_min, float out_max)

Loading…
Cancel
Save