Expose and rename CMultiColorLEDBar defines

This commit is contained in:
Peter L Jones 2020-03-29 12:18:59 +01:00
parent 321f286a6d
commit 70480cd626
4 changed files with 13 additions and 13 deletions

View file

@ -906,7 +906,7 @@ void CClientDlg::OnTimerSigMet()
// linear transformation of the input level range to the progress-bar // linear transformation of the input level range to the progress-bar
// range // range
dCurSigLevelL -= LOW_BOUND_SIG_METER; dCurSigLevelL -= LOW_BOUND_SIG_METER;
dCurSigLevelL *= NUM_STEPS_INP_LEV_METER / dCurSigLevelL *= NUM_STEPS_LED_BAR /
( UPPER_BOUND_SIG_METER - LOW_BOUND_SIG_METER ); ( UPPER_BOUND_SIG_METER - LOW_BOUND_SIG_METER );
// lower bound the signal // lower bound the signal
@ -916,7 +916,7 @@ void CClientDlg::OnTimerSigMet()
} }
dCurSigLevelR -= LOW_BOUND_SIG_METER; dCurSigLevelR -= LOW_BOUND_SIG_METER;
dCurSigLevelR *= NUM_STEPS_INP_LEV_METER / dCurSigLevelR *= NUM_STEPS_LED_BAR /
( UPPER_BOUND_SIG_METER - LOW_BOUND_SIG_METER ); ( UPPER_BOUND_SIG_METER - LOW_BOUND_SIG_METER );
// lower bound the signal // lower bound the signal

View file

@ -60,10 +60,6 @@
#define BUFFER_LED_UPDATE_TIME_MS 300 // ms #define BUFFER_LED_UPDATE_TIME_MS 300 // ms
#define LED_BAR_UPDATE_TIME_MS 1000 // ms #define LED_BAR_UPDATE_TIME_MS 1000 // ms
// range for signal level meter
#define LOW_BOUND_SIG_METER ( -50.0 ) // dB
#define UPPER_BOUND_SIG_METER ( 0.0 ) // dB
// number of ping times > upper bound until error message is shown // number of ping times > upper bound until error message is shown
#define NUM_HIGH_PINGS_UNTIL_ERROR 5 #define NUM_HIGH_PINGS_UNTIL_ERROR 5

View file

@ -169,10 +169,14 @@ LED bar: lbr
// maximum number of fader settings to be stored (together with the fader tags) // maximum number of fader settings to be stored (together with the fader tags)
#define MAX_NUM_STORED_FADER_SETTINGS 100 #define MAX_NUM_STORED_FADER_SETTINGS 100
// defines for LED input level meter // defines for LED level meter CMultiColorLEDBar
#define NUM_STEPS_INP_LEV_METER 8 #define NUM_STEPS_LED_BAR 8
#define RED_BOUND_INP_LEV_METER 7 #define RED_BOUND_LED_BAR 7
#define YELLOW_BOUND_INP_LEV_METER 5 #define YELLOW_BOUND_LED_BAR 5
// range for signal level meter
#define LOW_BOUND_SIG_METER ( -50.0 ) // dB
#define UPPER_BOUND_SIG_METER ( 0.0 ) // dB
// Maximum number of connected clients at the server. If you want to change this // Maximum number of connected clients at the server. If you want to change this
// paramter you have to modify the code on some places, too! The code tag // paramter you have to modify the code on some places, too! The code tag

View file

@ -33,7 +33,7 @@ CMultiColorLEDBar::CMultiColorLEDBar ( QWidget* parent, Qt::WindowFlags f )
: QFrame ( parent, f ) : QFrame ( parent, f )
{ {
// set total number of LEDs // set total number of LEDs
iNumLEDs = NUM_STEPS_INP_LEV_METER; iNumLEDs = NUM_STEPS_LED_BAR;
// create layout and set spacing to zero // create layout and set spacing to zero
pMainLayout = new QVBoxLayout ( this ); pMainLayout = new QVBoxLayout ( this );
@ -105,14 +105,14 @@ void CMultiColorLEDBar::setValue ( const int value )
if ( iLEDIdx < value ) if ( iLEDIdx < value )
{ {
// check which color we should use (green, yellow or red) // check which color we should use (green, yellow or red)
if ( iLEDIdx < YELLOW_BOUND_INP_LEV_METER ) if ( iLEDIdx < YELLOW_BOUND_LED_BAR )
{ {
// green region // green region
vecpLEDs[iLEDIdx]->setColor ( cLED::RL_GREEN ); vecpLEDs[iLEDIdx]->setColor ( cLED::RL_GREEN );
} }
else else
{ {
if ( iLEDIdx < RED_BOUND_INP_LEV_METER ) if ( iLEDIdx < RED_BOUND_LED_BAR )
{ {
// yellow region // yellow region
vecpLEDs[iLEDIdx]->setColor ( cLED::RL_YELLOW ); vecpLEDs[iLEDIdx]->setColor ( cLED::RL_YELLOW );