first version of LED input level meter finished -> not yet ready, some work still has to be done
This commit is contained in:
parent
3537e2fc6d
commit
c9bb67ae14
7 changed files with 122 additions and 97 deletions
|
@ -107,9 +107,7 @@ CAudioMixerBoard::CAudioMixerBoard ( QWidget* parent, Qt::WindowFlags f ) : QFra
|
||||||
setFrameShadow ( QFrame::Sunken );
|
setFrameShadow ( QFrame::Sunken );
|
||||||
|
|
||||||
// add hboxlayout with horizontal spacer
|
// add hboxlayout with horizontal spacer
|
||||||
|
pMainLayout = new QHBoxLayout ( this );
|
||||||
// TODO is this ok this way? Don't we need the border 11 and space 0?
|
|
||||||
pMainLayout = new QHBoxLayout ( this );//, 11, 0 );
|
|
||||||
|
|
||||||
pMainLayout->addItem ( new QSpacerItem ( 0, 0, QSizePolicy::Expanding ) );
|
pMainLayout->addItem ( new QSpacerItem ( 0, 0, QSizePolicy::Expanding ) );
|
||||||
|
|
||||||
|
|
|
@ -96,6 +96,11 @@
|
||||||
#define MAX_NUMBER_SOUND_CARDS 10
|
#define MAX_NUMBER_SOUND_CARDS 10
|
||||||
#define INVALID_SNC_CARD_DEVICE -1
|
#define INVALID_SNC_CARD_DEVICE -1
|
||||||
|
|
||||||
|
// defines for LED input level meter
|
||||||
|
#define NUM_STEPS_INP_LEV_METER 10
|
||||||
|
#define YELLOW_BOUND_INP_LEV_METER 7
|
||||||
|
#define RED_BOUND_INP_LEV_METER 9
|
||||||
|
|
||||||
|
|
||||||
// maximum number of internet connections (channels)
|
// maximum number of internet connections (channels)
|
||||||
// if you want to change this paramter, there has to be done code modifications
|
// if you want to change this paramter, there has to be done code modifications
|
||||||
|
|
|
@ -36,11 +36,10 @@ CLlconClientDlg::CLlconClientDlg ( CClient* pNCliP, QWidget* parent,
|
||||||
|
|
||||||
// add help text to controls
|
// add help text to controls
|
||||||
QString strInpLevH = tr ( "<b>Input level meter:</b> Shows the level of the "
|
QString strInpLevH = tr ( "<b>Input level meter:</b> Shows the level of the "
|
||||||
"input audio signal of the sound card. The level is in dB. Overload "
|
"input audio signal of the sound card. Overload should be avoided." );
|
||||||
"should be avoided." );
|
TextLabelInputLevel->setWhatsThis ( strInpLevH );
|
||||||
TextLabelInputLevel->setWhatsThis ( strInpLevH );
|
MultiColorLEDBarInputLevelL->setWhatsThis ( strInpLevH );
|
||||||
ProgressBarInputLevelL->setWhatsThis ( strInpLevH );
|
MultiColorLEDBarInputLevelR->setWhatsThis ( strInpLevH );
|
||||||
ProgressBarInputLevelR->setWhatsThis ( strInpLevH );
|
|
||||||
|
|
||||||
PushButtonConnect->setWhatsThis ( tr ( "<b>Connect / Disconnect Button:"
|
PushButtonConnect->setWhatsThis ( tr ( "<b>Connect / Disconnect Button:"
|
||||||
"</b> Push this button to connect the server. A valid IP address has "
|
"</b> Push this button to connect the server. A valid IP address has "
|
||||||
|
@ -105,12 +104,8 @@ CLlconClientDlg::CLlconClientDlg ( CClient* pNCliP, QWidget* parent,
|
||||||
PushButtonConnect->setText ( CON_BUT_CONNECTTEXT );
|
PushButtonConnect->setText ( CON_BUT_CONNECTTEXT );
|
||||||
|
|
||||||
// init input level meter bars
|
// init input level meter bars
|
||||||
ProgressBarInputLevelL->setMinimum ( 0 );
|
MultiColorLEDBarInputLevelL->setValue ( 0 );
|
||||||
ProgressBarInputLevelL->setMaximum ( NUM_STEPS_INP_LEV_METER );
|
MultiColorLEDBarInputLevelR->setValue ( 0 );
|
||||||
ProgressBarInputLevelL->setValue ( 0 );
|
|
||||||
ProgressBarInputLevelR->setMinimum ( 0 );
|
|
||||||
ProgressBarInputLevelR->setMaximum ( NUM_STEPS_INP_LEV_METER );
|
|
||||||
ProgressBarInputLevelR->setValue ( 0 );
|
|
||||||
|
|
||||||
|
|
||||||
// init slider controls ---
|
// init slider controls ---
|
||||||
|
@ -296,8 +291,8 @@ void CLlconClientDlg::OnConnectDisconBut()
|
||||||
|
|
||||||
// stop timer for level meter bars and reset them
|
// stop timer for level meter bars and reset them
|
||||||
TimerSigMet.stop();
|
TimerSigMet.stop();
|
||||||
ProgressBarInputLevelL->setValue ( 0 );
|
MultiColorLEDBarInputLevelL->setValue ( 0 );
|
||||||
ProgressBarInputLevelR->setValue ( 0 );
|
MultiColorLEDBarInputLevelR->setValue ( 0 );
|
||||||
|
|
||||||
// immediately update status bar
|
// immediately update status bar
|
||||||
OnTimerStatus();
|
OnTimerStatus();
|
||||||
|
@ -353,8 +348,8 @@ void CLlconClientDlg::OnTimerSigMet()
|
||||||
double dCurSigLevelL = pClient->MicLevelL();
|
double dCurSigLevelL = pClient->MicLevelL();
|
||||||
double dCurSigLevelR = pClient->MicLevelR();
|
double dCurSigLevelR = pClient->MicLevelR();
|
||||||
|
|
||||||
/* 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_INP_LEV_METER /
|
||||||
( UPPER_BOUND_SIG_METER - LOW_BOUND_SIG_METER );
|
( UPPER_BOUND_SIG_METER - LOW_BOUND_SIG_METER );
|
||||||
|
@ -376,8 +371,8 @@ void CLlconClientDlg::OnTimerSigMet()
|
||||||
}
|
}
|
||||||
|
|
||||||
// show current level
|
// show current level
|
||||||
ProgressBarInputLevelL->setValue ( (int) ceil ( dCurSigLevelL ) );
|
MultiColorLEDBarInputLevelL->setValue ( (int) ceil ( dCurSigLevelL ) );
|
||||||
ProgressBarInputLevelR->setValue ( (int) ceil ( dCurSigLevelR ) );
|
MultiColorLEDBarInputLevelR->setValue ( (int) ceil ( dCurSigLevelR ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
void CLlconClientDlg::UpdateDisplay()
|
void CLlconClientDlg::UpdateDisplay()
|
||||||
|
|
|
@ -51,9 +51,6 @@
|
||||||
#define CON_BUT_CONNECTTEXT "C&onnect"
|
#define CON_BUT_CONNECTTEXT "C&onnect"
|
||||||
#define CON_BUT_DISCONNECTTEXT "D&isconnect"
|
#define CON_BUT_DISCONNECTTEXT "D&isconnect"
|
||||||
|
|
||||||
// steps for input level meter
|
|
||||||
#define NUM_STEPS_INP_LEV_METER 100
|
|
||||||
|
|
||||||
// update time for GUI controls
|
// update time for GUI controls
|
||||||
#define LEVELMETER_UPDATE_TIME 100 // ms
|
#define LEVELMETER_UPDATE_TIME 100 // ms
|
||||||
#define STATUSBAR_UPDATE_TIME 1000 // ms
|
#define STATUSBAR_UPDATE_TIME 1000 // ms
|
||||||
|
|
|
@ -5,8 +5,8 @@
|
||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>492</width>
|
<width>488</width>
|
||||||
<height>310</height>
|
<height>336</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowTitle" >
|
<property name="windowTitle" >
|
||||||
|
@ -28,21 +28,6 @@
|
||||||
<enum>QFrame::Raised</enum>
|
<enum>QFrame::Raised</enum>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QVBoxLayout" >
|
<layout class="QVBoxLayout" >
|
||||||
<property name="spacing" >
|
|
||||||
<number>6</number>
|
|
||||||
</property>
|
|
||||||
<property name="leftMargin" >
|
|
||||||
<number>9</number>
|
|
||||||
</property>
|
|
||||||
<property name="topMargin" >
|
|
||||||
<number>9</number>
|
|
||||||
</property>
|
|
||||||
<property name="rightMargin" >
|
|
||||||
<number>9</number>
|
|
||||||
</property>
|
|
||||||
<property name="bottomMargin" >
|
|
||||||
<number>9</number>
|
|
||||||
</property>
|
|
||||||
<item>
|
<item>
|
||||||
<widget class="QLabel" name="PixmapLabelCorrados" >
|
<widget class="QLabel" name="PixmapLabelCorrados" >
|
||||||
<property name="sizePolicy" >
|
<property name="sizePolicy" >
|
||||||
|
@ -67,21 +52,6 @@
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<layout class="QHBoxLayout" >
|
<layout class="QHBoxLayout" >
|
||||||
<property name="spacing" >
|
|
||||||
<number>6</number>
|
|
||||||
</property>
|
|
||||||
<property name="leftMargin" >
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="topMargin" >
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="rightMargin" >
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="bottomMargin" >
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<item>
|
<item>
|
||||||
<layout class="QVBoxLayout" >
|
<layout class="QVBoxLayout" >
|
||||||
<property name="spacing" >
|
<property name="spacing" >
|
||||||
|
@ -136,49 +106,37 @@
|
||||||
<item>
|
<item>
|
||||||
<layout class="QVBoxLayout" >
|
<layout class="QVBoxLayout" >
|
||||||
<property name="spacing" >
|
<property name="spacing" >
|
||||||
<number>6</number>
|
|
||||||
</property>
|
|
||||||
<property name="leftMargin" >
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="topMargin" >
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="rightMargin" >
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="bottomMargin" >
|
|
||||||
<number>0</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QProgressBar" name="ProgressBarInputLevelL" >
|
<widget class="CMultiColorLEDBar" native="1" name="MultiColorLEDBarInputLevelL" >
|
||||||
<property name="sizePolicy" >
|
<property name="sizePolicy" >
|
||||||
<sizepolicy vsizetype="MinimumExpanding" hsizetype="Expanding" >
|
<sizepolicy vsizetype="Preferred" hsizetype="MinimumExpanding" >
|
||||||
<horstretch>0</horstretch>
|
<horstretch>0</horstretch>
|
||||||
<verstretch>0</verstretch>
|
<verstretch>0</verstretch>
|
||||||
</sizepolicy>
|
</sizepolicy>
|
||||||
</property>
|
</property>
|
||||||
<property name="value" >
|
<property name="minimumSize" >
|
||||||
<number>24</number>
|
<size>
|
||||||
</property>
|
<width>50</width>
|
||||||
<property name="orientation" >
|
<height>25</height>
|
||||||
<enum>Qt::Horizontal</enum>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QProgressBar" name="ProgressBarInputLevelR" >
|
<widget class="CMultiColorLEDBar" native="1" name="MultiColorLEDBarInputLevelR" >
|
||||||
<property name="sizePolicy" >
|
<property name="sizePolicy" >
|
||||||
<sizepolicy vsizetype="MinimumExpanding" hsizetype="Expanding" >
|
<sizepolicy vsizetype="Preferred" hsizetype="MinimumExpanding" >
|
||||||
<horstretch>0</horstretch>
|
<horstretch>0</horstretch>
|
||||||
<verstretch>0</verstretch>
|
<verstretch>0</verstretch>
|
||||||
</sizepolicy>
|
</sizepolicy>
|
||||||
</property>
|
</property>
|
||||||
<property name="value" >
|
<property name="minimumSize" >
|
||||||
<number>24</number>
|
<size>
|
||||||
</property>
|
<width>50</width>
|
||||||
<property name="orientation" >
|
<height>25</height>
|
||||||
<enum>Qt::Horizontal</enum>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
@ -645,6 +603,12 @@ Fader</string>
|
||||||
<extends>QWidget</extends>
|
<extends>QWidget</extends>
|
||||||
<header>audiomixerboard.h</header>
|
<header>audiomixerboard.h</header>
|
||||||
</customwidget>
|
</customwidget>
|
||||||
|
<customwidget>
|
||||||
|
<class>CMultiColorLEDBar</class>
|
||||||
|
<extends>QWidget</extends>
|
||||||
|
<header>multicolorledbar.h</header>
|
||||||
|
<container>1</container>
|
||||||
|
</customwidget>
|
||||||
</customwidgets>
|
</customwidgets>
|
||||||
<tabstops>
|
<tabstops>
|
||||||
<tabstop>LineEditServerAddr</tabstop>
|
<tabstop>LineEditServerAddr</tabstop>
|
||||||
|
|
|
@ -31,14 +31,75 @@
|
||||||
/* Implementation *************************************************************/
|
/* Implementation *************************************************************/
|
||||||
CMultiColorLEDBar::CMultiColorLEDBar ( QWidget* parent, Qt::WindowFlags f )
|
CMultiColorLEDBar::CMultiColorLEDBar ( QWidget* parent, Qt::WindowFlags f )
|
||||||
: QLabel ( parent, f ),
|
: QLabel ( parent, f ),
|
||||||
BitmCubeRoundGrey ( QString::fromUtf8 ( ":/png/LEDs/res/VRLEDGreySmall.png" ) ),
|
BitmCubeRoundGrey ( QString::fromUtf8 ( ":/png/LEDs/res/VLEDGreySmall.png" ) ),
|
||||||
BitmCubeRoundGreen ( QString::fromUtf8 ( ":/png/LEDs/res/VRLEDGreySmall.png" ) ),
|
BitmCubeRoundGreen ( QString::fromUtf8 ( ":/png/LEDs/res/VLEDGreenSmall.png" ) ),
|
||||||
BitmCubeRoundYellow ( QString::fromUtf8 ( ":/png/LEDs/res/VRLEDGreySmall.png" ) ),
|
BitmCubeRoundYellow ( QString::fromUtf8 ( ":/png/LEDs/res/VLEDYellowSmall.png" ) ),
|
||||||
BitmCubeRoundRed ( QString::fromUtf8 ( ":/png/LEDs/res/VRLEDGreySmall.png" ) ),
|
BitmCubeRoundRed ( QString::fromUtf8 ( ":/png/LEDs/res/VLEDRedSmall.png" ) )
|
||||||
BitmCubeEdgeGrey ( QString::fromUtf8 ( ":/png/LEDs/res/VLEDGreySmall.png" ) ),
|
{
|
||||||
BitmCubeEdgeGreen ( QString::fromUtf8 ( ":/png/LEDs/res/VLEDGreySmall.png" ) ),
|
// set total number of LEDs
|
||||||
BitmCubeEdgeYellow ( QString::fromUtf8 ( ":/png/LEDs/res/VLEDGreySmall.png" ) ),
|
iNumLEDs = NUM_STEPS_INP_LEV_METER;
|
||||||
BitmCubeEdgeRed ( QString::fromUtf8 ( ":/png/LEDs/res/VLEDGreySmall.png" ) )
|
|
||||||
|
// create layout and set spacing to zero
|
||||||
|
pMainLayout = new QHBoxLayout ( this );
|
||||||
|
pMainLayout->setSpacing ( 0 );
|
||||||
|
|
||||||
|
// create LEDs
|
||||||
|
vecpLEDs.Init ( iNumLEDs );
|
||||||
|
for ( int i = 0; i < iNumLEDs; i++ )
|
||||||
|
{
|
||||||
|
// create LED label
|
||||||
|
vecpLEDs[i] = new QLabel ( "", parent );
|
||||||
|
|
||||||
|
// add LED to layout
|
||||||
|
pMainLayout->addWidget ( vecpLEDs[i] );
|
||||||
|
|
||||||
|
// set initial bitmap
|
||||||
|
vecpLEDs[i]->setPixmap ( BitmCubeRoundGrey );
|
||||||
|
|
||||||
|
// bitmap defines minimum size of the label
|
||||||
|
vecpLEDs[i]->setMinimumSize (
|
||||||
|
BitmCubeRoundGrey.width(), BitmCubeRoundGrey.height() );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CMultiColorLEDBar::setValue ( const int value )
|
||||||
{
|
{
|
||||||
|
|
||||||
|
// TODO speed optimiation: only change bitmaps of LEDs which
|
||||||
|
// actually have to be changed
|
||||||
|
|
||||||
|
// use green LEDs for the range from 0 to the YELLOW_BOUND_INP_LEV_METER,
|
||||||
|
// yellow in the range YELLOW_BOUND_INP_LEV_METER to
|
||||||
|
// RED_BOUND_INP_LEV_METER and red for up to value and grey for the rest
|
||||||
|
for ( int i = 0; i < iNumLEDs; i++ )
|
||||||
|
{
|
||||||
|
if ( i < value )
|
||||||
|
{
|
||||||
|
// we are below current input level, check which color
|
||||||
|
// we should use (green, yellow or red)
|
||||||
|
if ( i < YELLOW_BOUND_INP_LEV_METER )
|
||||||
|
{
|
||||||
|
// green region
|
||||||
|
vecpLEDs[i]->setPixmap ( BitmCubeRoundGreen );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if ( i < RED_BOUND_INP_LEV_METER )
|
||||||
|
{
|
||||||
|
// yellow region
|
||||||
|
vecpLEDs[i]->setPixmap ( BitmCubeRoundYellow );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// red region
|
||||||
|
vecpLEDs[i]->setPixmap ( BitmCubeRoundRed );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// we are above current input level -> use grey LED
|
||||||
|
vecpLEDs[i]->setPixmap ( BitmCubeRoundGrey );
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,6 +28,8 @@
|
||||||
#include <qlabel.h>
|
#include <qlabel.h>
|
||||||
#include <qpixmap.h>
|
#include <qpixmap.h>
|
||||||
#include <qtimer.h>
|
#include <qtimer.h>
|
||||||
|
#include <qlayout.h>
|
||||||
|
#include "util.h"
|
||||||
#include "global.h"
|
#include "global.h"
|
||||||
|
|
||||||
|
|
||||||
|
@ -39,15 +41,18 @@ class CMultiColorLEDBar : public QLabel
|
||||||
public:
|
public:
|
||||||
CMultiColorLEDBar ( QWidget* parent = 0, Qt::WindowFlags f = 0 );
|
CMultiColorLEDBar ( QWidget* parent = 0, Qt::WindowFlags f = 0 );
|
||||||
|
|
||||||
|
void setValue ( const int value );
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
QPixmap BitmCubeRoundGrey;
|
QPixmap BitmCubeRoundGrey;
|
||||||
QPixmap BitmCubeRoundGreen;
|
QPixmap BitmCubeRoundGreen;
|
||||||
QPixmap BitmCubeRoundYellow;
|
QPixmap BitmCubeRoundYellow;
|
||||||
QPixmap BitmCubeRoundRed;
|
QPixmap BitmCubeRoundRed;
|
||||||
QPixmap BitmCubeEdgeGrey;
|
|
||||||
QPixmap BitmCubeEdgeGreen;
|
QHBoxLayout* pMainLayout;
|
||||||
QPixmap BitmCubeEdgeYellow;
|
|
||||||
QPixmap BitmCubeEdgeRed;
|
int iNumLEDs;
|
||||||
|
CVector<QLabel*> vecpLEDs;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // _MULTCOLORLEDBAR_H__FD6B49B5_87DF_48DD_E1606C2AC__INCLUDED_
|
#endif // _MULTCOLORLEDBAR_H__FD6B49B5_87DF_48DD_E1606C2AC__INCLUDED_
|
||||||
|
|
Loading…
Add table
Reference in a new issue