New Client Level now also applies if you enter a server

This commit is contained in:
Volker Fischer 2020-05-26 17:28:44 +02:00
parent b576b389b4
commit f6e5120095
13 changed files with 84 additions and 6 deletions

View file

@ -11,10 +11,12 @@
- display recorder state and latest recording directory in the server GUI, - display recorder state and latest recording directory in the server GUI,
allow a new recording to be requested, by pljones (#228) allow a new recording to be requested, by pljones (#228)
- New Client Level now also applies if you enter a server
- bug fix: audio fader sliders cannot be moved if the main windows is too small (#292) - bug fix: audio fader sliders cannot be moved if the main windows is too small (#292)
TODO create protocol message to inform client about its ID at the server TODO honour own fader and Mute button in Mute Myself (#148)

View file

@ -613,6 +613,7 @@ CAudioMixerBoard::CAudioMixerBoard ( QWidget* parent, Qt::WindowFlags ) :
bDisplayPans ( false ), bDisplayPans ( false ),
bIsPanSupported ( false ), bIsPanSupported ( false ),
bNoFaderVisible ( true ), bNoFaderVisible ( true ),
iMyChannelID ( INVALID_INDEX ),
strServerName ( "" ) strServerName ( "" )
{ {
// add group box and hboxlayout // add group box and hboxlayout
@ -756,6 +757,7 @@ void CAudioMixerBoard::HideAll()
// set flags // set flags
bIsPanSupported = false; bIsPanSupported = false;
bNoFaderVisible = true; bNoFaderVisible = true;
iMyChannelID = INVALID_INDEX;
// emit status of connected clients // emit status of connected clients
emit NumClientsChanged ( 0 ); // -> no clients connected emit NumClientsChanged ( 0 ); // -> no clients connected
@ -796,9 +798,13 @@ void CAudioMixerBoard::ApplyNewConClientList ( CVector<CChannelInfo>& vecChanInf
// Set the default initial fader level. Check first that // Set the default initial fader level. Check first that
// this is not the initialization (i.e. previously there // this is not the initialization (i.e. previously there
// were no faders visible) to avoid that our own level is // were no faders visible) to avoid that our own level is
// adjusted. The fader level of 100 % is the default in the // adjusted. If we have received our own channel ID, then
// we can adjust the level even if no fader was visible.
// The fader level of 100 % is the default in the
// server, in that case we do not have to do anything here. // server, in that case we do not have to do anything here.
if ( !bNoFaderVisible && ( iNewClientFaderLevel != 100 ) ) if ( ( !bNoFaderVisible ||
( ( iMyChannelID != INVALID_INDEX ) && ( iMyChannelID != i ) ) ) &&
( iNewClientFaderLevel != 100 ) )
{ {
// the value is in percent -> convert range // the value is in percent -> convert range
vecpChanFader[i]->SetFaderLevel ( static_cast<int> ( vecpChanFader[i]->SetFaderLevel ( static_cast<int> (

View file

@ -147,6 +147,7 @@ public:
void SetDisplayPans ( const bool eNDP ); void SetDisplayPans ( const bool eNDP );
void SetPanIsSupported(); void SetPanIsSupported();
void SetRemoteFaderIsMute ( const int iChannelIdx, const bool bIsMute ); void SetRemoteFaderIsMute ( const int iChannelIdx, const bool bIsMute );
void SetMyChannelID ( const int iChanID ) { iMyChannelID = iChanID; }
void SetFaderLevel ( const int iChannelIdx, void SetFaderLevel ( const int iChannelIdx,
const int iValue ); const int iValue );
@ -196,6 +197,7 @@ protected:
bool bDisplayPans; bool bDisplayPans;
bool bIsPanSupported; bool bIsPanSupported;
bool bNoFaderVisible; bool bNoFaderVisible;
int iMyChannelID;
QString strServerName; QString strServerName;
virtual void UpdateGainValue ( const int iChannelIdx, virtual void UpdateGainValue ( const int iChannelIdx,

View file

@ -90,6 +90,10 @@ qRegisterMetaType<CHostAddress> ( "CHostAddress" );
QObject::connect ( &Protocol, SIGNAL ( ChangeChanPan ( int, double ) ), QObject::connect ( &Protocol, SIGNAL ( ChangeChanPan ( int, double ) ),
this, SLOT ( OnChangeChanPan ( int, double ) ) ); this, SLOT ( OnChangeChanPan ( int, double ) ) );
QObject::connect ( &Protocol,
SIGNAL ( ClientIDReceived ( int ) ),
SIGNAL ( ClientIDReceived ( int ) ) );
QObject::connect ( &Protocol, QObject::connect ( &Protocol,
SIGNAL ( MuteStateHasChangedReceived ( int, bool ) ), SIGNAL ( MuteStateHasChangedReceived ( int, bool ) ),
SIGNAL ( MuteStateHasChangedReceived ( int, bool ) ) ); SIGNAL ( MuteStateHasChangedReceived ( int, bool ) ) );

View file

@ -157,6 +157,7 @@ public:
Protocol.CreateJitBufMes ( iJitBufSize ); Protocol.CreateJitBufMes ( iJitBufSize );
} }
} }
void CreateClientIDMes ( const int iChanID ) { Protocol.CreateClientIDMes ( iChanID ); }
void CreateReqNetwTranspPropsMes() { Protocol.CreateReqNetwTranspPropsMes(); } void CreateReqNetwTranspPropsMes() { Protocol.CreateReqNetwTranspPropsMes(); }
void CreateReqJitBufMes() { Protocol.CreateReqJitBufMes(); } void CreateReqJitBufMes() { Protocol.CreateReqJitBufMes(); }
void CreateReqConnClientsList() { Protocol.CreateReqConnClientsList(); } void CreateReqConnClientsList() { Protocol.CreateReqConnClientsList(); }
@ -278,6 +279,7 @@ signals:
void ReqConnClientsList(); void ReqConnClientsList();
void ConClientListMesReceived ( CVector<CChannelInfo> vecChanInfo ); void ConClientListMesReceived ( CVector<CChannelInfo> vecChanInfo );
void ChanInfoHasChanged(); void ChanInfoHasChanged();
void ClientIDReceived ( int iChanID );
void MuteStateHasChanged ( int iChanID, bool bIsMuted ); void MuteStateHasChanged ( int iChanID, bool bIsMuted );
void MuteStateHasChangedReceived ( int iChanID, bool bIsMuted ); void MuteStateHasChangedReceived ( int iChanID, bool bIsMuted );
void ReqChanInfo(); void ReqChanInfo();

View file

@ -157,6 +157,10 @@ CClient::CClient ( const quint16 iPortNumber,
SIGNAL ( ChatTextReceived ( QString ) ), SIGNAL ( ChatTextReceived ( QString ) ),
SIGNAL ( ChatTextReceived ( QString ) ) ); SIGNAL ( ChatTextReceived ( QString ) ) );
QObject::connect ( &Channel,
SIGNAL ( ClientIDReceived ( int ) ),
SIGNAL ( ClientIDReceived ( int ) ) );
QObject::connect ( &Channel, QObject::connect ( &Channel,
SIGNAL ( MuteStateHasChangedReceived ( int, bool ) ), SIGNAL ( MuteStateHasChangedReceived ( int, bool ) ),
SIGNAL ( MuteStateHasChangedReceived ( int, bool ) ) ); SIGNAL ( MuteStateHasChangedReceived ( int, bool ) ) );

View file

@ -424,6 +424,7 @@ public slots:
signals: signals:
void ConClientListMesReceived ( CVector<CChannelInfo> vecChanInfo ); void ConClientListMesReceived ( CVector<CChannelInfo> vecChanInfo );
void ChatTextReceived ( QString strChatText ); void ChatTextReceived ( QString strChatText );
void ClientIDReceived ( int iChanID );
void MuteStateHasChangedReceived ( int iChanID, bool bIsMuted ); void MuteStateHasChangedReceived ( int iChanID, bool bIsMuted );
void LicenceRequired ( ELicenceType eLicenceType ); void LicenceRequired ( ELicenceType eLicenceType );
void VersionAndOSReceived ( COSUtil::EOpSystemType eOSType, QString strVersion ); void VersionAndOSReceived ( COSUtil::EOpSystemType eOSType, QString strVersion );

View file

@ -461,6 +461,10 @@ CClientDlg::CClientDlg ( CClient* pNCliP,
SIGNAL ( ChatTextReceived ( QString ) ), SIGNAL ( ChatTextReceived ( QString ) ),
this, SLOT ( OnChatTextReceived ( QString ) ) ); this, SLOT ( OnChatTextReceived ( QString ) ) );
QObject::connect ( pClient,
SIGNAL ( ClientIDReceived ( int ) ),
this, SLOT ( OnClientIDReceived ( int ) ) );
QObject::connect ( pClient, QObject::connect ( pClient,
SIGNAL ( MuteStateHasChangedReceived ( int, bool ) ), SIGNAL ( MuteStateHasChangedReceived ( int, bool ) ),
this, SLOT ( OnMuteStateHasChangedReceived ( int, bool ) ) ); this, SLOT ( OnMuteStateHasChangedReceived ( int, bool ) ) );

View file

@ -198,6 +198,9 @@ public slots:
CVector<CChannelInfo> vecChanInfo ) CVector<CChannelInfo> vecChanInfo )
{ ConnectDlg.SetConnClientsList ( InetAddr, vecChanInfo ); } { ConnectDlg.SetConnClientsList ( InetAddr, vecChanInfo ); }
void OnClientIDReceived ( int iChanID )
{ MainMixerBoard->SetMyChannelID ( iChanID ); }
void OnMuteStateHasChangedReceived ( int iChanID, bool bIsMuted ) void OnMuteStateHasChangedReceived ( int iChanID, bool bIsMuted )
{ MainMixerBoard->SetRemoteFaderIsMute ( iChanID, bIsMuted ); } { MainMixerBoard->SetRemoteFaderIsMute ( iChanID, bIsMuted ); }

View file

@ -57,6 +57,13 @@ MESSAGES (with connection)
note: does not have any data -> n = 0 note: does not have any data -> n = 0
- PROTMESSID_CLIENT_ID: Sends the current client ID to the client
+---------------------------------+
| 1 byte channel ID of the client |
+---------------------------------+
- PROTMESSID_CHANNEL_GAIN: Gain of channel - PROTMESSID_CHANNEL_GAIN: Gain of channel
+-------------------+--------------+ +-------------------+--------------+
@ -168,6 +175,7 @@ MESSAGES (with connection)
| 1 byte licence type | | 1 byte licence type |
+---------------------+ +---------------------+
- PROTMESSID_REQ_CHANNEL_LEVEL_LIST: Opt in or out of the channel level list - PROTMESSID_REQ_CHANNEL_LEVEL_LIST: Opt in or out of the channel level list
+---------------+ +---------------+
@ -176,6 +184,7 @@ MESSAGES (with connection)
option is boolean, true to opt in, false to opt out option is boolean, true to opt in, false to opt out
- PROTMESSID_VERSION_AND_OS: Version number and operating system - PROTMESSID_VERSION_AND_OS: Version number and operating system
+-------------------------+------------------+------------------------------+ +-------------------------+------------------+------------------------------+
@ -589,6 +598,10 @@ if ( rand() < ( RAND_MAX / 2 ) ) return false;
bRet = EvaluateReqJitBufMes(); bRet = EvaluateReqJitBufMes();
break; break;
case PROTMESSID_CLIENT_ID:
bRet = EvaluateClientIDMes ( vecbyMesBodyData );
break;
case PROTMESSID_CHANNEL_GAIN: case PROTMESSID_CHANNEL_GAIN:
bRet = EvaluateChanGainMes ( vecbyMesBodyData ); bRet = EvaluateChanGainMes ( vecbyMesBodyData );
break; break;
@ -798,6 +811,37 @@ bool CProtocol::EvaluateReqJitBufMes()
return false; // no error return false; // no error
} }
void CProtocol::CreateClientIDMes ( const int iChanID )
{
CVector<uint8_t> vecData ( 1 ); // 1 byte of data
int iPos = 0; // init position pointer
// build data vector
// channel ID
PutValOnStream ( vecData, iPos, static_cast<uint32_t> ( iChanID ), 1 );
CreateAndSendMessage ( PROTMESSID_CLIENT_ID, vecData );
}
bool CProtocol::EvaluateClientIDMes ( const CVector<uint8_t>& vecData )
{
int iPos = 0; // init position pointer
// check size
if ( vecData.Size() != 1 )
{
return true; // return error code
}
// channel ID
const int iCurID = static_cast<int> ( GetValFromStream ( vecData, iPos, 1 ) );
// invoke message action
emit ClientIDReceived ( iCurID );
return false; // no error
}
void CProtocol::CreateChanGainMes ( const int iChanID, const double dGain ) void CProtocol::CreateChanGainMes ( const int iChanID, const double dGain )
{ {
CVector<uint8_t> vecData ( 3 ); // 3 bytes of data CVector<uint8_t> vecData ( 3 ); // 3 bytes of data

View file

@ -58,6 +58,7 @@
#define PROTMESSID_VERSION_AND_OS 29 // version number and operating system #define PROTMESSID_VERSION_AND_OS 29 // version number and operating system
#define PROTMESSID_CHANNEL_PAN 30 // set channel pan for mix #define PROTMESSID_CHANNEL_PAN 30 // set channel pan for mix
#define PROTMESSID_MUTE_STATE_CHANGED 31 // mute state of your signal at another client has changed #define PROTMESSID_MUTE_STATE_CHANGED 31 // mute state of your signal at another client has changed
#define PROTMESSID_CLIENT_ID 32 // current user ID and server status
// message IDs of connection less messages (CLM) // message IDs of connection less messages (CLM)
// DEFINITION -> start at 1000, end at 1999, see IsConnectionLessMessageID // DEFINITION -> start at 1000, end at 1999, see IsConnectionLessMessageID
@ -98,6 +99,7 @@ public:
void CreateJitBufMes ( const int iJitBufSize ); void CreateJitBufMes ( const int iJitBufSize );
void CreateReqJitBufMes(); void CreateReqJitBufMes();
void CreateClientIDMes ( const int iChanID );
void CreateChanGainMes ( const int iChanID, const double dGain ); void CreateChanGainMes ( const int iChanID, const double dGain );
void CreateChanPanMes ( const int iChanID, const double dPan ); void CreateChanPanMes ( const int iChanID, const double dPan );
void CreateMuteStateHasChangedMes ( const int iChanID, const bool bIsMuted ); void CreateMuteStateHasChangedMes ( const int iChanID, const bool bIsMuted );
@ -223,6 +225,7 @@ protected:
bool EvaluateJitBufMes ( const CVector<uint8_t>& vecData ); bool EvaluateJitBufMes ( const CVector<uint8_t>& vecData );
bool EvaluateReqJitBufMes(); bool EvaluateReqJitBufMes();
bool EvaluateClientIDMes ( const CVector<uint8_t>& vecData );
bool EvaluateChanGainMes ( const CVector<uint8_t>& vecData ); bool EvaluateChanGainMes ( const CVector<uint8_t>& vecData );
bool EvaluateChanPanMes ( const CVector<uint8_t>& vecData ); bool EvaluateChanPanMes ( const CVector<uint8_t>& vecData );
bool EvaluateMuteStateHasChangedMes ( const CVector<uint8_t>& vecData ); bool EvaluateMuteStateHasChangedMes ( const CVector<uint8_t>& vecData );
@ -284,6 +287,7 @@ signals:
void ChangeJittBufSize ( int iNewJitBufSize ); void ChangeJittBufSize ( int iNewJitBufSize );
void ReqJittBufSize(); void ReqJittBufSize();
void ChangeNetwBlSiFact ( int iNewNetwBlSiFact ); void ChangeNetwBlSiFact ( int iNewNetwBlSiFact );
void ClientIDReceived ( int iChanID );
void ChangeChanGain ( int iChanID, double dNewGain ); void ChangeChanGain ( int iChanID, double dNewGain );
void ChangeChanPan ( int iChanID, double dNewPan ); void ChangeChanPan ( int iChanID, double dNewPan );
void MuteStateHasChangedReceived ( int iCurID, bool bIsMuted ); void MuteStateHasChangedReceived ( int iCurID, bool bIsMuted );

View file

@ -466,7 +466,7 @@ CServer::CServer ( const int iNewMaxNumChan,
QObject::connect ( &ServerListManager, QObject::connect ( &ServerListManager,
SIGNAL ( SvrRegStatusChanged() ), SIGNAL ( SvrRegStatusChanged() ),
this, SLOT ( OnSvrRegStatusChanged() ) ); SIGNAL ( SvrRegStatusChanged() ) );
QObject::connect( &JamRecorder, QObject::connect( &JamRecorder,
SIGNAL ( RecordingSessionStarted ( QString ) ), SIGNAL ( RecordingSessionStarted ( QString ) ),
@ -553,6 +553,10 @@ void CServer::SendProtMessage ( int iChID, CVector<uint8_t> vecMessage )
void CServer::OnNewConnection ( int iChID, void CServer::OnNewConnection ( int iChID,
CHostAddress RecHostAddr ) CHostAddress RecHostAddr )
{ {
// inform the client about its own ID at the server (note that this
// must be the first message to be sent for a new connection)
vecChannels[iChID].CreateClientIDMes ( iChID );
// on a new connection we query the network transport properties for the // on a new connection we query the network transport properties for the
// audio packets (to use the correct network block size and audio // audio packets (to use the correct network block size and audio
// compression properties, etc.) // compression properties, etc.)

View file

@ -450,8 +450,6 @@ public slots:
ServerListManager.StoreRegistrationResult ( eResult ); ServerListManager.StoreRegistrationResult ( eResult );
} }
void OnSvrRegStatusChanged() { emit SvrRegStatusChanged(); }
void OnCLUnregisterServerReceived ( CHostAddress InetAddr ) void OnCLUnregisterServerReceived ( CHostAddress InetAddr )
{ {
ServerListManager.CentralServerUnregisterServer ( InetAddr ); ServerListManager.CentralServerUnregisterServer ( InetAddr );