Add channel level LED bar
This commit is contained in:
parent
a7a1549fe5
commit
8db54e8616
2 changed files with 110 additions and 29 deletions
|
@ -35,17 +35,29 @@ CChannelFader::CChannelFader ( QWidget* pNW,
|
|||
// QWidget takes the ownership of the pMainGrid so that this only has
|
||||
// to be created locally in this constructor)
|
||||
pFrame = new QFrame ( pNW );
|
||||
QVBoxLayout* pMainGrid = new QVBoxLayout ( pFrame );
|
||||
pFader = new QSlider ( Qt::Vertical, pFrame );
|
||||
pcbMute = new QCheckBox ( "Mute", pFrame );
|
||||
pcbSolo = new QCheckBox ( "Solo", pFrame );
|
||||
|
||||
pLevelsBox = new QWidget ( pFrame );
|
||||
plbrChannelLevel = new CMultiColorLEDBar ( pLevelsBox );
|
||||
pFader = new QSlider ( Qt::Vertical, pLevelsBox );
|
||||
|
||||
pMuteSoloBox = new QWidget ( pFrame );
|
||||
pcbMute = new QCheckBox ( "Mute", pMuteSoloBox );
|
||||
pcbSolo = new QCheckBox ( "Solo", pMuteSoloBox );
|
||||
|
||||
pLabelInstBox = new QGroupBox ( pFrame );
|
||||
plblLabel = new QLabel ( "", pFrame );
|
||||
plblInstrument = new QLabel ( pFrame );
|
||||
plblCountryFlag = new QLabel ( pFrame );
|
||||
|
||||
QVBoxLayout* pMainGrid = new QVBoxLayout ( pFrame );
|
||||
QHBoxLayout* pLevelsGrid = new QHBoxLayout ( pLevelsBox );
|
||||
QVBoxLayout* pMuteSoloGrid = new QVBoxLayout ( pMuteSoloBox );
|
||||
QHBoxLayout* pLabelGrid = new QHBoxLayout ( pLabelInstBox );
|
||||
QVBoxLayout* pLabelPictGrid = new QVBoxLayout ( );
|
||||
|
||||
// setup channel level
|
||||
plbrChannelLevel->setContentsMargins( 0, 3, 2, 3 );
|
||||
|
||||
// setup slider
|
||||
pFader->setPageStep ( 1 );
|
||||
pFader->setTickPosition ( QSlider::TicksBothSides );
|
||||
|
@ -62,18 +74,30 @@ CChannelFader::CChannelFader ( QWidget* pNW,
|
|||
|
||||
// set margins of the layouts to zero to get maximum space for the controls
|
||||
pMainGrid->setContentsMargins ( 0, 0, 0, 0 );
|
||||
|
||||
pLevelsGrid->setContentsMargins ( 0, 0, 0, 0 );
|
||||
pLevelsGrid->setSpacing ( 0 ); // only minimal space
|
||||
|
||||
pMuteSoloGrid->setContentsMargins ( 0, 0, 0, 0 );
|
||||
|
||||
pLabelGrid->setContentsMargins ( 0, 0, 0, 0 );
|
||||
pLabelGrid->setSpacing ( 2 ); // only minimal space between picture and text
|
||||
|
||||
// add user controls to the grids
|
||||
pLabelPictGrid->addWidget ( plblCountryFlag, 0, Qt::AlignHCenter );
|
||||
pLabelPictGrid->addWidget ( plblInstrument, 0, Qt::AlignHCenter );
|
||||
|
||||
pLabelGrid->addLayout ( pLabelPictGrid );
|
||||
pLabelGrid->addWidget ( plblLabel, 0, Qt::AlignVCenter );
|
||||
|
||||
pMainGrid->addWidget ( pFader, 0, Qt::AlignHCenter );
|
||||
pMainGrid->addWidget ( pcbMute, 0, Qt::AlignLeft );
|
||||
pMainGrid->addWidget ( pcbSolo, 0, Qt::AlignLeft );
|
||||
pLevelsGrid->addWidget ( plbrChannelLevel, 0, Qt::AlignRight );
|
||||
pLevelsGrid->addWidget ( pFader, 0, Qt::AlignLeft );
|
||||
|
||||
pMuteSoloGrid->addWidget ( pcbMute, 0, Qt::AlignLeft );
|
||||
pMuteSoloGrid->addWidget ( pcbSolo, 0, Qt::AlignLeft );
|
||||
|
||||
pMainGrid->addWidget ( pLevelsBox, 0, Qt::AlignHCenter );
|
||||
pMainGrid->addWidget ( pMuteSoloBox, 0, Qt::AlignHCenter );
|
||||
pMainGrid->addWidget ( pLabelInstBox );
|
||||
|
||||
// add fader frame to audio mixer board layout
|
||||
|
@ -83,17 +107,23 @@ CChannelFader::CChannelFader ( QWidget* pNW,
|
|||
Reset();
|
||||
|
||||
// add help text to controls
|
||||
plbrChannelLevel->setWhatsThis ( tr ( "<b>Channel Level:</b> Displays the "
|
||||
"pre-fader audio level of this channel. All connected clients at the "
|
||||
"server will be assigned an audio level, the same value for each client." ) );
|
||||
plbrChannelLevel->setAccessibleName ( tr ( "Input level of the current audio "
|
||||
"channel at the server" ) );
|
||||
|
||||
pFader->setWhatsThis ( tr ( "<b>Mixer Fader:</b> Adjusts the audio level of "
|
||||
"this channel. All connected clients at the server will be assigned "
|
||||
"an audio fader at each client." ) );
|
||||
pFader->setAccessibleName ( tr ( "Mixer level setting of the connected client "
|
||||
"at the server" ) );
|
||||
"an audio fader at each client, adjusting the local mix." ) );
|
||||
pFader->setAccessibleName ( tr ( "Local mix level setting of the current audio "
|
||||
"channel at the server" ) );
|
||||
|
||||
pcbMute->setWhatsThis ( tr ( "<b>Mute:</b> With the Mute checkbox, the current "
|
||||
pcbMute->setWhatsThis ( tr ( "<b>Mute:</b> With the Mute checkbox, the "
|
||||
"audio channel can be muted." ) );
|
||||
pcbMute->setAccessibleName ( tr ( "Mute button" ) );
|
||||
|
||||
pcbSolo->setWhatsThis ( tr ( "<b>Solo:</b> With the Solo checkbox, the current "
|
||||
pcbSolo->setWhatsThis ( tr ( "<b>Solo:</b> With the Solo checkbox, the "
|
||||
"audio channel can be set to solo which means that all other channels "
|
||||
"except of the current channel are muted. It is possible to set more than "
|
||||
"one channel to solo." ) );
|
||||
|
@ -158,6 +188,11 @@ void CChannelFader::SetGUIDesign ( const EGUIDesign eNewDesign )
|
|||
}
|
||||
}
|
||||
|
||||
void CChannelFader::SetDisplayChannelLevel ( const bool eNDCL )
|
||||
{
|
||||
plbrChannelLevel->setHidden( !eNDCL );
|
||||
}
|
||||
|
||||
void CChannelFader::SetupFaderTag ( const ESkillLevel eSkillLevel )
|
||||
{
|
||||
// setup group box for label/instrument picture: set a thick black border
|
||||
|
@ -306,6 +341,11 @@ void CChannelFader::UpdateSoloState ( const bool bNewOtherSoloState )
|
|||
}
|
||||
}
|
||||
|
||||
void CChannelFader::SetChannelLevel ( const uint16_t iLevel )
|
||||
{
|
||||
plbrChannelLevel->setValue ( iLevel );
|
||||
}
|
||||
|
||||
void CChannelFader::SetText ( const CChannelInfo& ChanInfo )
|
||||
{
|
||||
// store original received name
|
||||
|
@ -634,6 +674,17 @@ void CAudioMixerBoard::SetGUIDesign ( const EGUIDesign eNewDesign )
|
|||
}
|
||||
}
|
||||
|
||||
void CAudioMixerBoard::SetDisplayChannelLevels ( const bool eNDCL )
|
||||
{
|
||||
bDisplayChannelLevels = eNDCL;
|
||||
|
||||
// apply preference to child GUI controls
|
||||
for ( int i = 0; i < MAX_NUM_CHANNELS; i++ )
|
||||
{
|
||||
vecpChanFader[i]->SetDisplayChannelLevel ( bDisplayChannelLevels );
|
||||
}
|
||||
}
|
||||
|
||||
void CAudioMixerBoard::HideAll()
|
||||
{
|
||||
// make all controls invisible
|
||||
|
@ -710,6 +761,9 @@ void CAudioMixerBoard::ApplyNewConClientList ( CVector<CChannelInfo>& vecChanInf
|
|||
}
|
||||
}
|
||||
|
||||
// At some future time a new level will arrive -- ???
|
||||
vecpChanFader[i]->SetChannelLevel ( 0 );
|
||||
|
||||
// set the text in the fader
|
||||
vecpChanFader[i]->SetText ( vecChanInfo[j] );
|
||||
|
||||
|
@ -857,3 +911,17 @@ bool CAudioMixerBoard::GetStoredFaderSettings ( const CChannelInfo& ChanInfo,
|
|||
// return "not OK" since we did not find matching fader settings
|
||||
return false;
|
||||
}
|
||||
|
||||
void CAudioMixerBoard::SetChannelLevels ( const CVector<uint16_t>& vecChannelLevel )
|
||||
{
|
||||
const int iNumChannelLevels = vecChannelLevel.Size();
|
||||
int i = 0;
|
||||
|
||||
for ( int iChId = 0; iChId < MAX_NUM_CHANNELS; iChId++ )
|
||||
{
|
||||
if ( vecpChanFader[iChId]->IsVisible() && i < iNumChannelLevels )
|
||||
{
|
||||
vecpChanFader[iChId]->SetChannelLevel ( vecChannelLevel[i++] );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -36,6 +36,7 @@
|
|||
#include <QHostAddress>
|
||||
#include "global.h"
|
||||
#include "util.h"
|
||||
#include "multicolorledbar.h"
|
||||
|
||||
|
||||
/* Classes ********************************************************************/
|
||||
|
@ -55,6 +56,7 @@ public:
|
|||
bool IsSolo() { return pcbSolo->isChecked(); }
|
||||
bool IsMute() { return pcbMute->isChecked(); }
|
||||
void SetGUIDesign ( const EGUIDesign eNewDesign );
|
||||
void SetDisplayChannelLevel ( const bool eNDCL );
|
||||
|
||||
void UpdateSoloState ( const bool bNewOtherSoloState );
|
||||
void SetFaderLevel ( const int iLevel );
|
||||
|
@ -62,6 +64,7 @@ public:
|
|||
void SetFaderIsMute ( const bool bIsMute );
|
||||
int GetFaderLevel() { return pFader->value(); }
|
||||
void Reset();
|
||||
void SetChannelLevel ( const uint16_t iLevel );
|
||||
|
||||
protected:
|
||||
double CalcFaderGain ( const int value );
|
||||
|
@ -70,10 +73,16 @@ protected:
|
|||
void SetupFaderTag ( const ESkillLevel eSkillLevel );
|
||||
|
||||
QFrame* pFrame;
|
||||
QGroupBox* pLabelInstBox;
|
||||
|
||||
QWidget* pLevelsBox;
|
||||
QWidget* pMuteSoloBox;
|
||||
CMultiColorLEDBar* plbrChannelLevel;
|
||||
QSlider* pFader;
|
||||
|
||||
QCheckBox* pcbMute;
|
||||
QCheckBox* pcbSolo;
|
||||
|
||||
QGroupBox* pLabelInstBox;
|
||||
QLabel* plblLabel;
|
||||
QLabel* plblInstrument;
|
||||
QLabel* plblCountryFlag;
|
||||
|
@ -103,10 +112,13 @@ public:
|
|||
void ApplyNewConClientList ( CVector<CChannelInfo>& vecChanInfo );
|
||||
void SetServerName ( const QString& strNewServerName );
|
||||
void SetGUIDesign ( const EGUIDesign eNewDesign );
|
||||
void SetDisplayChannelLevels ( const bool eNDCL );
|
||||
|
||||
void SetFaderLevel ( const int iChannelIdx,
|
||||
const int iValue );
|
||||
|
||||
void SetChannelLevels ( const CVector<uint16_t>& vecChannelLevel );
|
||||
|
||||
// settings
|
||||
CVector<QString> vecStoredFaderTags;
|
||||
CVector<int> vecStoredFaderLevels;
|
||||
|
@ -129,6 +141,7 @@ protected:
|
|||
CVector<CChannelFader*> vecpChanFader;
|
||||
QGroupBox* pGroupBox;
|
||||
QHBoxLayout* pMainLayout;
|
||||
bool bDisplayChannelLevels;
|
||||
bool bNoFaderVisible;
|
||||
|
||||
public slots:
|
||||
|
|
Loading…
Reference in a new issue