Added slightly better menus for the compressor.

Fixed parameters for compressor.
master
Holger Wirtz 6 years ago
parent 90da5567fc
commit 70f65bdcee
  1. 102
      UI.hpp

102
UI.hpp

@ -105,9 +105,9 @@ extern AudioAmplifier volume_l;
/****************************************** /******************************************
TEXT GETTER FUCTIONS TEXT GETTER FUCTIONS
******************************************/ ******************************************/
const char comp_gain_value_text1[] = " 0 dB"; const char comp_gain_value_text1[] PROGMEM = " 0 dB";
const char comp_gain_value_text2[] = "+ 6 dB"; const char comp_gain_value_text2[] PROGMEM = "+ 6 dB";
const char comp_gain_value_text3[] = "+12 dB"; const char comp_gain_value_text3[] PROGMEM = "+12 dB";
char* get_comp_gain_value_text(void) char* get_comp_gain_value_text(void)
{ {
@ -123,6 +123,79 @@ char* get_comp_gain_value_text(void)
return (comp_gain_value_text3); return (comp_gain_value_text3);
break; break;
} }
return ('\0');
}
const char comp_response_value_text1[] PROGMEM = " 0 ms";
const char comp_response_value_text2[] PROGMEM = " 25 ms";
const char comp_response_value_text3[] PROGMEM = " 50 ms";
const char comp_response_value_text4[] PROGMEM = "100 ms";
char* get_comp_response_value_text(void)
{
switch (configuration.comp_response)
{
case 0:
return (comp_response_value_text1);
break;
case 1:
return (comp_response_value_text2);
break;
case 2:
return (comp_response_value_text3);
break;
case 3:
return (comp_response_value_text4);
break;
}
return ('\0');
}
const char comp_limit_value_text1[] PROGMEM = "soft Knee";
const char comp_limit_value_text2[] PROGMEM = "hard Knee";
char* get_comp_limit_value_text(void)
{
switch (configuration.comp_limit)
{
case 0:
return (comp_limit_value_text1);
break;
case 1:
return (comp_limit_value_text2);
break;
}
return ('\0');
}
char comp_threshold_value_text1[] = " ";
char* get_comp_threshold_value_text(void)
{
if (configuration.comp_threshold == 0)
sprintf(comp_threshold_value_text1, " %0d dBFS", configuration.comp_threshold);
else
sprintf(comp_threshold_value_text1, "-%0d dBFS", configuration.comp_threshold);
return (comp_threshold_value_text1);
}
char comp_attack_value_text1[] = " ";
char* get_comp_attack_value_text(void)
{
sprintf(comp_attack_value_text1, "%0d dB/s", configuration.comp_attack);
return (comp_attack_value_text1);
}
char comp_decay_value_text1[] = " ";
char* get_comp_decay_value_text(void)
{
sprintf(comp_decay_value_text1, "%0d dB/s", configuration.comp_decay);
return (comp_decay_value_text1);
} }
/****************************************** /******************************************
@ -361,7 +434,8 @@ LiquidMenu comp_gain_menu(lcd);
#define NUM_COMP_RESPONSE_MENUS 1 #define NUM_COMP_RESPONSE_MENUS 1
const char comp_response_text1[] PROGMEM = "Comp. Response"; const char comp_response_text1[] PROGMEM = "Comp. Response";
LiquidLine comp_response_line1(1, 0, comp_response_text1); LiquidLine comp_response_line1(1, 0, comp_response_text1);
LiquidLine comp_response_line2(1, 1, configuration.comp_response); //LiquidLine comp_response_line2(1, 1, configuration.comp_response);
LiquidLine comp_response_line2(1, 1, get_comp_response_value_text);
LiquidScreen comp_response_screen; LiquidScreen comp_response_screen;
LiquidMenu comp_response_menu(lcd); LiquidMenu comp_response_menu(lcd);
@ -371,7 +445,8 @@ LiquidMenu comp_response_menu(lcd);
#define NUM_COMP_LIMIT_MENUS 1 #define NUM_COMP_LIMIT_MENUS 1
const char comp_limit_text1[] PROGMEM = "Comp. Limit"; const char comp_limit_text1[] PROGMEM = "Comp. Limit";
LiquidLine comp_limit_line1(1, 0, comp_limit_text1); LiquidLine comp_limit_line1(1, 0, comp_limit_text1);
LiquidLine comp_limit_line2(1, 1, configuration.comp_limit); //LiquidLine comp_limit_line2(1, 1, configuration.comp_limit);
LiquidLine comp_limit_line2(1, 1, get_comp_limit_value_text);
LiquidScreen comp_limit_screen; LiquidScreen comp_limit_screen;
LiquidMenu comp_limit_menu(lcd); LiquidMenu comp_limit_menu(lcd);
@ -381,7 +456,8 @@ LiquidMenu comp_limit_menu(lcd);
#define NUM_COMP_THRESHOLD_MENUS 1 #define NUM_COMP_THRESHOLD_MENUS 1
const char comp_threshold_text1[] PROGMEM = "Comp. Threshold"; const char comp_threshold_text1[] PROGMEM = "Comp. Threshold";
LiquidLine comp_threshold_line1(1, 0, comp_threshold_text1); LiquidLine comp_threshold_line1(1, 0, comp_threshold_text1);
LiquidLine comp_threshold_line2(1, 1, configuration.comp_threshold); //LiquidLine comp_threshold_line2(1, 1, configuration.comp_threshold);
LiquidLine comp_threshold_line2(1, 1, get_comp_threshold_value_text);
LiquidScreen comp_threshold_screen; LiquidScreen comp_threshold_screen;
LiquidMenu comp_threshold_menu(lcd); LiquidMenu comp_threshold_menu(lcd);
@ -391,7 +467,8 @@ LiquidMenu comp_threshold_menu(lcd);
#define NUM_COMP_ATTACK_MENUS 1 #define NUM_COMP_ATTACK_MENUS 1
const char comp_attack_text1[] PROGMEM = "Comp. Attack"; const char comp_attack_text1[] PROGMEM = "Comp. Attack";
LiquidLine comp_attack_line1(1, 0, comp_attack_text1); LiquidLine comp_attack_line1(1, 0, comp_attack_text1);
LiquidLine comp_attack_line2(1, 1, configuration.comp_attack); //LiquidLine comp_attack_line2(1, 1, configuration.comp_attack);
LiquidLine comp_attack_line2(1, 1, get_comp_attack_value_text);
LiquidScreen comp_attack_screen; LiquidScreen comp_attack_screen;
LiquidMenu comp_attack_menu(lcd); LiquidMenu comp_attack_menu(lcd);
@ -401,7 +478,8 @@ LiquidMenu comp_attack_menu(lcd);
#define NUM_COMP_DECAY_MENUS 1 #define NUM_COMP_DECAY_MENUS 1
const char comp_decay_text1[] PROGMEM = "Comp. Decay"; const char comp_decay_text1[] PROGMEM = "Comp. Decay";
LiquidLine comp_decay_line1(1, 0, comp_decay_text1); LiquidLine comp_decay_line1(1, 0, comp_decay_text1);
LiquidLine comp_decay_line2(1, 1, configuration.comp_decay); //LiquidLine comp_decay_line2(1, 1, configuration.comp_decay);
LiquidLine comp_decay_line2(1, 1, get_comp_decay_value_text);
LiquidScreen comp_decay_screen; LiquidScreen comp_decay_screen;
LiquidMenu comp_decay_menu(lcd); LiquidMenu comp_decay_menu(lcd);
@ -1101,7 +1179,7 @@ void callback_info_function()
/****************************************** /******************************************
HELPER MENU FUNCTION HELPER MENU FUNCTION
******************************************/ ******************************************/
float mapfloat(float val, float in_min, float in_max, float out_min, float out_max) float mapfloat(float val, float in_min, float in_max, float out_min, float out_max)
// e.g. mapfloat(float(effect_delay_feedback), 0, ENC_DELAY_FB_STEPS, 0.0, 1.0) // e.g. mapfloat(float(effect_delay_feedback), 0, ENC_DELAY_FB_STEPS, 0.0, 1.0)
{ {
@ -1659,7 +1737,7 @@ void set_comp_gain(uint8_t value)
Serial.println(value); Serial.println(value);
#endif #endif
float tmp = mapfloat(float(value), ENC_COMP_GAIN_MIN, ENC_COMP_GAIN_MAX, 0.0, 1.0); float tmp = mapfloat(float(value), ENC_COMP_GAIN_MIN, ENC_COMP_GAIN_MAX, 0.0, 1.0);
sgtl5000_1.autoVolumeControl(tmp, configuration.comp_response, configuration.comp_limit, configuration.comp_threshold, configuration.comp_attack, configuration.comp_decay); // maxGain, response, hardLimit, threshold, attack, decay, e.g.: 1, 1, 1, 0.9, 0.01, 0.05 sgtl5000_1.autoVolumeControl(tmp, configuration.comp_response, configuration.comp_limit, (float)configuration.comp_threshold, (float)configuration.comp_attack, (float)configuration.comp_decay); // maxGain, response, hardLimit, threshold, attack, decay, e.g.: 1, 1, 1, 0.9, 0.01, 0.05
} }
void set_comp_response(uint8_t value) void set_comp_response(uint8_t value)
@ -1669,7 +1747,7 @@ void set_comp_response(uint8_t value)
Serial.println(value); Serial.println(value);
#endif #endif
float tmp = mapfloat(float(value), ENC_COMP_RESPONSE_MIN, ENC_COMP_RESPONSE_MAX, 0.0, 1.0); float tmp = mapfloat(float(value), ENC_COMP_RESPONSE_MIN, ENC_COMP_RESPONSE_MAX, 0.0, 1.0);
sgtl5000_1.autoVolumeControl(configuration.comp_gain, tmp, configuration.comp_limit, configuration.comp_threshold, configuration.comp_attack, configuration.comp_decay); // maxGain, response, hardLimit, threshold, attack, decay, e.g.: 1, 1, 1, 0.9, 0.01, 0.05 sgtl5000_1.autoVolumeControl(configuration.comp_gain, tmp, configuration.comp_limit, (float)configuration.comp_threshold, (float)configuration.comp_attack, (float)configuration.comp_decay); // maxGain, response, hardLimit, threshold, attack, decay, e.g.: 1, 1, 1, 0.9, 0.01, 0.05
} }
void set_comp_limit(uint8_t value) void set_comp_limit(uint8_t value)
@ -1679,7 +1757,7 @@ void set_comp_limit(uint8_t value)
Serial.println(value); Serial.println(value);
#endif #endif
float tmp = mapfloat(float(value), ENC_COMP_LIMIT_MIN, ENC_COMP_LIMIT_MAX, 0.0, 1.0); float tmp = mapfloat(float(value), ENC_COMP_LIMIT_MIN, ENC_COMP_LIMIT_MAX, 0.0, 1.0);
sgtl5000_1.autoVolumeControl(configuration.comp_gain, configuration.comp_response, tmp, configuration.comp_threshold, configuration.comp_attack, configuration.comp_decay); // maxGain, response, hardLimit, threshold, attack, decay, e.g.: 1, 1, 1, 0.9, 0.01, 0.05 sgtl5000_1.autoVolumeControl(configuration.comp_gain, configuration.comp_response, tmp, (float)configuration.comp_threshold, (float)configuration.comp_attack, (float)configuration.comp_decay); // maxGain, response, hardLimit, threshold, attack, decay, e.g.: 1, 1, 1, 0.9, 0.01, 0.05
} }
void set_comp_threshold(uint8_t value) void set_comp_threshold(uint8_t value)

Loading…
Cancel
Save