2013-01-23 11:41:13 +01:00
|
|
|
/******************************************************************************\
|
2020-01-01 15:41:43 +01:00
|
|
|
* Copyright (c) 2004-2020
|
2013-01-23 11:41:13 +01:00
|
|
|
*
|
|
|
|
* Author(s):
|
|
|
|
* Volker Fischer
|
|
|
|
*
|
|
|
|
******************************************************************************
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify it under
|
|
|
|
* the terms of the GNU General Public License as published by the Free Software
|
2020-05-16 19:39:16 +02:00
|
|
|
* Foundation; either version 2 of the License, or (at your option) any later
|
2013-01-23 11:41:13 +01:00
|
|
|
* version.
|
|
|
|
*
|
2020-05-16 19:39:16 +02:00
|
|
|
* This program is distributed in the hope that it will be useful, but WITHOUT
|
2013-01-23 11:41:13 +01:00
|
|
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
2020-05-16 19:39:16 +02:00
|
|
|
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
2013-01-23 11:41:13 +01:00
|
|
|
* details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License along with
|
2020-05-16 19:39:16 +02:00
|
|
|
* this program; if not, write to the Free Software Foundation, Inc.,
|
2020-06-08 22:58:11 +02:00
|
|
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
2013-01-23 11:41:13 +01:00
|
|
|
*
|
|
|
|
\******************************************************************************/
|
|
|
|
|
2019-07-09 08:52:38 +02:00
|
|
|
#pragma once
|
2013-01-23 11:41:13 +01:00
|
|
|
|
|
|
|
#include <QFrame>
|
2020-03-30 19:53:30 +02:00
|
|
|
#include <QScrollArea>
|
2013-01-23 11:41:13 +01:00
|
|
|
#include <QGroupBox>
|
|
|
|
#include <QLabel>
|
|
|
|
#include <QCheckBox>
|
|
|
|
#include <QLayout>
|
|
|
|
#include <QString>
|
|
|
|
#include <QSlider>
|
2020-05-19 18:28:52 +02:00
|
|
|
#include <QDial>
|
2013-01-23 11:41:13 +01:00
|
|
|
#include <QSizePolicy>
|
|
|
|
#include <QHostAddress>
|
2020-06-08 17:34:45 +02:00
|
|
|
#include <QListWidget>
|
2020-07-04 09:45:46 +02:00
|
|
|
#include <QMenu>
|
2013-01-23 11:41:13 +01:00
|
|
|
#include "global.h"
|
|
|
|
#include "util.h"
|
2020-06-21 19:55:12 +02:00
|
|
|
#include "levelmeter.h"
|
2013-01-23 11:41:13 +01:00
|
|
|
|
|
|
|
|
|
|
|
/* Classes ********************************************************************/
|
|
|
|
class CChannelFader : public QObject
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
2020-06-08 17:34:45 +02:00
|
|
|
CChannelFader ( QWidget* pNW );
|
2013-01-23 11:41:13 +01:00
|
|
|
|
2020-06-13 08:31:28 +02:00
|
|
|
QString GetReceivedName() { return cReceivedChanInfo.strName; }
|
2020-07-02 17:04:05 +02:00
|
|
|
int GetReceivedInstrument() { return cReceivedChanInfo.iInstrument; }
|
|
|
|
void SetChannelInfos ( const CChannelInfo& cChanInfo );
|
|
|
|
void Show() { pFrame->show(); }
|
|
|
|
void Hide() { pFrame->hide(); }
|
|
|
|
bool IsVisible() { return !pFrame->isHidden(); }
|
|
|
|
bool IsSolo() { return pcbSolo->isChecked(); }
|
|
|
|
bool IsMute() { return pcbMute->isChecked(); }
|
2020-07-04 09:45:46 +02:00
|
|
|
int GetGroupID() { return iGroupID; }
|
2020-07-02 17:04:05 +02:00
|
|
|
void SetGUIDesign ( const EGUIDesign eNewDesign );
|
|
|
|
void SetDisplayChannelLevel ( const bool eNDCL );
|
|
|
|
bool GetDisplayChannelLevel();
|
|
|
|
void SetDisplayPans ( const bool eNDP );
|
2020-06-08 17:34:45 +02:00
|
|
|
QFrame* GetMainWidget() { return pFrame; }
|
2013-01-23 11:41:13 +01:00
|
|
|
|
2020-04-26 00:55:28 +02:00
|
|
|
void SetPanValue ( const int iPan );
|
2014-01-19 11:51:31 +01:00
|
|
|
void SetFaderIsSolo ( const bool bIsSolo );
|
2020-04-04 17:14:59 +02:00
|
|
|
void SetFaderIsMute ( const bool bIsMute );
|
2020-07-04 09:45:46 +02:00
|
|
|
void SetGroupID ( const int iNGroupID );
|
2020-05-21 18:26:33 +02:00
|
|
|
void SetRemoteFaderIsMute ( const bool bIsMute );
|
2020-06-30 21:37:36 +02:00
|
|
|
void SetFaderLevel ( const double dLevel,
|
|
|
|
const bool bIsGroupUpdate = false );
|
2020-06-20 20:29:43 +02:00
|
|
|
|
2020-06-30 21:37:36 +02:00
|
|
|
int GetFaderLevel() { return pFader->value(); }
|
|
|
|
double GetPreviousFaderLevel() { return dPreviousFaderLevel; }
|
|
|
|
int GetPanValue() { return pPan->value(); }
|
|
|
|
void Reset();
|
|
|
|
void SetChannelLevel ( const uint16_t iLevel );
|
|
|
|
void SetIsMyOwnFader() { bIsMyOwnFader = true; }
|
|
|
|
void UpdateSoloState ( const bool bNewOtherSoloState );
|
2013-01-23 11:41:13 +01:00
|
|
|
|
|
|
|
protected:
|
2020-07-04 10:46:31 +02:00
|
|
|
void UpdateGroupIDDependencies();
|
2020-06-30 21:37:36 +02:00
|
|
|
double CalcFaderGain ( const double dValue );
|
2015-12-09 18:11:16 +01:00
|
|
|
void SetMute ( const bool bState );
|
|
|
|
void SetupFaderTag ( const ESkillLevel eSkillLevel );
|
2020-06-20 20:29:43 +02:00
|
|
|
void SendPanValueToServer ( const int iPan );
|
2020-06-30 21:37:36 +02:00
|
|
|
void SendFaderLevelToServer ( const double dLevel,
|
|
|
|
const bool bIsGroupUpdate );
|
2013-01-23 11:41:13 +01:00
|
|
|
|
2020-06-21 20:09:13 +02:00
|
|
|
QFrame* pFrame;
|
|
|
|
|
|
|
|
QWidget* pLevelsBox;
|
|
|
|
QWidget* pMuteSoloBox;
|
|
|
|
CLevelMeter* plbrChannelLevel;
|
|
|
|
QSlider* pFader;
|
|
|
|
QDial* pPan;
|
|
|
|
QLabel* pPanLabel;
|
|
|
|
QLabel* pInfoLabel;
|
|
|
|
QHBoxLayout* pLabelGrid;
|
|
|
|
QVBoxLayout* pLabelPictGrid;
|
|
|
|
|
|
|
|
QCheckBox* pcbMute;
|
|
|
|
QCheckBox* pcbSolo;
|
|
|
|
QCheckBox* pcbGroup;
|
2020-07-04 09:45:46 +02:00
|
|
|
QMenu* pGroupPopupMenu;
|
2020-06-21 20:09:13 +02:00
|
|
|
|
|
|
|
QGroupBox* pLabelInstBox;
|
|
|
|
QLabel* plblLabel;
|
|
|
|
QLabel* plblInstrument;
|
|
|
|
QLabel* plblCountryFlag;
|
|
|
|
|
|
|
|
CChannelInfo cReceivedChanInfo;
|
|
|
|
|
|
|
|
bool bOtherChannelIsSolo;
|
|
|
|
bool bIsMyOwnFader;
|
2020-06-30 21:37:36 +02:00
|
|
|
double dPreviousFaderLevel;
|
2020-07-04 09:45:46 +02:00
|
|
|
int iGroupID;
|
2020-07-04 10:46:31 +02:00
|
|
|
QString strGroupBaseText;
|
2020-07-05 09:01:32 +02:00
|
|
|
int iInstrPicFixedWidth;
|
2013-01-23 11:41:13 +01:00
|
|
|
|
|
|
|
public slots:
|
2020-06-20 20:29:43 +02:00
|
|
|
void OnLevelValueChanged ( int value ) { SendFaderLevelToServer ( value, false ); }
|
2020-05-18 20:46:46 +02:00
|
|
|
void OnPanValueChanged ( int value ) { SendPanValueToServer ( value ); }
|
2013-01-23 11:41:13 +01:00
|
|
|
void OnMuteStateChanged ( int value );
|
2020-07-04 09:45:46 +02:00
|
|
|
void OnGroupStateChanged ( int );
|
|
|
|
|
|
|
|
void OnGroupMenuGrpNone() { SetGroupID ( INVALID_INDEX ); }
|
|
|
|
void OnGroupMenuGrp1() { SetGroupID ( 0 ); }
|
|
|
|
void OnGroupMenuGrp2() { SetGroupID ( 1 ); }
|
|
|
|
void OnGroupMenuGrp3() { SetGroupID ( 2 ); }
|
|
|
|
void OnGroupMenuGrp4() { SetGroupID ( 3 ); }
|
2013-01-23 11:41:13 +01:00
|
|
|
|
|
|
|
signals:
|
2020-06-20 20:29:43 +02:00
|
|
|
void gainValueChanged ( double value,
|
|
|
|
bool bIsMyOwnFader,
|
|
|
|
bool bIsGroupUpdate,
|
2020-06-30 21:37:36 +02:00
|
|
|
bool bSuppressServerUpdate,
|
|
|
|
double dLevelRatio );
|
2020-06-20 20:29:43 +02:00
|
|
|
|
2020-05-18 20:46:46 +02:00
|
|
|
void panValueChanged ( double value );
|
2013-01-23 11:41:13 +01:00
|
|
|
void soloStateChanged ( int value );
|
|
|
|
};
|
|
|
|
|
2020-04-18 12:20:31 +02:00
|
|
|
template<unsigned int slotId>
|
|
|
|
class CAudioMixerBoardSlots : public CAudioMixerBoardSlots<slotId - 1>
|
|
|
|
{
|
|
|
|
public:
|
2020-06-20 20:29:43 +02:00
|
|
|
void OnChGainValueChanged ( double dValue,
|
|
|
|
bool bIsMyOwnFader,
|
|
|
|
bool bIsGroupUpdate,
|
2020-06-30 21:37:36 +02:00
|
|
|
bool bSuppressServerUpdate,
|
|
|
|
double dLevelRatio ) { UpdateGainValue ( slotId - 1,
|
|
|
|
dValue,
|
|
|
|
bIsMyOwnFader,
|
|
|
|
bIsGroupUpdate,
|
|
|
|
bSuppressServerUpdate,
|
|
|
|
dLevelRatio ); }
|
2020-06-20 20:29:43 +02:00
|
|
|
|
2020-05-16 18:18:58 +02:00
|
|
|
void OnChPanValueChanged ( double dValue ) { UpdatePanValue ( slotId - 1, dValue ); }
|
2020-04-18 12:20:31 +02:00
|
|
|
|
|
|
|
protected:
|
|
|
|
virtual void UpdateGainValue ( const int iChannelIdx,
|
2020-05-26 20:45:10 +02:00
|
|
|
const double dValue,
|
2020-06-20 19:04:50 +02:00
|
|
|
const bool bIsMyOwnFader,
|
2020-06-20 20:29:43 +02:00
|
|
|
const bool bIsGroupUpdate,
|
2020-06-30 21:37:36 +02:00
|
|
|
const bool bSuppressServerUpdate,
|
|
|
|
const double dLevelRatio ) = 0;
|
2020-06-20 20:29:43 +02:00
|
|
|
|
2020-05-16 18:18:58 +02:00
|
|
|
virtual void UpdatePanValue ( const int iChannelIdx,
|
2020-05-18 20:46:46 +02:00
|
|
|
const double dValue ) = 0;
|
2020-04-18 12:20:31 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
template<>
|
|
|
|
class CAudioMixerBoardSlots<0> {};
|
|
|
|
|
|
|
|
|
|
|
|
class CAudioMixerBoard :
|
2020-05-20 22:28:52 +02:00
|
|
|
public QGroupBox,
|
2020-04-18 12:20:31 +02:00
|
|
|
public CAudioMixerBoardSlots<MAX_NUM_CHANNELS>
|
2013-01-23 11:41:13 +01:00
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
2020-06-20 20:29:43 +02:00
|
|
|
CAudioMixerBoard ( QWidget* parent = nullptr,
|
|
|
|
Qt::WindowFlags f = nullptr );
|
2013-01-23 11:41:13 +01:00
|
|
|
|
2020-06-21 14:55:08 +02:00
|
|
|
virtual ~CAudioMixerBoard();
|
|
|
|
|
2013-01-23 11:41:13 +01:00
|
|
|
void HideAll();
|
2013-02-11 16:21:53 +01:00
|
|
|
void ApplyNewConClientList ( CVector<CChannelInfo>& vecChanInfo );
|
2013-01-23 11:41:13 +01:00
|
|
|
void SetServerName ( const QString& strNewServerName );
|
|
|
|
void SetGUIDesign ( const EGUIDesign eNewDesign );
|
2020-03-29 23:40:53 +02:00
|
|
|
void SetDisplayChannelLevels ( const bool eNDCL );
|
2020-05-22 20:26:04 +02:00
|
|
|
void SetDisplayPans ( const bool eNDP );
|
2020-05-19 18:28:52 +02:00
|
|
|
void SetPanIsSupported();
|
2020-05-21 18:26:33 +02:00
|
|
|
void SetRemoteFaderIsMute ( const int iChannelIdx, const bool bIsMute );
|
2020-05-26 20:45:10 +02:00
|
|
|
void SetMyChannelID ( const int iChannelIdx ) { iMyChannelID = iChannelIdx; }
|
2013-01-23 11:41:13 +01:00
|
|
|
|
2019-01-12 13:59:16 +01:00
|
|
|
void SetFaderLevel ( const int iChannelIdx,
|
|
|
|
const int iValue );
|
2019-01-12 13:45:08 +01:00
|
|
|
|
2020-06-13 08:51:05 +02:00
|
|
|
void ChangeFaderOrder ( const bool bDoSort,
|
|
|
|
const EChSortType eChSortType );
|
|
|
|
|
2020-03-29 23:40:53 +02:00
|
|
|
void SetChannelLevels ( const CVector<uint16_t>& vecChannelLevel );
|
|
|
|
|
2020-06-14 23:02:13 +02:00
|
|
|
void SetRecorderState ( const ERecorderState newRecorderState );
|
|
|
|
|
2020-06-20 16:20:27 +02:00
|
|
|
|
2013-02-28 21:54:47 +01:00
|
|
|
// settings
|
|
|
|
CVector<QString> vecStoredFaderTags;
|
|
|
|
CVector<int> vecStoredFaderLevels;
|
2020-05-16 19:11:54 +02:00
|
|
|
CVector<int> vecStoredPanValues;
|
2014-01-19 16:02:25 +01:00
|
|
|
CVector<int> vecStoredFaderIsSolo;
|
2020-04-04 17:14:59 +02:00
|
|
|
CVector<int> vecStoredFaderIsMute;
|
2020-07-02 17:04:05 +02:00
|
|
|
CVector<int> vecStoredFaderGroupID;
|
2015-11-25 16:52:00 +01:00
|
|
|
int iNewClientFaderLevel;
|
2013-02-28 21:54:47 +01:00
|
|
|
|
2013-01-23 11:41:13 +01:00
|
|
|
protected:
|
2020-05-20 22:28:52 +02:00
|
|
|
class CMixerBoardScrollArea : public QScrollArea
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
CMixerBoardScrollArea ( QWidget* parent = nullptr ) : QScrollArea ( parent ) {}
|
|
|
|
|
|
|
|
protected:
|
|
|
|
virtual void resizeEvent ( QResizeEvent* event )
|
|
|
|
{
|
|
|
|
// if after a resize of the main window a vertical scroll bar is required, make
|
|
|
|
// sure that the fader label is visible (scroll down completely)
|
|
|
|
ensureVisible ( 0, 2000 ); // use a large value here
|
|
|
|
QScrollArea::resizeEvent ( event );
|
|
|
|
}
|
|
|
|
};
|
2020-05-20 21:21:22 +02:00
|
|
|
|
2020-05-18 20:46:46 +02:00
|
|
|
bool GetStoredFaderSettings ( const CChannelInfo& ChanInfo,
|
2014-01-19 11:51:31 +01:00
|
|
|
int& iStoredFaderLevel,
|
2020-05-16 19:11:54 +02:00
|
|
|
int& iStoredPanValue,
|
2020-04-04 17:14:59 +02:00
|
|
|
bool& bStoredFaderIsSolo,
|
2020-07-02 17:04:05 +02:00
|
|
|
bool& bStoredFaderIsMute,
|
|
|
|
int& iGroupID );
|
2020-04-04 17:14:59 +02:00
|
|
|
|
2014-01-19 11:51:31 +01:00
|
|
|
void StoreFaderSettings ( CChannelFader* pChanFader );
|
2013-09-10 18:24:55 +02:00
|
|
|
void UpdateSoloStates();
|
2020-06-15 21:48:30 +02:00
|
|
|
void UpdateTitle();
|
2013-02-24 10:03:57 +01:00
|
|
|
|
2020-04-26 00:55:28 +02:00
|
|
|
void OnGainValueChanged ( const int iChannelIdx,
|
|
|
|
const double dValue );
|
|
|
|
|
2013-01-23 11:41:13 +01:00
|
|
|
CVector<CChannelFader*> vecpChanFader;
|
2020-05-20 22:28:52 +02:00
|
|
|
CMixerBoardScrollArea* pScrollArea;
|
2013-01-23 11:41:13 +01:00
|
|
|
QHBoxLayout* pMainLayout;
|
2020-03-29 23:40:53 +02:00
|
|
|
bool bDisplayChannelLevels;
|
2020-05-22 20:26:04 +02:00
|
|
|
bool bDisplayPans;
|
|
|
|
bool bIsPanSupported;
|
2015-11-25 16:52:00 +01:00
|
|
|
bool bNoFaderVisible;
|
2020-05-26 17:28:44 +02:00
|
|
|
int iMyChannelID;
|
2020-04-12 18:56:58 +02:00
|
|
|
QString strServerName;
|
2020-06-14 23:02:13 +02:00
|
|
|
ERecorderState eRecorderState;
|
2013-01-23 11:41:13 +01:00
|
|
|
|
2020-04-18 12:20:31 +02:00
|
|
|
virtual void UpdateGainValue ( const int iChannelIdx,
|
2020-05-26 20:45:10 +02:00
|
|
|
const double dValue,
|
2020-06-20 19:04:50 +02:00
|
|
|
const bool bIsMyOwnFader,
|
2020-06-20 20:29:43 +02:00
|
|
|
const bool bIsGroupUpdate,
|
2020-06-30 21:37:36 +02:00
|
|
|
const bool bSuppressServerUpdate,
|
|
|
|
const double dLevelRatio );
|
2020-06-20 20:29:43 +02:00
|
|
|
|
2020-05-16 18:18:58 +02:00
|
|
|
virtual void UpdatePanValue ( const int iChannelIdx,
|
2020-05-18 20:46:46 +02:00
|
|
|
const double dValue );
|
2020-04-18 12:20:31 +02:00
|
|
|
|
|
|
|
template<unsigned int slotId>
|
|
|
|
inline void connectFaderSignalsToMixerBoardSlots();
|
|
|
|
|
2013-01-23 11:41:13 +01:00
|
|
|
signals:
|
2020-05-26 20:45:10 +02:00
|
|
|
void ChangeChanGain ( int iId, double dGain, bool bIsMyOwnFader );
|
2020-04-26 00:55:28 +02:00
|
|
|
void ChangeChanPan ( int iId, double dPan );
|
2013-01-23 11:41:13 +01:00
|
|
|
void NumClientsChanged ( int iNewNumClients );
|
|
|
|
};
|