@ -107,9 +107,9 @@ extern float _loudness;
/******************************************
/******************************************
TEXT GETTER FUCTIONS
TEXT GETTER FUCTIONS
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
const char comp_gain_value_text1 [ ] PROGMEM = " 0 dB " ;
char comp_gain_value_text1 [ ] = " 0 dB " ;
const char comp_gain_value_text2 [ ] PROGMEM = " + 6 dB " ;
char comp_gain_value_text2 [ ] = " + 6 dB " ;
const char comp_gain_value_text3 [ ] PROGMEM = " +12 dB " ;
char comp_gain_value_text3 [ ] = " +12 dB " ;
char * get_comp_gain_value_text ( void )
char * get_comp_gain_value_text ( void )
{
{
switch ( configuration . comp_gain )
switch ( configuration . comp_gain )
@ -127,10 +127,10 @@ char* get_comp_gain_value_text(void)
return ( ' \0 ' ) ;
return ( ' \0 ' ) ;
}
}
const char comp_response_value_text1 [ ] PROGMEM = " 0 ms " ;
char comp_response_value_text1 [ ] = " 0 ms " ;
const char comp_response_value_text2 [ ] PROGMEM = " 25 ms " ;
char comp_response_value_text2 [ ] = " 25 ms " ;
const char comp_response_value_text3 [ ] PROGMEM = " 50 ms " ;
char comp_response_value_text3 [ ] = " 50 ms " ;
const char comp_response_value_text4 [ ] PROGMEM = " 100 ms " ;
char comp_response_value_text4 [ ] = " 100 ms " ;
char * get_comp_response_value_text ( void )
char * get_comp_response_value_text ( void )
{
{
switch ( configuration . comp_response )
switch ( configuration . comp_response )
@ -151,20 +151,14 @@ char* get_comp_response_value_text(void)
return ( ' \0 ' ) ;
return ( ' \0 ' ) ;
}
}
const char comp_limit_value_text1 [ ] PROGMEM = " soft Knee " ;
char comp_limit_value_text1 [ ] = " soft Knee " ;
const char comp_limit_value_text2 [ ] PROGMEM = " hard Knee " ;
char comp_limit_value_text2 [ ] = " hard Knee " ;
char * get_comp_limit_value_text ( void )
char * get_comp_limit_value_text ( void )
{
{
switch ( configuration . comp_limit )
if ( configuration . comp_limit = = false )
{
case false :
return ( comp_limit_value_text1 ) ;
return ( comp_limit_value_text1 ) ;
break ;
else
case true :
return ( comp_limit_value_text2 ) ;
return ( comp_limit_value_text2 ) ;
break ;
}
return ( ' \0 ' ) ;
}
}
char comp_threshold_value_text1 [ ] = " " ;
char comp_threshold_value_text1 [ ] = " " ;
@ -1813,7 +1807,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 , ( 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
sgtl5000_1 . autoVolumeControl ( tmp , configuration . comp_response , configuration . comp_limit , ( float ) configuration . comp_threshold , ( float ) configuration . comp_attack / 10 , ( float ) configuration . comp_decay / 10 ) ; // maxGain, response, hardLimit, threshold, attack, decay, e.g.: 1, 1, 1, 0.9, 0.01, 0.05
configuration . comp_gain = value ;
configuration . comp_gain = value ;
}
}
@ -1824,7 +1818,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 , ( 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
sgtl5000_1 . autoVolumeControl ( configuration . comp_gain , tmp , configuration . comp_limit , ( float ) configuration . comp_threshold , ( float ) configuration . comp_attack / 10 , ( float ) configuration . comp_decay / 10 ) ; // maxGain, response, hardLimit, threshold, attack, decay, e.g.: 1, 1, 1, 0.9, 0.01, 0.05
configuration . comp_response = value ;
configuration . comp_response = value ;
}
}
@ -1835,7 +1829,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 , ( 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
sgtl5000_1 . autoVolumeControl ( configuration . comp_gain , configuration . comp_response , tmp , ( float ) configuration . comp_threshold , ( float ) configuration . comp_attack / 10 , ( float ) configuration . comp_decay / 10 ) ; // maxGain, response, hardLimit, threshold, attack, decay, e.g.: 1, 1, 1, 0.9, 0.01, 0.05
configuration . comp_limit = value ;
configuration . comp_limit = value ;
}
}
@ -1846,7 +1840,7 @@ void set_comp_threshold(uint8_t value)
Serial . println ( value ) ;
Serial . println ( value ) ;
# endif
# endif
//float tmp = mapfloat(float(value), ENC_COMP_THRESHOLD_MIN, ENC_COMP_THRESHOLD_MAX, 0.0, 1.0);
//float tmp = mapfloat(float(value), ENC_COMP_THRESHOLD_MIN, ENC_COMP_THRESHOLD_MAX, 0.0, 1.0);
sgtl5000_1 . autoVolumeControl ( configuration . comp_gain , configuration . comp_response , configuration . comp_limit , ( float ) value , ( 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
sgtl5000_1 . autoVolumeControl ( configuration . comp_gain , configuration . comp_response , configuration . comp_limit , ( float ) value , ( float ) configuration . comp_attack / 10 , ( float ) configuration . comp_decay / 10 ) ; // maxGain, response, hardLimit, threshold, attack, decay, e.g.: 1, 1, 1, 0.9, 0.01, 0.05
configuration . comp_threshold = value ;
configuration . comp_threshold = value ;
}
}
@ -1857,7 +1851,7 @@ void set_comp_attack(uint8_t value)
Serial . println ( value ) ;
Serial . println ( value ) ;
# endif
# endif
//float tmp = mapfloat(float(value), ENC_COMP_ATTACK_MIN, ENC_COMP_ATTACK_MAX, 0.0, 1.0);
//float tmp = mapfloat(float(value), ENC_COMP_ATTACK_MIN, ENC_COMP_ATTACK_MAX, 0.0, 1.0);
sgtl5000_1 . autoVolumeControl ( configuration . comp_gain , configuration . comp_response , configuration . comp_limit , ( float ) configuration . comp_threshold , ( float ) value / 10 , ( float ) 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 , configuration . comp_limit , ( float ) configuration . comp_threshold , ( float ) value / 10 , ( float ) configuration . comp_decay / 10 ) ; // maxGain, response, hardLimit, threshold, attack, decay, e.g.: 1, 1, 1, 0.9, 0.01, 0.05
configuration . comp_attack = value ;
configuration . comp_attack = value ;
}
}
@ -1868,7 +1862,7 @@ void set_comp_decay(uint8_t value)
Serial . println ( value ) ;
Serial . println ( value ) ;
# endif
# endif
//float tmp = mapfloat(float(value), ENC_COMP_DECAY_MIN, ENC_COMP_DECAY_MAX, 0.0, 1.0);
//float tmp = mapfloat(float(value), ENC_COMP_DECAY_MIN, ENC_COMP_DECAY_MAX, 0.0, 1.0);
sgtl5000_1 . autoVolumeControl ( configuration . comp_gain , configuration . comp_response , configuration . comp_limit , ( float ) configuration . comp_threshold , ( float ) configuration . comp_attack , ( float ) value / 10 ) ; // 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 , configuration . comp_limit , ( float ) configuration . comp_threshold , ( float ) configuration . comp_attack / 10 , ( float ) value / 10 ) ; // maxGain, response, hardLimit, threshold, attack, decay, e.g.: 1, 1, 1, 0.9, 0.01, 0.05
configuration . comp_decay = value ;
configuration . comp_decay = value ;
}
}
@ -1951,19 +1945,22 @@ void set_bass_lr_level(uint8_t value)
Serial . print ( F ( " Set BASS_LR_LEVEL " ) ) ;
Serial . print ( F ( " Set BASS_LR_LEVEL " ) ) ;
Serial . println ( value ) ;
Serial . println ( value ) ;
# endif
# endif
float tmp = mapfloat ( float ( value ) , ENC_BASS_LR_LEVEL_MIN , ENC_BASS_LR_LEVEL_MAX , 0.0 , 1.0 ) ;
float tmp1 = mapfloat ( float ( value ) , ENC_BASS_LR_LEVEL_MIN , ENC_BASS_LR_LEVEL_MAX , 0.0 , 1.0 ) ;
sgtl5000_1 . enhanceBass ( tmp , configuration . bass_mono_level ) ;
float tmp2 = mapfloat ( float ( configuration . bass_mono_level ) , ENC_BASS_MONO_LEVEL_MIN , ENC_BASS_MONO_LEVEL_MAX , 0.0 , 1.0 ) ;
sgtl5000_1 . enhanceBass ( tmp1 , tmp2 ) ;
configuration . bass_lr_level = value ;
configuration . bass_lr_level = value ;
}
}
void set_bass_mono_level ( uint8_t value )
void set_bass_mono_level ( uint8_t value )
{
{
# ifdef DEBUG
# ifdef DEBUG
Serial . print ( F ( " Set BASS_MONO_LEVEL " ) ) ;
Serial . print ( F ( " Set BASS_MONO_LEVEL " ) ) ;
Serial . println ( value ) ;
Serial . println ( value ) ;
# endif
# endif
float tmp = mapfloat ( float ( value ) , ENC_BASS_MONO_LEVEL_MIN , ENC_BASS_MONO_LEVEL_MAX , 0.0 , 1.0 ) ;
float tmp1 = mapfloat ( float ( configuration . bass_lr_level ) , ENC_BASS_LR_LEVEL_MIN , ENC_BASS_LR_LEVEL_MAX , 0.0 , 1.0 ) ;
sgtl5000_1 . enhanceBass ( configuration . bass_mono_level , tmp ) ;
float tmp2 = mapfloat ( float ( value ) , ENC_BASS_MONO_LEVEL_MIN , ENC_BASS_MONO_LEVEL_MAX , 0.0 , 1.0 ) ;
sgtl5000_1 . enhanceBass ( tmp1 , tmp2 ) ;
configuration . bass_mono_level = value ;
configuration . bass_mono_level = value ;
}
}
@ -1973,8 +1970,9 @@ void set_eq_bass(uint8_t value)
Serial . print ( F ( " Set EQ_BASS " ) ) ;
Serial . print ( F ( " Set EQ_BASS " ) ) ;
Serial . println ( value ) ;
Serial . println ( value ) ;
# endif
# endif
float tmp = mapfloat ( float ( value ) , ENC_EQ_BASS_MIN , ENC_EQ_BASS_MAX , 0.0 , 1.0 ) ;
float tmp1 = mapfloat ( float ( value ) , ENC_EQ_BASS_MIN , ENC_EQ_BASS_MAX , - 1.0 , 1.0 ) ;
sgtl5000_1 . eqBands ( tmp , configuration . eq_treble ) ;
float tmp2 = mapfloat ( float ( configuration . eq_treble ) , ENC_EQ_TREBLE_MIN , ENC_EQ_TREBLE_MAX , - 1.0 , 1.0 ) ;
sgtl5000_1 . eqBands ( tmp1 , tmp2 ) ;
configuration . eq_bass = value ;
configuration . eq_bass = value ;
}
}
@ -1984,8 +1982,9 @@ void set_eq_treble(uint8_t value)
Serial . print ( F ( " Set EQ_TREBLE " ) ) ;
Serial . print ( F ( " Set EQ_TREBLE " ) ) ;
Serial . println ( value ) ;
Serial . println ( value ) ;
# endif
# endif
float tmp = mapfloat ( float ( value ) , ENC_EQ_TREBLE_MIN , ENC_EQ_TREBLE_MAX , 0.0 , 1.0 ) ;
float tmp1 = mapfloat ( float ( configuration . eq_bass ) , ENC_EQ_BASS_MIN , ENC_EQ_BASS_MAX , - 1.0 , 1.0 ) ;
sgtl5000_1 . eqBands ( configuration . eq_bass , tmp ) ;
float tmp2 = mapfloat ( float ( value ) , ENC_EQ_TREBLE_MIN , ENC_EQ_TREBLE_MAX , - 1.0 , 1.0 ) ;
sgtl5000_1 . eqBands ( tmp1 , tmp2 ) ;
configuration . eq_treble = value ;
configuration . eq_treble = value ;
}
}