Added polyphony changing for 2 instances.

pull/32/head
Holger Wirtz 5 years ago
parent 414458bdf7
commit 0f18a756ae
  1. 80
      UI.hpp
  2. 2
      config.h

@ -1818,6 +1818,7 @@ void UI_func_stereo_mono(uint8_t param)
} }
} }
#if NUM_DEXED == 1
void UI_func_polyphony(uint8_t param) void UI_func_polyphony(uint8_t param)
{ {
uint8_t instance_id = 0; uint8_t instance_id = 0;
@ -1860,6 +1861,85 @@ void UI_func_polyphony(uint8_t param)
#endif #endif
} }
} }
#else
void UI_func_polyphony(uint8_t param)
{
char poly_value_string[3];
static uint8_t instance_id;
if (LCDML.FUNC_setup()) // ****** SETUP *********
{
encoderDir[ENC_R].reset();
if (LCDML.FUNC_getID() > MENU_ID_OF_INSTANCE_2)
instance_id = 1;
else
instance_id = 0;
lcd.show(0, 0, 16, "Polyphony");
if (instance_id == 0)
lcd.show(1, 0, 16, "1:[ ] 2:");
else
lcd.show(1, 0, 16, "1: 2:[ ]");
sprintf(poly_value_string, "%2d", configuration.dexed[0].polyphony);
lcd.show(1, 3, 2, poly_value_string);
sprintf(poly_value_string, "%2d", configuration.dexed[1].polyphony);
lcd.show(1, 13, 2, poly_value_string);
}
if (LCDML.FUNC_loop()) // ****** LOOP *********
{
if ((LCDML.BT_checkDown() && encoderDir[ENC_R].Down()) || (LCDML.BT_checkUp() && encoderDir[ENC_R].Up()) || (LCDML.BT_checkEnter() && encoderDir[ENC_R].ButtonShort()))
{
if (LCDML.BT_checkDown())
{
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);
}
else if (LCDML.BT_checkUp())
{
if (configuration.dexed[instance_id].polyphony - 1 < 0)
configuration.dexed[instance_id].polyphony = 0;
else
configuration.dexed[instance_id].polyphony = constrain(configuration.dexed[instance_id].polyphony - 1, POLYPHONY_MIN - 1, POLYPHONY_MAX);
}
else if (LCDML.BT_checkEnter())
{
instance_id = !instance_id;
if (instance_id == 0)
lcd.show(1, 0, 16, "1:[ ] 2:");
else
lcd.show(1, 0, 16, "1: 2:[ ]");
sprintf(poly_value_string, "%2d", configuration.dexed[0].polyphony);
lcd.show(1, 3, 2, poly_value_string);
sprintf(poly_value_string, "%2d", configuration.dexed[1].polyphony);
lcd.show(1, 13, 2, poly_value_string);
}
}
if (instance_id == 0)
{
sprintf(poly_value_string, "%2d", configuration.dexed[0].polyphony);
lcd.show(1, 3, 2, poly_value_string);
MicroDexed[0]->setMaxNotes(configuration.dexed[0].polyphony);
}
else
{
sprintf(poly_value_string, "%2d", configuration.dexed[1].polyphony);
lcd.show(1, 13, 2, poly_value_string);
MicroDexed[1]->setMaxNotes(configuration.dexed[1].polyphony);
}
}
if (LCDML.FUNC_close()) // ****** STABLE END *********
{
encoderDir[ENC_R].reset();
EEPROM.update(EEPROM_START_ADDRESS + offsetof(configuration_s, dexed[0].polyphony), configuration.dexed[0].polyphony);
EEPROM.update(EEPROM_START_ADDRESS + offsetof(configuration_s, dexed[1].polyphony), configuration.dexed[1].polyphony);
}
}
#endif
void UI_func_engine(uint8_t param) void UI_func_engine(uint8_t param)
{ {

@ -240,7 +240,7 @@
//************************************************************************************************* //*************************************************************************************************
//* DO NO CHANGE ANYTHING BEYOND IF YOU DON'T KNOW WHAT YOU ARE DOING !!! //* DO NO CHANGE ANYTHING BEYOND IF YOU DON'T KNOW WHAT YOU ARE DOING !!!
//************************************************************************************************* //*************************************************************************************************
#define NUM_DEXED 1 #define NUM_DEXED 2
#define MAX_DEXED 2 #define MAX_DEXED 2
//#define CPU_OVERLOAD_THROTTLE 95.0 // Level (in percent) when throttling should start //#define CPU_OVERLOAD_THROTTLE 95.0 // Level (in percent) when throttling should start
#define CPU_OVERLOAD_THROTTLE_TIMER 100 // timer (in ms) when next throttling is possible #define CPU_OVERLOAD_THROTTLE_TIMER 100 // timer (in ms) when next throttling is possible

Loading…
Cancel
Save