finished fader tag implementation
This commit is contained in:
parent
7f29e49691
commit
ecd105d6ca
10 changed files with 194 additions and 14 deletions
|
@ -73,6 +73,18 @@ CChannelSet::CChannelSet()
|
|||
QObject::connect(&vecChannels[7],SIGNAL(ReqConnClientsList()),this,SLOT(OnReqConnClientsListCh7()));
|
||||
QObject::connect(&vecChannels[8],SIGNAL(ReqConnClientsList()),this,SLOT(OnReqConnClientsListCh8()));
|
||||
QObject::connect(&vecChannels[9],SIGNAL(ReqConnClientsList()),this,SLOT(OnReqConnClientsListCh9()));
|
||||
|
||||
// channel name has changed
|
||||
QObject::connect(&vecChannels[0],SIGNAL(NameHasChanged()),this,SLOT(OnNameHasChangedCh0()));
|
||||
QObject::connect(&vecChannels[1],SIGNAL(NameHasChanged()),this,SLOT(OnNameHasChangedCh1()));
|
||||
QObject::connect(&vecChannels[2],SIGNAL(NameHasChanged()),this,SLOT(OnNameHasChangedCh2()));
|
||||
QObject::connect(&vecChannels[3],SIGNAL(NameHasChanged()),this,SLOT(OnNameHasChangedCh3()));
|
||||
QObject::connect(&vecChannels[4],SIGNAL(NameHasChanged()),this,SLOT(OnNameHasChangedCh4()));
|
||||
QObject::connect(&vecChannels[5],SIGNAL(NameHasChanged()),this,SLOT(OnNameHasChangedCh5()));
|
||||
QObject::connect(&vecChannels[6],SIGNAL(NameHasChanged()),this,SLOT(OnNameHasChangedCh6()));
|
||||
QObject::connect(&vecChannels[7],SIGNAL(NameHasChanged()),this,SLOT(OnNameHasChangedCh7()));
|
||||
QObject::connect(&vecChannels[8],SIGNAL(NameHasChanged()),this,SLOT(OnNameHasChangedCh8()));
|
||||
QObject::connect(&vecChannels[9],SIGNAL(NameHasChanged()),this,SLOT(OnNameHasChangedCh9()));
|
||||
}
|
||||
|
||||
CVector<CChannelShortInfo> CChannelSet::CreateChannelList()
|
||||
|
@ -433,6 +445,9 @@ CChannel::CChannel() : sName ( "" ),
|
|||
|
||||
QObject::connect( &Protocol, SIGNAL ( ChangeChanGain ( int, double ) ),
|
||||
this, SLOT ( OnChangeChanGain ( int, double ) ) );
|
||||
|
||||
QObject::connect( &Protocol, SIGNAL ( ChangeChanName ( std::string ) ),
|
||||
this, SLOT ( OnChangeChanName ( std::string ) ) );
|
||||
}
|
||||
|
||||
void CChannel::SetEnable ( const bool bNEnStat )
|
||||
|
@ -537,6 +552,18 @@ void CChannel::OnChangeChanGain ( int iChanID, double dNewGain )
|
|||
vecdGains[iChanID] = dNewGain;
|
||||
}
|
||||
|
||||
void CChannel::OnChangeChanName ( std::string strName )
|
||||
{
|
||||
// apply value (if different from previous name)
|
||||
if ( sName.compare ( strName ) )
|
||||
{
|
||||
sName = strName;
|
||||
|
||||
// fire message that name has changed
|
||||
emit NameHasChanged();
|
||||
}
|
||||
}
|
||||
|
||||
bool CChannel::GetAddress(CHostAddress& RetAddr)
|
||||
{
|
||||
if ( IsConnected() )
|
||||
|
|
|
@ -90,6 +90,9 @@ public:
|
|||
void SetName ( const std::string sNNa ) { sName = sNNa; }
|
||||
std::string GetName() { return sName; }
|
||||
|
||||
void SetRemoteName ( const std::string strName )
|
||||
{ Protocol.CreateChanNameMes ( strName ); }
|
||||
|
||||
void SetGain ( const int iNID, const double dNG ) { vecdGains[iNID] = dNG; }
|
||||
double GetGain( const int iNID ) { return vecdGains[iNID]; }
|
||||
|
||||
|
@ -179,6 +182,7 @@ public slots:
|
|||
void OnJittBufSizeChange ( int iNewJitBufSize );
|
||||
void OnNetwBlSiFactChange ( int iNewNetwBlSiFact );
|
||||
void OnChangeChanGain ( int iChanID, double dNewGain );
|
||||
void OnChangeChanName ( std::string strName );
|
||||
|
||||
signals:
|
||||
void MessReadyForSending ( CVector<uint8_t> vecMessage );
|
||||
|
@ -187,6 +191,7 @@ signals:
|
|||
void ReqConnClientsList();
|
||||
void ConClientListMesReceived ( CVector<CChannelShortInfo> vecChanInfo );
|
||||
void ProtocolStatus ( bool bOk );
|
||||
void NameHasChanged();
|
||||
};
|
||||
|
||||
|
||||
|
@ -274,6 +279,17 @@ public slots:
|
|||
void OnReqConnClientsListCh8() { CreateAndSendChanListForThisChan ( 8 ); }
|
||||
void OnReqConnClientsListCh9() { CreateAndSendChanListForThisChan ( 9 ); }
|
||||
|
||||
void OnNameHasChangedCh0() { CreateAndSendChanListForAllConChannels(); }
|
||||
void OnNameHasChangedCh1() { CreateAndSendChanListForAllConChannels(); }
|
||||
void OnNameHasChangedCh2() { CreateAndSendChanListForAllConChannels(); }
|
||||
void OnNameHasChangedCh3() { CreateAndSendChanListForAllConChannels(); }
|
||||
void OnNameHasChangedCh4() { CreateAndSendChanListForAllConChannels(); }
|
||||
void OnNameHasChangedCh5() { CreateAndSendChanListForAllConChannels(); }
|
||||
void OnNameHasChangedCh6() { CreateAndSendChanListForAllConChannels(); }
|
||||
void OnNameHasChangedCh7() { CreateAndSendChanListForAllConChannels(); }
|
||||
void OnNameHasChangedCh8() { CreateAndSendChanListForAllConChannels(); }
|
||||
void OnNameHasChangedCh9() { CreateAndSendChanListForAllConChannels(); }
|
||||
|
||||
signals:
|
||||
void MessReadyForSending ( int iChID, CVector<uint8_t> vecMessage );
|
||||
};
|
||||
|
|
|
@ -30,7 +30,8 @@ CClient::CClient() : bRun ( false ), Socket ( &Channel ),
|
|||
iAudioInFader ( AUD_FADER_IN_MAX / 2 ),
|
||||
iReverbLevel ( AUD_REVERB_MAX / 6 ),
|
||||
bReverbOnLeftChan ( false ),
|
||||
iNetwBufSizeFactIn ( DEF_NET_BLOCK_SIZE_FACTOR )
|
||||
iNetwBufSizeFactIn ( DEF_NET_BLOCK_SIZE_FACTOR ),
|
||||
strIPAddress ( "" ), strName ( "" )
|
||||
{
|
||||
// connection for protocol
|
||||
QObject::connect ( &Channel,
|
||||
|
@ -75,6 +76,14 @@ void CClient::OnReqJittBufSize()
|
|||
Channel.CreateNetwBlSiFactMes ( iNetwBufSizeFactIn );
|
||||
}
|
||||
|
||||
void CClient::OnNewConnection()
|
||||
{
|
||||
// a new connection was successfully initiated, send name and request
|
||||
// connected clients list
|
||||
Channel.SetRemoteName ( strName );
|
||||
Channel.CreateReqConnClientsList();
|
||||
}
|
||||
|
||||
bool CClient::SetServerAddr ( QString strNAddr )
|
||||
{
|
||||
QHostAddress InetAddr;
|
||||
|
|
|
@ -113,13 +113,15 @@ public:
|
|||
void SetRemoteChanGain ( const int iId, const double dGain )
|
||||
{ Channel.SetRemoteChanGain ( iId, dGain ); }
|
||||
|
||||
void SetRemoteName() { Channel.SetRemoteName ( strName ); }
|
||||
|
||||
CSound* GetSndInterface() { return &Sound; }
|
||||
CChannel* GetChannel() { return &Channel; }
|
||||
|
||||
|
||||
// settings
|
||||
string strIPAddress;
|
||||
std::string strIPAddress;
|
||||
std::string strName;
|
||||
|
||||
protected:
|
||||
virtual void run ();
|
||||
|
@ -168,7 +170,7 @@ public slots:
|
|||
void OnSendProtMessage ( CVector<uint8_t> vecMessage );
|
||||
void OnReqJittBufSize();
|
||||
void OnProtocolStatus ( bool bOk );
|
||||
void OnNewConnection() { Channel.CreateReqConnClientsList(); }
|
||||
void OnNewConnection();
|
||||
|
||||
signals:
|
||||
void ConClientListMesReceived ( CVector<CChannelShortInfo> vecChanInfo );
|
||||
|
|
|
@ -45,7 +45,7 @@ CLlconClientDlg::CLlconClientDlg ( CClient* pNCliP, QWidget* parent,
|
|||
"button will disconnect the connection."));
|
||||
|
||||
QWhatsThis::add(TextLabelStatus, tr("<b>Status Bar:</b> In the status bar "
|
||||
"different messages are displayed. E.g., if an error ocurred or the "
|
||||
"different messages are displayed. E.g., if an error occurred or the "
|
||||
"status of the connection is shown."));
|
||||
|
||||
QString strServAddrH = tr("<b>Server Address:</b> In this edit control, "
|
||||
|
@ -54,6 +54,12 @@ CLlconClientDlg::CLlconClientDlg ( CClient* pNCliP, QWidget* parent,
|
|||
QWhatsThis::add(TextLabelServerAddr, strServAddrH);
|
||||
QWhatsThis::add(LineEditServerAddr, strServAddrH);
|
||||
|
||||
QString strFaderTag = tr("<b>Fader Tag:</b> In this edit control, "
|
||||
"the tag string of your fader can be set. This tag will appear "
|
||||
"at your fader on the mixer board.");
|
||||
QWhatsThis::add(TextLabelServerTag, strFaderTag);
|
||||
QWhatsThis::add(LineEditFaderTag, strFaderTag);
|
||||
|
||||
QString strAudFader = tr ( "<b>Audio Fader:</b> With the audio fader "
|
||||
"control the level of left and right audio input channels can "
|
||||
"be controlled." );
|
||||
|
@ -80,9 +86,15 @@ CLlconClientDlg::CLlconClientDlg ( CClient* pNCliP, QWidget* parent,
|
|||
"network or sound interface has bad status, this LED will show "
|
||||
"red color." ) );
|
||||
|
||||
/* init server address line edit */
|
||||
// init fader tag line edit
|
||||
LineEditFaderTag->setText ( pClient->strName.c_str() );
|
||||
|
||||
// init server address line edit
|
||||
LineEditServerAddr->setText ( pClient->strIPAddress.c_str() );
|
||||
|
||||
// we want the cursor to be at IP address line edit at startup
|
||||
LineEditServerAddr->setFocus();
|
||||
|
||||
/* init status label */
|
||||
OnTimerStatus();
|
||||
|
||||
|
@ -96,7 +108,7 @@ CLlconClientDlg::CLlconClientDlg ( CClient* pNCliP, QWidget* parent,
|
|||
ProgressBarInputLevelR->setProgress ( 0 );
|
||||
|
||||
|
||||
/* init slider controls --- */
|
||||
// init slider controls ---
|
||||
// audio in fader
|
||||
SliderAudInFader->setRange ( 0, AUD_FADER_IN_MAX );
|
||||
const int iCurAudInFader = pClient->GetAudioInFader();
|
||||
|
@ -110,7 +122,7 @@ CLlconClientDlg::CLlconClientDlg ( CClient* pNCliP, QWidget* parent,
|
|||
SliderAudReverb->setTickInterval ( AUD_REVERB_MAX / 9 );
|
||||
|
||||
|
||||
/* set radio buttons --- */
|
||||
// set radio buttons ---
|
||||
// reverb channel
|
||||
if ( pClient->IsReverbOnLeftChan() )
|
||||
{
|
||||
|
@ -165,6 +177,10 @@ CLlconClientDlg::CLlconClientDlg ( CClient* pNCliP, QWidget* parent,
|
|||
QObject::connect(RadioButtonRevSelR, SIGNAL(clicked()),
|
||||
this, SLOT(OnRevSelR()));
|
||||
|
||||
// line edits
|
||||
QObject::connect ( LineEditFaderTag, SIGNAL ( textChanged ( const QString& ) ),
|
||||
this, SLOT ( OnFaderTagTextChanged ( const QString& ) ) );
|
||||
|
||||
// other
|
||||
QObject::connect ( pClient,
|
||||
SIGNAL ( ConClientListMesReceived ( CVector<CChannelShortInfo> ) ),
|
||||
|
@ -192,6 +208,9 @@ void CLlconClientDlg::closeEvent ( QCloseEvent * Event )
|
|||
// store IP address
|
||||
pClient->strIPAddress = LineEditServerAddr->text().latin1();
|
||||
|
||||
// store fader tag
|
||||
pClient->strName = LineEditFaderTag->text().latin1();
|
||||
|
||||
// default implementation of this event handler routine
|
||||
Event->accept();
|
||||
}
|
||||
|
@ -248,6 +267,15 @@ void CLlconClientDlg::OnOpenGeneralSettings()
|
|||
ClientSettingsDlg.show();
|
||||
}
|
||||
|
||||
void CLlconClientDlg::OnFaderTagTextChanged ( const QString& strNewName )
|
||||
{
|
||||
// refresh internal name parameter
|
||||
pClient->strName = strNewName.latin1();
|
||||
|
||||
// update name at server
|
||||
pClient->SetRemoteName();
|
||||
}
|
||||
|
||||
void CLlconClientDlg::OnTimerSigMet()
|
||||
{
|
||||
/* get current input levels */
|
||||
|
|
|
@ -102,4 +102,5 @@ public slots:
|
|||
{ MainMixerBoard->ApplyNewConClientList ( vecChanInfo ); }
|
||||
void OnChangeChanGain ( int iId, double dGain )
|
||||
{ pClient->SetRemoteChanGain ( iId, dGain ); }
|
||||
void OnFaderTagTextChanged ( const QString& strNewName );
|
||||
};
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>586</width>
|
||||
<width>580</width>
|
||||
<height>289</height>
|
||||
</rect>
|
||||
</property>
|
||||
|
@ -307,7 +307,7 @@
|
|||
<class>QLayoutWidget</class>
|
||||
<property stdset="1">
|
||||
<name>name</name>
|
||||
<cstring>Layout17</cstring>
|
||||
<cstring>Layout9</cstring>
|
||||
</property>
|
||||
<hbox>
|
||||
<property stdset="1">
|
||||
|
@ -318,6 +318,28 @@
|
|||
<name>spacing</name>
|
||||
<number>6</number>
|
||||
</property>
|
||||
<widget>
|
||||
<class>QLabel</class>
|
||||
<property stdset="1">
|
||||
<name>name</name>
|
||||
<cstring>TextLabelServerTag</cstring>
|
||||
</property>
|
||||
<property stdset="1">
|
||||
<name>text</name>
|
||||
<string>Fader Tag:</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget>
|
||||
<class>QLineEdit</class>
|
||||
<property stdset="1">
|
||||
<name>name</name>
|
||||
<cstring>LineEditFaderTag</cstring>
|
||||
</property>
|
||||
<property stdset="1">
|
||||
<name>maxLength</name>
|
||||
<number>15</number>
|
||||
</property>
|
||||
</widget>
|
||||
<spacer>
|
||||
<property>
|
||||
<name>name</name>
|
||||
|
@ -674,7 +696,12 @@ Fader</string>
|
|||
</image>
|
||||
</images>
|
||||
<tabstops>
|
||||
<tabstop>PushButtonConnect</tabstop>
|
||||
<tabstop>LineEditServerAddr</tabstop>
|
||||
<tabstop>PushButtonConnect</tabstop>
|
||||
<tabstop>LineEditFaderTag</tabstop>
|
||||
<tabstop>SliderAudReverb</tabstop>
|
||||
<tabstop>RadioButtonRevSelL</tabstop>
|
||||
<tabstop>RadioButtonRevSelR</tabstop>
|
||||
<tabstop>SliderAudInFader</tabstop>
|
||||
</tabstops>
|
||||
</UI>
|
||||
|
|
|
@ -82,6 +82,17 @@ MESSAGES
|
|||
note: does not have any data -> n = 0
|
||||
|
||||
|
||||
- Name of channel PROTMESSID_CHANNEL_NAME
|
||||
|
||||
for each connected client append following data:
|
||||
|
||||
+------------------+----------------------+
|
||||
| 2 bytes number n | n bytes UTF-8 string |
|
||||
+------------------+----------------------+
|
||||
|
||||
|
||||
|
||||
|
||||
*
|
||||
******************************************************************************
|
||||
*
|
||||
|
@ -343,6 +354,11 @@ for ( int i = 0; i < iNumBytes; i++ ) {
|
|||
|
||||
EvaluateReqConnClientsList ( iPos, vecData );
|
||||
break;
|
||||
|
||||
case PROTMESSID_CHANNEL_NAME:
|
||||
|
||||
EvaluateChanNameMes ( iPos, vecData );
|
||||
break;
|
||||
}
|
||||
|
||||
// send acknowledge message
|
||||
|
@ -551,6 +567,50 @@ void CProtocol::EvaluateReqConnClientsList ( unsigned int iPos, const CVector<ui
|
|||
emit ReqConnClientsList();
|
||||
}
|
||||
|
||||
void CProtocol::CreateChanNameMes ( const std::string strName )
|
||||
{
|
||||
unsigned int iPos = 0; // init position pointer
|
||||
const int iStrLen = strName.size(); // get string size
|
||||
|
||||
// size of current list entry
|
||||
const int iEntrLen = 2 /* str. size */ + iStrLen;
|
||||
|
||||
// build data vector
|
||||
CVector<uint8_t> vecData ( iEntrLen );
|
||||
|
||||
// number of bytes for name string (2 bytes)
|
||||
PutValOnStream ( vecData, iPos, static_cast<uint32_t> ( iStrLen ), 2 );
|
||||
|
||||
// name string (n bytes)
|
||||
for ( int j = 0; j < iStrLen; j++ )
|
||||
{
|
||||
// byte-by-byte copying of the string data
|
||||
PutValOnStream ( vecData, iPos,
|
||||
static_cast<uint32_t> ( strName[j] ), 1 );
|
||||
}
|
||||
|
||||
CreateAndSendMessage ( PROTMESSID_CHANNEL_NAME, vecData );
|
||||
}
|
||||
|
||||
void CProtocol::EvaluateChanNameMes ( unsigned int iPos, const CVector<uint8_t>& vecData )
|
||||
{
|
||||
// number of bytes for name string (2 bytes)
|
||||
const int iStrLen =
|
||||
static_cast<int> ( GetValFromStream ( vecData, iPos, 2 ) );
|
||||
|
||||
// name string (n bytes)
|
||||
std::string strName = "";
|
||||
for ( int j = 0; j < iStrLen; j++ )
|
||||
{
|
||||
// byte-by-byte copying of the string data
|
||||
int iData = static_cast<int> ( GetValFromStream ( vecData, iPos, 1 ) );
|
||||
strName += std::string ( (char*) &iData );
|
||||
}
|
||||
|
||||
// invoke message action
|
||||
emit ChangeChanName ( strName );
|
||||
}
|
||||
|
||||
|
||||
/******************************************************************************\
|
||||
* Message generation (parsing) *
|
||||
|
|
|
@ -45,6 +45,7 @@
|
|||
#define PROTMESSID_CONN_CLIENTS_LIST 15 // connected client list
|
||||
#define PROTMESSID_SERVER_FULL 16 // server full message
|
||||
#define PROTMESSID_REQ_CONN_CLIENTS_LIST 17 // request connected client list
|
||||
#define PROTMESSID_CHANNEL_NAME 18 // set channel name for fader tag
|
||||
|
||||
// lengths of message as defined in protocol.cpp file
|
||||
#define MESS_HEADER_LENGTH_BYTE 5 /* ID, cnt, length */
|
||||
|
@ -68,6 +69,7 @@ public:
|
|||
void CreateServerFullMes();
|
||||
void CreateNetwBlSiFactMes ( const int iNetwBlSiFact );
|
||||
void CreateChanGainMes ( const int iChanID, const double dGain );
|
||||
void CreateChanNameMes ( const std::string strName );
|
||||
|
||||
void CreateConClientListMes ( const CVector<CChannelShortInfo>& vecChanInfo );
|
||||
|
||||
|
@ -135,6 +137,7 @@ protected:
|
|||
void EvaluateServerFullMes ( unsigned int iPos, const CVector<uint8_t>& vecData );
|
||||
void EvaluateNetwBlSiFactMes ( unsigned int iPos, const CVector<uint8_t>& vecData );
|
||||
void EvaluateChanGainMes ( unsigned int iPos, const CVector<uint8_t>& vecData );
|
||||
void EvaluateChanNameMes ( unsigned int iPos, const CVector<uint8_t>& vecData );
|
||||
void EvaluateConClientListMes ( unsigned int iPos, const CVector<uint8_t>& vecData );
|
||||
|
||||
int iOldRecID, iOldRecCnt;
|
||||
|
@ -157,6 +160,7 @@ signals:
|
|||
void ChangeJittBufSize ( int iNewJitBufSize );
|
||||
void ChangeNetwBlSiFact ( int iNewNetwBlSiFact );
|
||||
void ChangeChanGain ( int iChanID, double dNewGain );
|
||||
void ChangeChanName ( std::string strName );
|
||||
void ConClientListMesReceived ( CVector<CChannelShortInfo> vecChanInfo );
|
||||
void ReqJittBufSize();
|
||||
void ReqConnClientsList();
|
||||
|
|
|
@ -52,6 +52,9 @@ void CSettings::ReadIniFile()
|
|||
// IP address
|
||||
pClient->strIPAddress = GetIniSetting ( ini, "Client", "ipaddress" );
|
||||
|
||||
// name
|
||||
pClient->strName = GetIniSetting ( ini, "Client", "name" );
|
||||
|
||||
// audio fader
|
||||
if ( GetNumericIniSet(ini, "Client", "audfad", 0, AUD_FADER_IN_MAX, iValue ) == TRUE ) {
|
||||
pClient->SetAudioInFader ( iValue );
|
||||
|
@ -100,6 +103,9 @@ void CSettings::WriteIniFile()
|
|||
// IP address
|
||||
PutIniSetting ( ini, "Client", "ipaddress", pClient->strIPAddress.c_str() );
|
||||
|
||||
// name
|
||||
PutIniSetting ( ini, "Client", "name", pClient->strName.c_str() );
|
||||
|
||||
// audio fader
|
||||
SetNumericIniSet ( ini, "Client", "audfad", pClient->GetAudioInFader() );
|
||||
|
||||
|
|
Loading…
Reference in a new issue