changed protocol for channel list -> added channel ID; changed channel ID to one byte in protocol; added class for mixer fader control for client GUI

This commit is contained in:
Volker Fischer 2006-11-19 23:14:22 +00:00
parent e89eb96a37
commit e0c0544fd7
6 changed files with 90 additions and 30 deletions

View file

@ -58,7 +58,8 @@ CChannelSet::CChannelSet()
void CChannelSet::CreateAndSendChanListForAllConClients()
{
int i;
int i;
CVector<int> veciChanIDs ( 0 );
CVector<uint32_t> veciIpAddrs ( 0 );
CVector<std::string> vecstrNames ( 0 );
@ -71,7 +72,8 @@ void CChannelSet::CreateAndSendChanListForAllConClients()
{
if ( vecChannels[i].IsConnected() )
{
// append IP address and channel name to storing vectors
// append channel ID, IP address and channel name to storing vectors
veciChanIDs.Add ( i );
veciIpAddrs.Add ( vecChannels[i].GetAddress().InetAddr.ip4Addr() );
vecstrNames.Add ( vecChannels[i].GetName() );
}
@ -83,7 +85,7 @@ void CChannelSet::CreateAndSendChanListForAllConClients()
if ( vecChannels[i].IsConnected() )
{
// send message
vecChannels[i].CreateConClientListMes ( veciIpAddrs, vecstrNames );
vecChannels[i].CreateConClientListMes ( veciChanIDs, veciIpAddrs, vecstrNames );
}
}
}

View file

@ -112,10 +112,11 @@ public:
}
}
void CreateConClientListMes ( const CVector<uint32_t>& veciIpAddrs,
void CreateConClientListMes ( const CVector<int>& veciChanIDs,
const CVector<uint32_t>& veciIpAddrs,
const CVector<std::string>& vecstrNames )
{
Protocol.CreateConClientListMes ( veciIpAddrs, vecstrNames );
Protocol.CreateConClientListMes ( veciChanIDs, veciIpAddrs, vecstrNames );
}
protected:

View file

@ -166,9 +166,8 @@ CLlconClientDlg::CLlconClientDlg ( CClient* pNCliP, QWidget* parent,
TimerStatus.start(STATUSBAR_UPDATE_TIME);
// TEST
/*
// TEST
QGridLayout* grid1 = new QGridLayout ( FrameAudioFaders, 2, 1 );
QSlider* pSliderChannelFader = new QSlider ( Qt::Vertical, FrameAudioFaders );
@ -207,6 +206,11 @@ grid2->addWidget( pTextChannelName2, 1, 0 );
FrameAudioFadersLayout->insertLayout ( 0, grid2 );
*/
/*
// TEST
new CLlconClientDlg::CChannelFader(FrameAudioFaders, FrameAudioFadersLayout);
*/
}
@ -350,3 +354,33 @@ void CLlconClientDlg::customEvent ( QCustomEvent* Event )
ClientSettingsDlg.SetStatus ( iMessType, iStatus );
}
}
// Help classes ---------------------------------------------------------------
CLlconClientDlg::CChannelFader::CChannelFader ( QWidget* pNW, QHBoxLayout* pNPtLy ) :
pParentLayout ( pNPtLy ),
MainGrid ( pNW, 2, 1 ),
Fader ( Qt::Vertical, pNW ),
Label ( "", pNW )
{
// add slider to grid as position 0 / 0
MainGrid.addWidget( &Fader, 0, 0 );
// setup slider
Fader.setPageStep ( 1 );
Fader.setTickmarks ( QSlider::Both );
Fader.setRange(0, AUD_MIX_FADER_MAX);
Fader.setTickInterval(AUD_MIX_FADER_MAX / 9);
// TEST set value
Fader.setValue ( AUD_MIX_FADER_MAX );
// add label to grid
MainGrid.addWidget( &Label, 1, 0 );
// TEST set label
Label.setText ( "Test" );
pParentLayout->insertLayout ( 0, &MainGrid );
}

View file

@ -72,20 +72,35 @@ public:
virtual ~CLlconClientDlg ();
protected:
CClient* pClient;
bool bConnected;
QTimer TimerSigMet;
QTimer TimerStatus;
protected:
class CChannelFader
{
public:
CChannelFader ( QWidget* pNW, QHBoxLayout* pNPtLy );
protected:
QGridLayout MainGrid;
QSlider Fader;
QLabel Label;
QHBoxLayout* pParentLayout;
};
virtual void customEvent ( QCustomEvent* Event );
virtual void closeEvent ( QCloseEvent * Event );
void UpdateDisplay();
CClient* pClient;
bool bConnected;
QTimer TimerSigMet;
QTimer TimerStatus;
virtual void customEvent ( QCustomEvent* Event );
virtual void closeEvent ( QCloseEvent * Event );
void UpdateDisplay();
QPopupMenu* pSettingsMenu;
QMenuBar* pMenu;
QPopupMenu* pSettingsMenu;
QMenuBar* pMenu;
CClientSettingsDlg ClientSettingsDlg;
CClientSettingsDlg ClientSettingsDlg;
CVector<CChannelFader> vecpChanFader;
public slots:
void OnConnectDisconBut();

View file

@ -59,18 +59,18 @@ MESSAGES
- Gain of channel PROTMESSID_CHANNEL_GAIN
+--------------------+--------------+
| 2 bytes channel ID | 2 bytes gain |
+--------------------+--------------+
+-------------------+--------------+
| 1 byte channel ID | 2 bytes gain |
+-------------------+--------------+
- IP number and name of connected clients PROTMESSID_CONN_CLIENTS_LIST
for each connected client append following data:
+--------------------+------------------+----------------------+
| 4 bytes IP address | 2 bytes number n | n bytes UTF-8 string |
+--------------------+------------------+----------------------+
+-------------------+--------------------+------------------+----------------------+
| 1 byte channel ID | 4 bytes IP address | 2 bytes number n | n bytes UTF-8 string |
+-------------------+--------------------+------------------+----------------------+
*
******************************************************************************
@ -400,12 +400,12 @@ void CProtocol::EvaluateNetwBlSiFactMes ( unsigned int iPos, const CVector<uint8
void CProtocol::CreateChanGainMes ( const int iChanID, const double dGain )
{
CVector<uint8_t> vecData ( 4 ); // 4 bytes of data
CVector<uint8_t> vecData ( 3 ); // 3 bytes of data
unsigned int iPos = 0; // init position pointer
// build data vector
// channel ID
PutValOnStream ( vecData, iPos, static_cast<uint32_t> ( iChanID ), 2 );
PutValOnStream ( vecData, iPos, static_cast<uint32_t> ( iChanID ), 1 );
// actual gain, we convert from double with range 0..1 to integer
const int iCurGain = (int) ( dGain * ( 1 << 16 ) );
@ -418,7 +418,7 @@ void CProtocol::EvaluateChanGainMes ( unsigned int iPos, const CVector<uint8_t>&
{
// channel ID
const int iCurID =
static_cast<int> ( GetValFromStream ( vecData, iPos, 2 ) );
static_cast<int> ( GetValFromStream ( vecData, iPos, 1 ) );
// actual gain, we convert from integer to double with range 0..1
const int iData =
@ -430,7 +430,8 @@ void CProtocol::EvaluateChanGainMes ( unsigned int iPos, const CVector<uint8_t>&
emit ChangeChanGain ( iCurID, dNewGain );
}
void CProtocol::CreateConClientListMes ( const CVector<uint32_t>& veciIpAddrs,
void CProtocol::CreateConClientListMes ( const CVector<int>& veciChanIDs,
const CVector<uint32_t>& veciIpAddrs,
const CVector<std::string>& vecstrNames )
{
const int iNumClients = veciIpAddrs.Size();
@ -446,11 +447,15 @@ void CProtocol::CreateConClientListMes ( const CVector<uint32_t>& veciIpAddrs,
// size of current list entry
const int iCurListEntrLen =
4 /* IP addr. */ + 2 /* str. size */ + iCurStrLen;
1 /* chan ID */ + 4 /* IP addr. */ + 2 /* str. size */ + iCurStrLen;
// make space for new data
vecData.Enlarge ( iCurListEntrLen );
// channel ID
PutValOnStream ( vecData, iPos,
static_cast<uint32_t> ( veciChanIDs[i] ), 1 );
// IP address (4 bytes)
PutValOnStream ( vecData, iPos,
static_cast<uint32_t> ( veciIpAddrs[i] ), 4 );
@ -478,6 +483,8 @@ void CProtocol:: EvaluateConClientListMes ( unsigned int iPos, const CVector<uin
while ( iPos < iDataLen )
{
// channel ID (1 byte)
iData = static_cast<int> ( GetValFromStream ( vecData, iPos, 1 ) );
// IP address (4 bytes)
iData = static_cast<int> ( GetValFromStream ( vecData, iPos, 4 ) );

View file

@ -65,7 +65,8 @@ public:
void CreateNetwBlSiFactMes ( const int iNetwBlSiFact );
void CreateChanGainMes ( const int iChanID, const double dGain );
void CreateConClientListMes ( const CVector<uint32_t>& veciIpAddrs,
void CreateConClientListMes ( const CVector<int>& veciChanIDs,
const CVector<uint32_t>& veciIpAddrs,
const CVector<std::string>& vecstrNames );
void CreateAndSendAcknMess ( const int& iID, const int& iCnt );