Fixes for dual instances.

pull/32/head
Holger Wirtz 5 years ago
parent 938bc40e71
commit 350568d2ca
  1. 49
      MicroDexed.ino
  2. 132
      UI.hpp
  3. 14
      UI_2.h
  4. 3
      dexed.cpp

@ -149,7 +149,6 @@ void create_audio_engine_chain(uint8_t instance_id)
delay_fx[instance_id] = new AudioEffectDelay(); delay_fx[instance_id] = new AudioEffectDelay();
delay_mixer[instance_id] = new AudioMixer4(); delay_mixer[instance_id] = new AudioMixer4();
#endif #endif
mono2stereo[instance_id] = new AudioEffectMonoStereo();
dynamicConnections[nDynamic++] = new AudioConnection(*MicroDexed[instance_id], 0, microdexed_peak_mixer, instance_id); dynamicConnections[nDynamic++] = new AudioConnection(*MicroDexed[instance_id], 0, microdexed_peak_mixer, instance_id);
dynamicConnections[nDynamic++] = new AudioConnection(*MicroDexed[instance_id], 0, *dexed_level[instance_id], 0); dynamicConnections[nDynamic++] = new AudioConnection(*MicroDexed[instance_id], 0, *dexed_level[instance_id], 0);
@ -217,6 +216,8 @@ int16_t delayline[MOD_DELAY_SAMPLE_BUFFER][NUM_DEXED];
extern LCDMenuLib2 LCDML; extern LCDMenuLib2 LCDML;
#endif #endif
extern void getNoteName(char* noteName, uint8_t noteNumber);
/*********************************************************************** /***********************************************************************
SETUP SETUP
***********************************************************************/ ***********************************************************************/
@ -544,7 +545,20 @@ void handleNoteOn(byte inChannel, byte inNumber, byte inVelocity)
if (checkMidiChannel(inChannel, instance_id)) if (checkMidiChannel(inChannel, instance_id))
{ {
if (inNumber >= configuration.dexed[instance_id].lowest_note && inNumber <= configuration.dexed[instance_id].highest_note) if (inNumber >= configuration.dexed[instance_id].lowest_note && inNumber <= configuration.dexed[instance_id].highest_note)
{
MicroDexed[instance_id]->keydown(inNumber, uint8_t(float(configuration.dexed[instance_id].velocity_level / 127.0)*inVelocity + 0.5)); MicroDexed[instance_id]->keydown(inNumber, uint8_t(float(configuration.dexed[instance_id].velocity_level / 127.0)*inVelocity + 0.5));
#ifdef DEBUG
char note_name[4];
getNoteName(note_name, inNumber);
Serial.print(F("Keydown "));
Serial.print(note_name);
Serial.print(F(" instance "));
Serial.print(instance_id, DEC);
Serial.print(F(" MIDI-channel "));
Serial.print(inChannel, DEC);
Serial.println();
#endif
}
} }
} }
} }
@ -556,7 +570,20 @@ void handleNoteOff(byte inChannel, byte inNumber, byte inVelocity)
if (checkMidiChannel(inChannel, instance_id)) if (checkMidiChannel(inChannel, instance_id))
{ {
if (inNumber >= configuration.dexed[instance_id].lowest_note && inNumber <= configuration.dexed[instance_id].highest_note) if (inNumber >= configuration.dexed[instance_id].lowest_note && inNumber <= configuration.dexed[instance_id].highest_note)
{
MicroDexed[instance_id]->keyup(inNumber); MicroDexed[instance_id]->keyup(inNumber);
#ifdef DEBUG
char note_name[4];
getNoteName(note_name, inNumber);
Serial.print(F("KeyUp "));
Serial.print(note_name);
Serial.print(F(" instance "));
Serial.print(instance_id, DEC);
Serial.print(F(" MIDI-channel "));
Serial.print(inChannel, DEC);
Serial.println();
#endif
}
} }
} }
} }
@ -1369,10 +1396,6 @@ void initial_values_from_eeprom(bool init)
MicroDexed[instance_id]->fx.Gain = 1.0; MicroDexed[instance_id]->fx.Gain = 1.0;
MicroDexed[instance_id]->fx.Reso = mapfloat(configuration.dexed[instance_id].filter_resonance, FILTER_RESONANCE_MIN, FILTER_RESONANCE_MAX, 1.0, 0.0); MicroDexed[instance_id]->fx.Reso = mapfloat(configuration.dexed[instance_id].filter_resonance, FILTER_RESONANCE_MIN, FILTER_RESONANCE_MAX, 1.0, 0.0);
MicroDexed[instance_id]->fx.Cutoff = mapfloat(configuration.dexed[instance_id].filter_cutoff, FILTER_CUTOFF_MIN, FILTER_CUTOFF_MAX, 1.0, 0.0); MicroDexed[instance_id]->fx.Cutoff = mapfloat(configuration.dexed[instance_id].filter_cutoff, FILTER_CUTOFF_MIN, FILTER_CUTOFF_MAX, 1.0, 0.0);
#endif
MicroDexed[instance_id]->setOPs(configuration.dexed[instance_id].op_enabled);
dexed_level[instance_id]->gain(mapfloat(configuration.dexed[instance_id].sound_intensity, SOUND_INTENSITY_MIN, SOUND_INTENSITY_MAX, 0.0, SOUND_INTENSITY_AMP_MAX));
#if NUM_DEXED >1 #if NUM_DEXED >1
reverb_mixer_r.gain(instance_id, configuration.fx.reverb_send[instance_id] / 100.0); reverb_mixer_r.gain(instance_id, configuration.fx.reverb_send[instance_id] / 100.0);
reverb_mixer_l.gain(instance_id, configuration.fx.reverb_send[instance_id] / 100.0); reverb_mixer_l.gain(instance_id, configuration.fx.reverb_send[instance_id] / 100.0);
@ -1380,7 +1403,9 @@ void initial_values_from_eeprom(bool init)
reverb_mixer_r.gain(instance_id, 1.0); reverb_mixer_r.gain(instance_id, 1.0);
reverb_mixer_l.gain(instance_id, 1.0); reverb_mixer_l.gain(instance_id, 1.0);
#endif #endif
#endif
MicroDexed[instance_id]->setOPs(configuration.dexed[instance_id].op_enabled);
dexed_level[instance_id]->gain(mapfloat(configuration.dexed[instance_id].sound_intensity, SOUND_INTENSITY_MIN, SOUND_INTENSITY_MAX, 0.0, SOUND_INTENSITY_AMP_MAX));
} }
set_volume(configuration.sys.vol, configuration.sys.mono); set_volume(configuration.sys.vol, configuration.sys.mono);
@ -1632,11 +1657,13 @@ void eeprom_update_dexed(uint8_t instance_id)
bool eeprom_get_dexed(uint8_t instance_id) bool eeprom_get_dexed(uint8_t instance_id)
{ {
#if NUM_DEXED>1 for (uint8_t instance_id = 0; instance_id < MAX_DEXED; instance_id++)
EEPROM.get(EEPROM_START_ADDRESS + offsetof(configuration_s, dexed[1]), configuration.dexed[1]); {
#else if (instance_id == 0)
EEPROM.get(EEPROM_START_ADDRESS + offsetof(configuration_s, dexed[0]), configuration.dexed[0]); EEPROM.get(EEPROM_START_ADDRESS + offsetof(configuration_s, dexed[0]), configuration.dexed[0]);
#endif else
EEPROM.get(EEPROM_START_ADDRESS + offsetof(configuration_s, dexed[1]), configuration.dexed[1]);
}
return (true); return (true);
} }

132
UI.hpp

@ -1874,19 +1874,19 @@ void UI_func_polyphony(uint8_t param)
void UI_func_polyphony(uint8_t param) void UI_func_polyphony(uint8_t param)
{ {
char poly_value_string[3]; char poly_value_string[3];
static uint8_t instance_id; static uint8_t poly_instance_id;
if (LCDML.FUNC_setup()) // ****** SETUP ********* if (LCDML.FUNC_setup()) // ****** SETUP *********
{ {
encoderDir[ENC_R].reset(); encoderDir[ENC_R].reset();
if (LCDML.FUNC_getID() > MENU_ID_OF_INSTANCE_2) if (LCDML.FUNC_getID() > MENU_ID_OF_INSTANCE_2)
instance_id = 1; poly_instance_id = 1;
else else
instance_id = 0; poly_instance_id = 0;
lcd.show(0, 0, 16, "Polyphony"); lcd.show(0, 0, 16, "Polyphony");
if (instance_id == 0) if (poly_instance_id == 0)
lcd.show(1, 0, 16, "1:[ ] 2:"); lcd.show(1, 0, 16, "1:[ ] 2:");
else else
lcd.show(1, 0, 16, "1: 2:[ ]"); lcd.show(1, 0, 16, "1: 2:[ ]");
@ -1904,19 +1904,19 @@ void UI_func_polyphony(uint8_t param)
if (LCDML.BT_checkDown()) if (LCDML.BT_checkDown())
{ {
if (configuration.dexed[0].polyphony + configuration.dexed[1].polyphony + 1 <= POLYPHONY_MAX) if (configuration.dexed[0].polyphony + configuration.dexed[1].polyphony + 1 <= POLYPHONY_MAX)
configuration.dexed[instance_id].polyphony = constrain(configuration.dexed[instance_id].polyphony + 1, POLYPHONY_MIN, POLYPHONY_MAX); configuration.dexed[poly_instance_id].polyphony = constrain(configuration.dexed[poly_instance_id].polyphony + 1, POLYPHONY_MIN, POLYPHONY_MAX);
} }
else if (LCDML.BT_checkUp()) else if (LCDML.BT_checkUp())
{ {
if (configuration.dexed[instance_id].polyphony - 1 < 0) if (configuration.dexed[poly_instance_id].polyphony - 1 < 0)
configuration.dexed[instance_id].polyphony = 0; configuration.dexed[poly_instance_id].polyphony = 0;
else else
configuration.dexed[instance_id].polyphony = constrain(configuration.dexed[instance_id].polyphony - 1, POLYPHONY_MIN - 1, POLYPHONY_MAX); configuration.dexed[poly_instance_id].polyphony = constrain(configuration.dexed[poly_instance_id].polyphony - 1, POLYPHONY_MIN - 1, POLYPHONY_MAX);
} }
else if (LCDML.BT_checkEnter()) else if (LCDML.BT_checkEnter())
{ {
instance_id = !instance_id; poly_instance_id = !poly_instance_id;
if (instance_id == 0) if (poly_instance_id == 0)
lcd.show(1, 0, 16, "1:[ ] 2:"); lcd.show(1, 0, 16, "1:[ ] 2:");
else else
lcd.show(1, 0, 16, "1: 2:[ ]"); lcd.show(1, 0, 16, "1: 2:[ ]");
@ -1927,7 +1927,7 @@ void UI_func_polyphony(uint8_t param)
} }
} }
if (instance_id == 0) if (poly_instance_id == 0)
{ {
sprintf(poly_value_string, "%2d", configuration.dexed[0].polyphony); sprintf(poly_value_string, "%2d", configuration.dexed[0].polyphony);
lcd.show(1, 3, 2, poly_value_string); lcd.show(1, 3, 2, poly_value_string);
@ -3307,7 +3307,7 @@ void UI_func_eeprom_reset(uint8_t param)
void UI_func_voice_select(uint8_t param) void UI_func_voice_select(uint8_t param)
{ {
static uint8_t instance_id = 0; static uint8_t voice_select_instance_id;
static uint8_t menu_voice_select = MENU_VOICE_SOUND; static uint8_t menu_voice_select = MENU_VOICE_SOUND;
if (LCDML.FUNC_setup()) // ****** SETUP ********* if (LCDML.FUNC_setup()) // ****** SETUP *********
@ -3317,32 +3317,32 @@ void UI_func_voice_select(uint8_t param)
encoderDir[ENC_R].reset(); encoderDir[ENC_R].reset();
if (LCDML.FUNC_getID() > MENU_ID_OF_INSTANCE_2) if (LCDML.FUNC_getID() > MENU_ID_OF_INSTANCE_2)
instance_id = 1; voice_select_instance_id = 1;
else else
instance_id = 0; voice_select_instance_id = 0;
char bank_name[BANK_NAME_LEN]; char bank_name[BANK_NAME_LEN];
char voice_name[VOICE_NAME_LEN]; char voice_name[VOICE_NAME_LEN];
if (!get_bank_name(configuration.performance.bank[instance_id], bank_name, sizeof(bank_name))) if (!get_bank_name(configuration.performance.bank[voice_select_instance_id], bank_name, sizeof(bank_name)))
strncpy(bank_name, "*ERROR*", sizeof(bank_name)); strncpy(bank_name, "*ERROR*", sizeof(bank_name));
if (!get_voice_by_bank_name(configuration.performance.bank[instance_id], bank_name, configuration.performance.voice[instance_id], voice_name, sizeof(voice_name))) if (!get_voice_by_bank_name(configuration.performance.bank[voice_select_instance_id], bank_name, configuration.performance.voice[voice_select_instance_id], voice_name, sizeof(voice_name)))
strncpy(voice_name, "*ERROR*", sizeof(voice_name)); strncpy(voice_name, "*ERROR*", sizeof(voice_name));
lcd.show(0, 0, 2, configuration.performance.bank[instance_id]); lcd.show(0, 0, 2, configuration.performance.bank[voice_select_instance_id]);
lcd.show(1, 0, 2, configuration.performance.voice[instance_id] + 1); lcd.show(1, 0, 2, configuration.performance.voice[voice_select_instance_id] + 1);
lcd.show(0, 4, 10, bank_name); lcd.show(0, 4, 10, bank_name);
lcd.show(1, 4, 10, voice_name); lcd.show(1, 4, 10, voice_name);
#if NUM_DEXED > 1 #if NUM_DEXED > 1
lcd.setCursor(15, 0); lcd.setCursor(15, 0);
if (instance_id == 0) if (voice_select_instance_id == 0)
lcd.write(instance_id); lcd.write(voice_select_instance_id);
else else
lcd.write(2); lcd.write(2);
lcd.setCursor(15, 1); lcd.setCursor(15, 1);
if (instance_id == 1) if (voice_select_instance_id == 1)
lcd.write(instance_id); lcd.write(voice_select_instance_id);
else else
lcd.write(3); lcd.write(3);
#endif #endif
@ -3379,37 +3379,37 @@ void UI_func_voice_select(uint8_t param)
switch (menu_voice_select) switch (menu_voice_select)
{ {
case MENU_VOICE_BANK: case MENU_VOICE_BANK:
memset(g_bank_name[instance_id], 0, BANK_NAME_LEN); memset(g_bank_name[voice_select_instance_id], 0, BANK_NAME_LEN);
bank_tmp = constrain(configuration.performance.bank[instance_id] - ENCODER[ENC_R].speed(), 0, MAX_BANKS - 1); bank_tmp = constrain(configuration.performance.bank[voice_select_instance_id] - ENCODER[ENC_R].speed(), 0, MAX_BANKS - 1);
configuration.performance.bank[instance_id] = bank_tmp; configuration.performance.bank[voice_select_instance_id] = bank_tmp;
#ifdef DISPLAY_LCD_SPI #ifdef DISPLAY_LCD_SPI
change_disp_sd(false); change_disp_sd(false);
#endif #endif
load_sd_voice(configuration.performance.bank[instance_id], configuration.performance.voice[instance_id], instance_id); load_sd_voice(configuration.performance.bank[voice_select_instance_id], configuration.performance.voice[voice_select_instance_id], voice_select_instance_id);
#ifdef DISPLAY_LCD_SPI #ifdef DISPLAY_LCD_SPI
change_disp_sd(true); change_disp_sd(true);
#endif #endif
break; break;
case MENU_VOICE_SOUND: case MENU_VOICE_SOUND:
memset(g_voice_name[instance_id], 0, VOICE_NAME_LEN); memset(g_voice_name[voice_select_instance_id], 0, VOICE_NAME_LEN);
voice_tmp = configuration.performance.voice[instance_id] - ENCODER[ENC_R].speed(); voice_tmp = configuration.performance.voice[voice_select_instance_id] - ENCODER[ENC_R].speed();
if (voice_tmp < 0 && configuration.performance.bank[instance_id] - 1 >= 0) if (voice_tmp < 0 && configuration.performance.bank[voice_select_instance_id] - 1 >= 0)
{ {
configuration.performance.bank[instance_id]--; configuration.performance.bank[voice_select_instance_id]--;
configuration.performance.bank[instance_id] = constrain(configuration.performance.bank[instance_id], 0, MAX_BANKS - 1); configuration.performance.bank[voice_select_instance_id] = constrain(configuration.performance.bank[voice_select_instance_id], 0, MAX_BANKS - 1);
} }
else if (voice_tmp < 0 && configuration.performance.bank[instance_id] - 1 <= 0) else if (voice_tmp < 0 && configuration.performance.bank[voice_select_instance_id] - 1 <= 0)
{ {
voice_tmp = 0; voice_tmp = 0;
} }
if (voice_tmp < 0) if (voice_tmp < 0)
voice_tmp = MAX_VOICES + voice_tmp; voice_tmp = MAX_VOICES + voice_tmp;
configuration.performance.voice[instance_id] = constrain(voice_tmp, 0, MAX_VOICES - 1); configuration.performance.voice[voice_select_instance_id] = constrain(voice_tmp, 0, MAX_VOICES - 1);
#ifdef DISPLAY_LCD_SPI #ifdef DISPLAY_LCD_SPI
change_disp_sd(false); change_disp_sd(false);
#endif #endif
load_sd_voice(configuration.performance.bank[instance_id], configuration.performance.voice[instance_id], instance_id); load_sd_voice(configuration.performance.bank[voice_select_instance_id], configuration.performance.voice[voice_select_instance_id], voice_select_instance_id);
#ifdef DISPLAY_LCD_SPI #ifdef DISPLAY_LCD_SPI
change_disp_sd(true); change_disp_sd(true);
#endif #endif
@ -3421,36 +3421,36 @@ void UI_func_voice_select(uint8_t param)
switch (menu_voice_select) switch (menu_voice_select)
{ {
case MENU_VOICE_BANK: case MENU_VOICE_BANK:
memset(g_bank_name[instance_id], 0, BANK_NAME_LEN); memset(g_bank_name[voice_select_instance_id], 0, BANK_NAME_LEN);
bank_tmp = constrain(configuration.performance.bank[instance_id] + ENCODER[ENC_R].speed(), 0, MAX_BANKS - 1); bank_tmp = constrain(configuration.performance.bank[voice_select_instance_id] + ENCODER[ENC_R].speed(), 0, MAX_BANKS - 1);
configuration.performance.bank[instance_id] = bank_tmp; configuration.performance.bank[voice_select_instance_id] = bank_tmp;
#ifdef DISPLAY_LCD_SPI #ifdef DISPLAY_LCD_SPI
change_disp_sd(false); change_disp_sd(false);
#endif #endif
load_sd_voice(configuration.performance.bank[instance_id], configuration.performance.voice[instance_id], instance_id); load_sd_voice(configuration.performance.bank[voice_select_instance_id], configuration.performance.voice[voice_select_instance_id], voice_select_instance_id);
#ifdef DISPLAY_LCD_SPI #ifdef DISPLAY_LCD_SPI
change_disp_sd(true); change_disp_sd(true);
#endif #endif
break; break;
case MENU_VOICE_SOUND: case MENU_VOICE_SOUND:
memset(g_voice_name[instance_id], 0, VOICE_NAME_LEN); memset(g_voice_name[voice_select_instance_id], 0, VOICE_NAME_LEN);
voice_tmp = configuration.performance.voice[instance_id] + ENCODER[ENC_R].speed(); voice_tmp = configuration.performance.voice[voice_select_instance_id] + ENCODER[ENC_R].speed();
if (voice_tmp >= MAX_VOICES && configuration.performance.bank[instance_id] + 1 < MAX_BANKS) if (voice_tmp >= MAX_VOICES && configuration.performance.bank[voice_select_instance_id] + 1 < MAX_BANKS)
{ {
voice_tmp %= MAX_VOICES; voice_tmp %= MAX_VOICES;
configuration.performance.bank[instance_id]++; configuration.performance.bank[voice_select_instance_id]++;
configuration.performance.bank[instance_id] = constrain(configuration.performance.bank[instance_id], 0, MAX_BANKS - 1); configuration.performance.bank[voice_select_instance_id] = constrain(configuration.performance.bank[voice_select_instance_id], 0, MAX_BANKS - 1);
} }
else if (voice_tmp >= MAX_VOICES && configuration.performance.bank[instance_id] + 1 >= MAX_BANKS) else if (voice_tmp >= MAX_VOICES && configuration.performance.bank[voice_select_instance_id] + 1 >= MAX_BANKS)
{ {
voice_tmp = MAX_VOICES - 1; voice_tmp = MAX_VOICES - 1;
} }
configuration.performance.voice[instance_id] = constrain(voice_tmp, 0, MAX_VOICES - 1); configuration.performance.voice[voice_select_instance_id] = constrain(voice_tmp, 0, MAX_VOICES - 1);
#ifdef DISPLAY_LCD_SPI #ifdef DISPLAY_LCD_SPI
change_disp_sd(false); change_disp_sd(false);
#endif #endif
load_sd_voice(configuration.performance.bank[instance_id], configuration.performance.voice[instance_id], instance_id); load_sd_voice(configuration.performance.bank[voice_select_instance_id], configuration.performance.voice[voice_select_instance_id], voice_select_instance_id);
#ifdef DISPLAY_LCD_SPI #ifdef DISPLAY_LCD_SPI
change_disp_sd(true); change_disp_sd(true);
#endif #endif
@ -3471,29 +3471,29 @@ void UI_func_voice_select(uint8_t param)
if (menu_voice_select == MENU_VOICE_BANK) if (menu_voice_select == MENU_VOICE_BANK)
{ {
menu_voice_select = MENU_VOICE_SOUND; menu_voice_select = MENU_VOICE_SOUND;
instance_id = !instance_id; voice_select_instance_id = !voice_select_instance_id;
char bank_name[BANK_NAME_LEN]; char bank_name[BANK_NAME_LEN];
char voice_name[VOICE_NAME_LEN]; char voice_name[VOICE_NAME_LEN];
if (!get_bank_name(configuration.performance.bank[instance_id], bank_name, sizeof(bank_name))) if (!get_bank_name(configuration.performance.bank[voice_select_instance_id], bank_name, sizeof(bank_name)))
strncpy(bank_name, "*ERROR*", sizeof(bank_name)); strncpy(bank_name, "*ERROR*", sizeof(bank_name));
if (!get_voice_by_bank_name(configuration.performance.bank[instance_id], bank_name, configuration.performance.voice[instance_id], voice_name, sizeof(voice_name))) if (!get_voice_by_bank_name(configuration.performance.bank[voice_select_instance_id], bank_name, configuration.performance.voice[voice_select_instance_id], voice_name, sizeof(voice_name)))
strncpy(voice_name, "*ERROR*", sizeof(voice_name)); strncpy(voice_name, "*ERROR*", sizeof(voice_name));
lcd.show(0, 0, 2, configuration.performance.bank[instance_id]); lcd.show(0, 0, 2, configuration.performance.bank[voice_select_instance_id]);
lcd.show(1, 0, 2, configuration.performance.voice[instance_id] + 1); lcd.show(1, 0, 2, configuration.performance.voice[voice_select_instance_id] + 1);
lcd.show(0, 4, 10, bank_name); lcd.show(0, 4, 10, bank_name);
lcd.show(1, 4, 10, voice_name); lcd.show(1, 4, 10, voice_name);
lcd.setCursor(15, 0); lcd.setCursor(15, 0);
if (instance_id == 0) if (voice_select_instance_id == 0)
lcd.write(instance_id); lcd.write(voice_select_instance_id);
else else
lcd.write(2); lcd.write(2);
lcd.setCursor(15, 1); lcd.setCursor(15, 1);
if (instance_id == 1) if (voice_select_instance_id == 1)
lcd.write(instance_id); lcd.write(voice_select_instance_id);
else else
lcd.write(3); lcd.write(3);
} }
@ -3503,28 +3503,28 @@ void UI_func_voice_select(uint8_t param)
#endif #endif
} }
if (strlen(g_bank_name[instance_id]) > 0) if (strlen(g_bank_name[voice_select_instance_id]) > 0)
{ {
strncpy(bank_name, g_bank_name[instance_id], sizeof(bank_name)); strncpy(bank_name, g_bank_name[voice_select_instance_id], sizeof(bank_name));
} }
else else
{ {
if (!get_bank_name(configuration.performance.bank[instance_id], bank_name, sizeof(bank_name))) if (!get_bank_name(configuration.performance.bank[voice_select_instance_id], bank_name, sizeof(bank_name)))
strncpy(bank_name, "*ERROR*", sizeof(bank_name)); strncpy(bank_name, "*ERROR*", sizeof(bank_name));
} }
if (strlen(g_voice_name[instance_id]) > 0) if (strlen(g_voice_name[voice_select_instance_id]) > 0)
{ {
strncpy(voice_name, g_voice_name[instance_id], sizeof(voice_name)); strncpy(voice_name, g_voice_name[voice_select_instance_id], sizeof(voice_name));
} }
else else
{ {
if (!get_voice_by_bank_name(configuration.performance.bank[instance_id], bank_name, configuration.performance.voice[instance_id], voice_name, sizeof(voice_name))) if (!get_voice_by_bank_name(configuration.performance.bank[voice_select_instance_id], bank_name, configuration.performance.voice[voice_select_instance_id], voice_name, sizeof(voice_name)))
strncpy(voice_name, "*ERROR*", sizeof(voice_name)); strncpy(voice_name, "*ERROR*", sizeof(voice_name));
} }
lcd.show(0, 0, 2, configuration.performance.bank[instance_id]); lcd.show(0, 0, 2, configuration.performance.bank[voice_select_instance_id]);
lcd.show(1, 0, 2, configuration.performance.voice[instance_id] + 1); lcd.show(1, 0, 2, configuration.performance.voice[voice_select_instance_id] + 1);
lcd.show(0, 4, 10, bank_name); lcd.show(0, 4, 10, bank_name);
lcd.show(1, 4, 10, voice_name); lcd.show(1, 4, 10, voice_name);
@ -3550,7 +3550,7 @@ void UI_func_voice_select(uint8_t param)
lcd_special_chars(SCROLLBAR); lcd_special_chars(SCROLLBAR);
encoderDir[ENC_R].reset(); encoderDir[ENC_R].reset();
if (instance_id == 0) if (voice_select_instance_id == 0)
{ {
//eeprom_update_var(offsetof(configuration_s, performance.voice[0]), configuration.performance.voice[0], "configuration.performance.voice[0]"); //eeprom_update_var(offsetof(configuration_s, performance.voice[0]), configuration.performance.voice[0], "configuration.performance.voice[0]");
//eeprom_update_var(offsetof(configuration_s, performance.bank[0]), configuration.performance.bank[0], "configuration.performance.bank[0]"); //eeprom_update_var(offsetof(configuration_s, performance.bank[0]), configuration.performance.bank[0], "configuration.performance.bank[0]");
@ -3560,8 +3560,8 @@ void UI_func_voice_select(uint8_t param)
#if NUM_DEXED > 1 #if NUM_DEXED > 1
else else
{ {
EEPROM.update(EEPROM_START_ADDRESS + offsetof(configuration_s, performance.voice[0]), configuration.performance.voice[1]); EEPROM.update(EEPROM_START_ADDRESS + offsetof(configuration_s, performance.voice[1]), configuration.performance.voice[1]);
EEPROM.update(EEPROM_START_ADDRESS + offsetof(configuration_s, performance.bank[0]), configuration.performance.bank[1]); EEPROM.update(EEPROM_START_ADDRESS + offsetof(configuration_s, performance.bank[1]), configuration.performance.bank[1]);
} }
#endif #endif
} }

@ -140,13 +140,13 @@ LCDML_add(111, LCDML_0_2_2, 2, "Save Voice Cfg", UI_func_save_voiceconfig);
LCDML_add(112, LCDML_0_2, 4, "MIDI", NULL); LCDML_add(112, LCDML_0_2, 4, "MIDI", NULL);
LCDML_add(113, LCDML_0_2_4, 1, "MIDI Recv Bank", UI_func_sysex_receive_bank); LCDML_add(113, LCDML_0_2_4, 1, "MIDI Recv Bank", UI_func_sysex_receive_bank);
LCDML_add(114, LCDML_0_2_4, 2, "MIDI Send Bank", UI_func_sysex_send_bank); LCDML_add(114, LCDML_0_2_4, 2, "MIDI Send Bank", UI_func_sysex_send_bank);
LCDML_add(116, LCDML_0, 3, "System", NULL); LCDML_add(115, LCDML_0, 3, "System", NULL);
LCDML_add(117, LCDML_0_3, 1, "Volume", UI_func_volume); LCDML_add(116, LCDML_0_3, 1, "Volume", UI_func_volume);
LCDML_add(118, LCDML_0_3, 2, "Stereo/Mono", UI_func_stereo_mono); LCDML_add(117, LCDML_0_3, 2, "Stereo/Mono", UI_func_stereo_mono);
LCDML_add(119, LCDML_0_3, 3, "MIDI Soft THRU", UI_func_midi_soft_thru); LCDML_add(118, LCDML_0_3, 3, "MIDI Soft THRU", UI_func_midi_soft_thru);
LCDML_add(120, LCDML_0_2, 4, "EEPROM Reset", UI_func_eeprom_reset); LCDML_add(119, LCDML_0_3, 4, "EEPROM Reset", UI_func_eeprom_reset);
LCDML_add(121, LCDML_0, 4, "Info", UI_func_information); LCDML_add(120, LCDML_0, 4, "Info", UI_func_information);
#define _LCDML_DISP_cnt 121 #define _LCDML_DISP_cnt 120
#define MENU_ID_OF_INSTANCE_2 52 #define MENU_ID_OF_INSTANCE_2 52
#endif #endif

@ -115,6 +115,9 @@ void Dexed::getSamples(uint16_t n_samples, int16_t* buffer)
uint8_t note; uint8_t note;
float sumbuf[n_samples]; float sumbuf[n_samples];
if (max_notes == 0)
return;
if (refreshVoice) if (refreshVoice)
{ {
for (i = 0; i < max_notes; i++) for (i = 0; i < max_notes; i++)

Loading…
Cancel
Save