preparations for mixer board

This commit is contained in:
Volker Fischer 2006-11-26 21:25:56 +00:00
parent 93200960c3
commit 6729eaf7ae
9 changed files with 129 additions and 110 deletions

View file

@ -58,10 +58,8 @@ CChannelSet::CChannelSet()
void CChannelSet::CreateAndSendChanListForAllConClients() void CChannelSet::CreateAndSendChanListForAllConClients()
{ {
int i; int i;
CVector<int> veciChanIDs ( 0 ); CVector<CChannelShortInfo> vecChanInfo ( 0 );
CVector<uint32_t> veciIpAddrs ( 0 );
CVector<std::string> vecstrNames ( 0 );
// the channel ID is defined as the order of the channels in the channel // the channel ID is defined as the order of the channels in the channel
// set where we do not care about not-connected channels // set where we do not care about not-connected channels
@ -73,9 +71,11 @@ void CChannelSet::CreateAndSendChanListForAllConClients()
if ( vecChannels[i].IsConnected() ) if ( vecChannels[i].IsConnected() )
{ {
// append channel ID, IP address and channel name to storing vectors // append channel ID, IP address and channel name to storing vectors
veciChanIDs.Add ( i ); CChannelShortInfo ChannelShortInfo (
veciIpAddrs.Add ( vecChannels[i].GetAddress().InetAddr.ip4Addr() ); i, vecChannels[i].GetAddress().InetAddr.ip4Addr(),
vecstrNames.Add ( vecChannels[i].GetName() ); vecChannels[i].GetName() );
vecChanInfo.Add ( ChannelShortInfo );
} }
} }
@ -85,7 +85,7 @@ void CChannelSet::CreateAndSendChanListForAllConClients()
if ( vecChannels[i].IsConnected() ) if ( vecChannels[i].IsConnected() )
{ {
// send message // send message
vecChannels[i].CreateConClientListMes ( veciChanIDs, veciIpAddrs, vecstrNames ); vecChannels[i].CreateConClientListMes ( vecChanInfo );
} }
} }
} }
@ -225,7 +225,9 @@ void CChannelSet::GetBlockAllConC ( CVector<int>& vecChanID,
{ {
/* add ID, gain and data */ /* add ID, gain and data */
vecChanID.Add ( i ); vecChanID.Add ( i );
vecdGains.Add ( vecChannels[i].GetGain() );
// TEST
vecdGains.Add ( 1.0);//vecChannels[i].GetGain() );
const int iOldSize = vecvecdData.Size(); const int iOldSize = vecvecdData.Size();
vecvecdData.Enlarge ( 1 ); vecvecdData.Enlarge ( 1 );
@ -278,7 +280,8 @@ void CChannelSet::GetConCliParam ( CVector<CHostAddress>& vecHostAddresses,
/******************************************************************************\ /******************************************************************************\
* CChannel * * CChannel *
\******************************************************************************/ \******************************************************************************/
CChannel::CChannel() : sName ( "" ), dGain ( (double) 1.0 ) CChannel::CChannel() : sName ( "" ),
vecdGains ( MAX_NUM_CHANNELS, (double) 1.0 )
{ {
// query all possible network in buffer sizes for determining if an // query all possible network in buffer sizes for determining if an
// audio packet was received // audio packet was received
@ -314,6 +317,9 @@ CChannel::CChannel() : sName ( "" ), dGain ( (double) 1.0 )
QObject::connect ( &Protocol, SIGNAL ( ReqJittBufSize() ), QObject::connect ( &Protocol, SIGNAL ( ReqJittBufSize() ),
SIGNAL ( ReqJittBufSize() ) ); SIGNAL ( ReqJittBufSize() ) );
QObject::connect ( &Protocol, SIGNAL ( ConClientListMesReceived ( CVector<CChannelShortInfo> ) ),
SIGNAL ( ConClientListMesReceived ( CVector<CChannelShortInfo> ) ) );
QObject::connect ( &Protocol, SIGNAL ( ChangeNetwBlSiFact ( int ) ), QObject::connect ( &Protocol, SIGNAL ( ChangeNetwBlSiFact ( int ) ),
this, SLOT ( OnNetwBlSiFactChange ( int ) ) ); this, SLOT ( OnNetwBlSiFactChange ( int ) ) );
} }

View file

@ -83,8 +83,8 @@ public:
void SetName ( const std::string sNNa ) { sName = sNNa; } void SetName ( const std::string sNNa ) { sName = sNNa; }
std::string GetName() { return sName; } std::string GetName() { return sName; }
void SetGain ( const double dNG ) { dGain = dNG; } void SetGain ( const int iNID, const double dNG ) { vecdGains[iNID] = dNG; }
double GetGain() { return dGain; } double GetGain( const int iNID ) { return vecdGains[iNID]; }
void SetSockBufSize ( const int iNumBlocks ); void SetSockBufSize ( const int iNumBlocks );
int GetSockBufSize() { return iCurSockBufSize; } int GetSockBufSize() { return iCurSockBufSize; }
@ -112,11 +112,9 @@ public:
} }
} }
void CreateConClientListMes ( const CVector<int>& veciChanIDs, void CreateConClientListMes ( const CVector<CChannelShortInfo>& vecChanInfo )
const CVector<uint32_t>& veciIpAddrs,
const CVector<std::string>& vecstrNames )
{ {
Protocol.CreateConClientListMes ( veciChanIDs, veciIpAddrs, vecstrNames ); Protocol.CreateConClientListMes ( vecChanInfo );
} }
protected: protected:
@ -140,9 +138,8 @@ protected:
// channel name // channel name
std::string sName; std::string sName;
// TODO we need mixer and effect settings for all the other channels, too!!! // mixer and effect settings
// mixer and effect settings CVector<double> vecdGains;
double dGain;
// network jitter-buffer // network jitter-buffer
CNetBuf SockBuf; CNetBuf SockBuf;
@ -173,6 +170,7 @@ signals:
void MessReadyForSending ( CVector<uint8_t> vecMessage ); void MessReadyForSending ( CVector<uint8_t> vecMessage );
void NewConnection(); void NewConnection();
void ReqJittBufSize(); void ReqJittBufSize();
void ConClientListMesReceived ( CVector<CChannelShortInfo> vecChanInfo );
void ProtocolStatus ( bool bOk ); void ProtocolStatus ( bool bOk );
}; };

View file

@ -41,6 +41,9 @@ CClient::CClient () : bRun ( false ), Socket ( &Channel ),
QObject::connect ( &Channel, SIGNAL ( ProtocolStatus ( bool ) ), QObject::connect ( &Channel, SIGNAL ( ProtocolStatus ( bool ) ),
this, SLOT ( OnProtocolStatus ( bool ) ) ); this, SLOT ( OnProtocolStatus ( bool ) ) );
QObject::connect ( &Channel, SIGNAL ( ConClientListMesReceived ( CVector<CChannelShortInfo> ) ),
SIGNAL ( ConClientListMesReceived ( CVector<CChannelShortInfo> ) ) );
} }
void CClient::OnSendProtMessage ( CVector<uint8_t> vecMessage ) void CClient::OnSendProtMessage ( CVector<uint8_t> vecMessage )

View file

@ -168,6 +168,9 @@ public slots:
void OnSendProtMessage ( CVector<uint8_t> vecMessage ); void OnSendProtMessage ( CVector<uint8_t> vecMessage );
void OnReqJittBufSize(); void OnReqJittBufSize();
void OnProtocolStatus ( bool bOk ); void OnProtocolStatus ( bool bOk );
signals:
void ConClientListMesReceived ( CVector<CChannelShortInfo> vecChanInfo );
}; };

View file

@ -160,59 +160,32 @@ CLlconClientDlg::CLlconClientDlg ( CClient* pNCliP, QWidget* parent,
QObject::connect(RadioButtonRevSelR, SIGNAL(clicked()), QObject::connect(RadioButtonRevSelR, SIGNAL(clicked()),
this, SLOT(OnRevSelR())); this, SLOT(OnRevSelR()));
// other
QObject::connect(pClient, SIGNAL ( ConClientListMesReceived ( CVector<CChannelShortInfo> ) ),
this, SLOT ( OnConClientListMesReceived ( CVector<CChannelShortInfo> ) ) );
/* timers --------------------------------------------------------------- */ /* timers --------------------------------------------------------------- */
/* start timer for status bar */ /* start timer for status bar */
TimerStatus.start(STATUSBAR_UPDATE_TIME); TimerStatus.start(STATUSBAR_UPDATE_TIME);
/*
// TEST // TEST
QGridLayout* grid1 = new QGridLayout ( FrameAudioFaders, 2, 1 ); //new CLlconClientDlg::CChannelFader(FrameAudioFaders, FrameAudioFadersLayout);
//new CLlconClientDlg::CChannelFader(FrameAudioFaders, FrameAudioFadersLayout);
QSlider* pSliderChannelFader = new QSlider ( Qt::Vertical, FrameAudioFaders ); //new CLlconClientDlg::CChannelFader(FrameAudioFaders, FrameAudioFadersLayout);
grid1->addWidget( pSliderChannelFader, 0, 0 ); //new CLlconClientDlg::CChannelFader(FrameAudioFaders, FrameAudioFadersLayout, "test");
pSliderChannelFader->setPageStep ( 1 );
pSliderChannelFader->setTickmarks ( QSlider::Both );
pSliderChannelFader->setRange(0, AUD_MIX_FADER_MAX);
pSliderChannelFader->setTickInterval(AUD_MIX_FADER_MAX / 9);
pSliderChannelFader->setValue ( AUD_MIX_FADER_MAX );
QLabel* pTextChannelName = new QLabel ( "Test", FrameAudioFaders );
grid1->addWidget( pTextChannelName, 1, 0 );
FrameAudioFadersLayout->insertLayout ( 0, grid1 );
QGridLayout* grid2 = new QGridLayout ( FrameAudioFaders, 2, 1 );
QSlider* pSliderChannelFader2 = new QSlider ( Qt::Vertical, FrameAudioFaders );
grid2->addWidget( pSliderChannelFader2, 0, 0 );
pSliderChannelFader2->setPageStep ( 1 );
pSliderChannelFader2->setTickmarks ( QSlider::Both );
pSliderChannelFader2->setRange(0, AUD_MIX_FADER_MAX);
pSliderChannelFader2->setTickInterval(AUD_MIX_FADER_MAX / 9);
pSliderChannelFader2->setValue ( AUD_MIX_FADER_MAX );
QLabel* pTextChannelName2 = new QLabel ( "Test", FrameAudioFaders );
grid2->addWidget( pTextChannelName2, 1, 0 );
FrameAudioFadersLayout->insertLayout ( 0, grid2 );
*/
/* /*
// TEST for ( int z = 0; z < 100; z++)
new CLlconClientDlg::CChannelFader(FrameAudioFaders, FrameAudioFadersLayout); {
new CLlconClientDlg::CChannelFader(FrameAudioFaders, FrameAudioFadersLayout);
CLlconClientDlg::CChannelFader* pTest = new CLlconClientDlg::CChannelFader(FrameAudioFaders, FrameAudioFadersLayout); CLlconClientDlg::CChannelFader* pTest = new CLlconClientDlg::CChannelFader(FrameAudioFaders, FrameAudioFadersLayout);
new CLlconClientDlg::CChannelFader(FrameAudioFaders, FrameAudioFadersLayout); delete pTest;
new CLlconClientDlg::CChannelFader(FrameAudioFaders, FrameAudioFadersLayout); }
*/ */
} }
@ -315,6 +288,24 @@ void CLlconClientDlg::OnTimerSigMet ()
/* show current level */ /* show current level */
ProgressBarInputLevelL->setProgress ( (int) ceil ( dCurSigLevelL ) ); ProgressBarInputLevelL->setProgress ( (int) ceil ( dCurSigLevelL ) );
ProgressBarInputLevelR->setProgress ( (int) ceil ( dCurSigLevelR ) ); ProgressBarInputLevelR->setProgress ( (int) ceil ( dCurSigLevelR ) );
}
void CLlconClientDlg::OnConClientListMesReceived ( CVector<CChannelShortInfo> vecChanInfo )
{
// TODO
// TEST
for ( int i = 0; i < vecChanInfo.Size(); i++ )
{
QHostAddress addrTest ( vecChanInfo[i].veciIpAddr );
new CLlconClientDlg::CChannelFader ( FrameAudioFaders,
FrameAudioFadersLayout, addrTest.toString() );
}
} }
void CLlconClientDlg::UpdateDisplay() void CLlconClientDlg::UpdateDisplay()
@ -360,30 +351,33 @@ void CLlconClientDlg::customEvent ( QCustomEvent* Event )
// Help classes --------------------------------------------------------------- // Help classes ---------------------------------------------------------------
CLlconClientDlg::CChannelFader::CChannelFader ( QWidget* pNW, QHBoxLayout* pNPtLy ) : CLlconClientDlg::CChannelFader::CChannelFader ( QWidget* pNW,
pParentLayout ( pNPtLy ), QHBoxLayout* pNPtLy,
MainGrid ( pNW, 2, 1 ), QString sName ) :
Fader ( Qt::Vertical, pNW ), pParentLayout ( pNPtLy )
Label ( "", pNW )
{ {
// create new GUI control objects and store pointers to them
pMainGrid = new QGridLayout ( pNW, 2, 1 );
pFader = new QSlider ( Qt::Vertical, pNW );
pLabel = new QLabel ( "", pNW );
// add slider to grid as position 0 / 0 // add slider to grid as position 0 / 0
MainGrid.addWidget( &Fader, 0, 0 ); pMainGrid->addWidget( pFader, 0, 0 );
// setup slider // setup slider
Fader.setPageStep ( 1 ); pFader->setPageStep ( 1 );
Fader.setTickmarks ( QSlider::Both ); pFader->setTickmarks ( QSlider::Both );
Fader.setRange ( 0, AUD_MIX_FADER_MAX ); pFader->setRange ( 0, AUD_MIX_FADER_MAX );
Fader.setTickInterval ( AUD_MIX_FADER_MAX / 9 ); pFader->setTickInterval ( AUD_MIX_FADER_MAX / 9 );
// TEST set value // TEST set value
Fader.setValue ( AUD_MIX_FADER_MAX ); pFader->setValue ( 0 );
// add label to grid // add label to grid
MainGrid.addWidget( &Label, 1, 0 ); pMainGrid->addWidget( pLabel, 1, 0 );
// set label text
pLabel->setText ( sName );
// TEST set label pParentLayout->insertLayout ( 0, pMainGrid );
Label.setText ( "Test" );
pParentLayout->insertLayout ( 0, &MainGrid );
} }

View file

@ -76,12 +76,19 @@ protected:
class CChannelFader class CChannelFader
{ {
public: public:
CChannelFader ( QWidget* pNW, QHBoxLayout* pNPtLy ); CChannelFader ( QWidget* pNW, QHBoxLayout* pNPtLy, QString sName );
~CChannelFader()
{
pLabel->close();
pFader->close();
// TODO get rid of pMainGrid
}
protected: protected:
QGridLayout MainGrid; QGridLayout* pMainGrid;
QSlider Fader; QSlider* pFader;
QLabel Label; QLabel* pLabel;
QHBoxLayout* pParentLayout; QHBoxLayout* pParentLayout;
}; };
@ -112,4 +119,5 @@ public slots:
{ pClient->SetReverbLevel ( AUD_REVERB_MAX - value ); } { pClient->SetReverbLevel ( AUD_REVERB_MAX - value ); }
void OnRevSelL() { pClient->SetReverbOnLeftChan(true); } void OnRevSelL() { pClient->SetReverbOnLeftChan(true); }
void OnRevSelR() { pClient->SetReverbOnLeftChan(false); } void OnRevSelR() { pClient->SetReverbOnLeftChan(false); }
void OnConClientListMesReceived ( CVector<CChannelShortInfo> vecChanInfo );
}; };

View file

@ -430,11 +430,9 @@ void CProtocol::EvaluateChanGainMes ( unsigned int iPos, const CVector<uint8_t>&
emit ChangeChanGain ( iCurID, dNewGain ); emit ChangeChanGain ( iCurID, dNewGain );
} }
void CProtocol::CreateConClientListMes ( const CVector<int>& veciChanIDs, void CProtocol::CreateConClientListMes ( const CVector<CChannelShortInfo>& vecChanInfo )
const CVector<uint32_t>& veciIpAddrs,
const CVector<std::string>& vecstrNames )
{ {
const int iNumClients = veciIpAddrs.Size(); const int iNumClients = vecChanInfo.Size();
// build data vector // build data vector
CVector<uint8_t> vecData ( 0 ); CVector<uint8_t> vecData ( 0 );
@ -443,7 +441,7 @@ void CProtocol::CreateConClientListMes ( const CVector<int>& veciChanIDs,
for ( int i = 0; i < iNumClients; i++ ) for ( int i = 0; i < iNumClients; i++ )
{ {
// current string size // current string size
const int iCurStrLen = vecstrNames[i].size(); const int iCurStrLen = vecChanInfo[i].vecstrName.size();
// size of current list entry // size of current list entry
const int iCurListEntrLen = const int iCurListEntrLen =
@ -454,11 +452,11 @@ void CProtocol::CreateConClientListMes ( const CVector<int>& veciChanIDs,
// channel ID // channel ID
PutValOnStream ( vecData, iPos, PutValOnStream ( vecData, iPos,
static_cast<uint32_t> ( veciChanIDs[i] ), 1 ); static_cast<uint32_t> ( vecChanInfo[i].veciChanID ), 1 );
// IP address (4 bytes) // IP address (4 bytes)
PutValOnStream ( vecData, iPos, PutValOnStream ( vecData, iPos,
static_cast<uint32_t> ( veciIpAddrs[i] ), 4 ); static_cast<uint32_t> ( vecChanInfo[i].veciIpAddr ), 4 );
// number of bytes for name string (2 bytes) // number of bytes for name string (2 bytes)
PutValOnStream ( vecData, iPos, PutValOnStream ( vecData, iPos,
@ -469,7 +467,7 @@ void CProtocol::CreateConClientListMes ( const CVector<int>& veciChanIDs,
{ {
// byte-by-byte copying of the string data // byte-by-byte copying of the string data
PutValOnStream ( vecData, iPos, PutValOnStream ( vecData, iPos,
static_cast<uint32_t> ( vecstrNames[i][j] ), 1 ); static_cast<uint32_t> ( vecChanInfo[i].vecstrName[j] ), 1 );
} }
} }
@ -478,39 +476,37 @@ void CProtocol::CreateConClientListMes ( const CVector<int>& veciChanIDs,
void CProtocol:: EvaluateConClientListMes ( unsigned int iPos, const CVector<uint8_t>& vecData ) void CProtocol:: EvaluateConClientListMes ( unsigned int iPos, const CVector<uint8_t>& vecData )
{ {
int iData; int iData;
const int iDataLen = vecData.Size(); const int iDataLen = vecData.Size();
CVector<CChannelShortInfo> vecChanInfo ( 0 );
while ( iPos < iDataLen ) while ( iPos < iDataLen )
{ {
// channel ID (1 byte) // channel ID (1 byte)
iData = static_cast<int> ( GetValFromStream ( vecData, iPos, 1 ) ); const int iChanID = static_cast<int> ( GetValFromStream ( vecData, iPos, 1 ) );
// IP address (4 bytes) // IP address (4 bytes)
iData = static_cast<int> ( GetValFromStream ( vecData, iPos, 4 ) ); const int iIpAddr = static_cast<int> ( GetValFromStream ( vecData, iPos, 4 ) );
// TODO do something with the received IP address "iData"
// TEST
QHostAddress addrTest ( iData );
printf ( "%s ", addrTest.toString().latin1() );
// number of bytes for name string (2 bytes) // number of bytes for name string (2 bytes)
const int iStringLen = const int iStringLen =
static_cast<int> ( GetValFromStream ( vecData, iPos, 2 ) ); static_cast<int> ( GetValFromStream ( vecData, iPos, 2 ) );
// name string (n bytes) // name string (n bytes)
std::string strCurString = ""; std::string strCurStr = "";
for ( int j = 0; j < iStringLen; j++ ) for ( int j = 0; j < iStringLen; j++ )
{ {
// byte-by-byte copying of the string data // byte-by-byte copying of the string data
iData = static_cast<int> ( GetValFromStream ( vecData, iPos, 1 ) ); iData = static_cast<int> ( GetValFromStream ( vecData, iPos, 1 ) );
strCurString += std::string ( (char*) &iData ); strCurStr += std::string ( (char*) &iData );
} }
// TODO do something with the received name string "strCurString" // add channel information to vector
vecChanInfo.Add ( CChannelShortInfo ( iChanID, iIpAddr, strCurStr ) );
} }
// invoke message action
emit ConClientListMesReceived ( vecChanInfo );
} }

View file

@ -65,9 +65,7 @@ public:
void CreateNetwBlSiFactMes ( const int iNetwBlSiFact ); void CreateNetwBlSiFactMes ( const int iNetwBlSiFact );
void CreateChanGainMes ( const int iChanID, const double dGain ); void CreateChanGainMes ( const int iChanID, const double dGain );
void CreateConClientListMes ( const CVector<int>& veciChanIDs, void CreateConClientListMes ( const CVector<CChannelShortInfo>& vecChanInfo );
const CVector<uint32_t>& veciIpAddrs,
const CVector<std::string>& vecstrNames );
void CreateAndSendAcknMess ( const int& iID, const int& iCnt ); void CreateAndSendAcknMess ( const int& iID, const int& iCnt );
@ -153,6 +151,7 @@ signals:
void ChangeJittBufSize ( int iNewJitBufSize ); void ChangeJittBufSize ( int iNewJitBufSize );
void ChangeNetwBlSiFact ( int iNewNetwBlSiFact ); void ChangeNetwBlSiFact ( int iNewNetwBlSiFact );
void ChangeChanGain ( int iChanID, double dNewGain ); void ChangeChanGain ( int iChanID, double dNewGain );
void ConClientListMesReceived ( CVector<CChannelShortInfo> vecChanInfo );
void ReqJittBufSize(); void ReqJittBufSize();
}; };

View file

@ -360,6 +360,18 @@ public:
Q_UINT16 iPort; Q_UINT16 iPort;
}; };
class CChannelShortInfo
{
public:
CChannelShortInfo() : veciChanID ( 0 ), veciIpAddr ( 0 ), vecstrName ( "" ) {}
CChannelShortInfo ( const int iNID, const uint32_t nIP, const std::string nN ) :
veciChanID ( iNID ), veciIpAddr ( nIP ), vecstrName ( nN ) {}
int veciChanID;
uint32_t veciIpAddr;
std::string vecstrName;
};
/* Audio Reverbration ------------------------------------------------------- */ /* Audio Reverbration ------------------------------------------------------- */
class CAudioReverb class CAudioReverb