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

@ -59,9 +59,7 @@ CChannelSet::CChannelSet()
void CChannelSet::CreateAndSendChanListForAllConClients()
{
int i;
CVector<int> veciChanIDs ( 0 );
CVector<uint32_t> veciIpAddrs ( 0 );
CVector<std::string> vecstrNames ( 0 );
CVector<CChannelShortInfo> vecChanInfo ( 0 );
// the channel ID is defined as the order of the channels in the channel
// set where we do not care about not-connected channels
@ -73,9 +71,11 @@ void CChannelSet::CreateAndSendChanListForAllConClients()
if ( vecChannels[i].IsConnected() )
{
// 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() );
CChannelShortInfo ChannelShortInfo (
i, vecChannels[i].GetAddress().InetAddr.ip4Addr(),
vecChannels[i].GetName() );
vecChanInfo.Add ( ChannelShortInfo );
}
}
@ -85,7 +85,7 @@ void CChannelSet::CreateAndSendChanListForAllConClients()
if ( vecChannels[i].IsConnected() )
{
// 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 */
vecChanID.Add ( i );
vecdGains.Add ( vecChannels[i].GetGain() );
// TEST
vecdGains.Add ( 1.0);//vecChannels[i].GetGain() );
const int iOldSize = vecvecdData.Size();
vecvecdData.Enlarge ( 1 );
@ -278,7 +280,8 @@ void CChannelSet::GetConCliParam ( CVector<CHostAddress>& vecHostAddresses,
/******************************************************************************\
* 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
// audio packet was received
@ -314,6 +317,9 @@ CChannel::CChannel() : sName ( "" ), dGain ( (double) 1.0 )
QObject::connect ( &Protocol, SIGNAL ( ReqJittBufSize() ),
SIGNAL ( ReqJittBufSize() ) );
QObject::connect ( &Protocol, SIGNAL ( ConClientListMesReceived ( CVector<CChannelShortInfo> ) ),
SIGNAL ( ConClientListMesReceived ( CVector<CChannelShortInfo> ) ) );
QObject::connect ( &Protocol, SIGNAL ( ChangeNetwBlSiFact ( int ) ),
this, SLOT ( OnNetwBlSiFactChange ( int ) ) );
}

View file

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

View file

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

View file

@ -168,6 +168,9 @@ public slots:
void OnSendProtMessage ( CVector<uint8_t> vecMessage );
void OnReqJittBufSize();
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()),
this, SLOT(OnRevSelR()));
// other
QObject::connect(pClient, SIGNAL ( ConClientListMesReceived ( CVector<CChannelShortInfo> ) ),
this, SLOT ( OnConClientListMesReceived ( CVector<CChannelShortInfo> ) ) );
/* timers --------------------------------------------------------------- */
/* start timer for status bar */
TimerStatus.start(STATUSBAR_UPDATE_TIME);
/*
// TEST
QGridLayout* grid1 = new QGridLayout ( FrameAudioFaders, 2, 1 );
QSlider* pSliderChannelFader = new QSlider ( Qt::Vertical, FrameAudioFaders );
grid1->addWidget( pSliderChannelFader, 0, 0 );
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 );
*/
//new CLlconClientDlg::CChannelFader(FrameAudioFaders, FrameAudioFadersLayout);
//new CLlconClientDlg::CChannelFader(FrameAudioFaders, FrameAudioFadersLayout);
//new CLlconClientDlg::CChannelFader(FrameAudioFaders, FrameAudioFadersLayout);
//new CLlconClientDlg::CChannelFader(FrameAudioFaders, FrameAudioFadersLayout, "test");
/*
// TEST
new CLlconClientDlg::CChannelFader(FrameAudioFaders, FrameAudioFadersLayout);
new CLlconClientDlg::CChannelFader(FrameAudioFaders, FrameAudioFadersLayout);
for ( int z = 0; z < 100; z++)
{
CLlconClientDlg::CChannelFader* pTest = new CLlconClientDlg::CChannelFader(FrameAudioFaders, FrameAudioFadersLayout);
new CLlconClientDlg::CChannelFader(FrameAudioFaders, FrameAudioFadersLayout);
new CLlconClientDlg::CChannelFader(FrameAudioFaders, FrameAudioFadersLayout);
delete pTest;
}
*/
}
@ -315,6 +288,24 @@ void CLlconClientDlg::OnTimerSigMet ()
/* show current level */
ProgressBarInputLevelL->setProgress ( (int) ceil ( dCurSigLevelL ) );
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()
@ -360,30 +351,33 @@ void CLlconClientDlg::customEvent ( QCustomEvent* Event )
// Help classes ---------------------------------------------------------------
CLlconClientDlg::CChannelFader::CChannelFader ( QWidget* pNW, QHBoxLayout* pNPtLy ) :
pParentLayout ( pNPtLy ),
MainGrid ( pNW, 2, 1 ),
Fader ( Qt::Vertical, pNW ),
Label ( "", pNW )
CLlconClientDlg::CChannelFader::CChannelFader ( QWidget* pNW,
QHBoxLayout* pNPtLy,
QString sName ) :
pParentLayout ( pNPtLy )
{
// 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
MainGrid.addWidget( &Fader, 0, 0 );
pMainGrid->addWidget( pFader, 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 );
pFader->setPageStep ( 1 );
pFader->setTickmarks ( QSlider::Both );
pFader->setRange ( 0, AUD_MIX_FADER_MAX );
pFader->setTickInterval ( AUD_MIX_FADER_MAX / 9 );
// TEST set value
Fader.setValue ( AUD_MIX_FADER_MAX );
pFader->setValue ( 0 );
// add label to grid
MainGrid.addWidget( &Label, 1, 0 );
pMainGrid->addWidget( pLabel, 1, 0 );
// set label text
pLabel->setText ( sName );
// TEST set label
Label.setText ( "Test" );
pParentLayout->insertLayout ( 0, &MainGrid );
pParentLayout->insertLayout ( 0, pMainGrid );
}

View file

@ -76,12 +76,19 @@ protected:
class CChannelFader
{
public:
CChannelFader ( QWidget* pNW, QHBoxLayout* pNPtLy );
CChannelFader ( QWidget* pNW, QHBoxLayout* pNPtLy, QString sName );
~CChannelFader()
{
pLabel->close();
pFader->close();
// TODO get rid of pMainGrid
}
protected:
QGridLayout MainGrid;
QSlider Fader;
QLabel Label;
QGridLayout* pMainGrid;
QSlider* pFader;
QLabel* pLabel;
QHBoxLayout* pParentLayout;
};
@ -112,4 +119,5 @@ public slots:
{ pClient->SetReverbLevel ( AUD_REVERB_MAX - value ); }
void OnRevSelL() { pClient->SetReverbOnLeftChan(true); }
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 );
}
void CProtocol::CreateConClientListMes ( const CVector<int>& veciChanIDs,
const CVector<uint32_t>& veciIpAddrs,
const CVector<std::string>& vecstrNames )
void CProtocol::CreateConClientListMes ( const CVector<CChannelShortInfo>& vecChanInfo )
{
const int iNumClients = veciIpAddrs.Size();
const int iNumClients = vecChanInfo.Size();
// build data vector
CVector<uint8_t> vecData ( 0 );
@ -443,7 +441,7 @@ void CProtocol::CreateConClientListMes ( const CVector<int>& veciChanIDs,
for ( int i = 0; i < iNumClients; i++ )
{
// current string size
const int iCurStrLen = vecstrNames[i].size();
const int iCurStrLen = vecChanInfo[i].vecstrName.size();
// size of current list entry
const int iCurListEntrLen =
@ -454,11 +452,11 @@ void CProtocol::CreateConClientListMes ( const CVector<int>& veciChanIDs,
// channel ID
PutValOnStream ( vecData, iPos,
static_cast<uint32_t> ( veciChanIDs[i] ), 1 );
static_cast<uint32_t> ( vecChanInfo[i].veciChanID ), 1 );
// IP address (4 bytes)
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)
PutValOnStream ( vecData, iPos,
@ -469,7 +467,7 @@ void CProtocol::CreateConClientListMes ( const CVector<int>& veciChanIDs,
{
// byte-by-byte copying of the string data
PutValOnStream ( vecData, iPos,
static_cast<uint32_t> ( vecstrNames[i][j] ), 1 );
static_cast<uint32_t> ( vecChanInfo[i].vecstrName[j] ), 1 );
}
}
@ -480,37 +478,35 @@ void CProtocol:: EvaluateConClientListMes ( unsigned int iPos, const CVector<uin
{
int iData;
const int iDataLen = vecData.Size();
CVector<CChannelShortInfo> vecChanInfo ( 0 );
while ( iPos < iDataLen )
{
// 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)
iData = 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() );
const int iIpAddr = static_cast<int> ( GetValFromStream ( vecData, iPos, 4 ) );
// number of bytes for name string (2 bytes)
const int iStringLen =
static_cast<int> ( GetValFromStream ( vecData, iPos, 2 ) );
// name string (n bytes)
std::string strCurString = "";
std::string strCurStr = "";
for ( int j = 0; j < iStringLen; j++ )
{
// byte-by-byte copying of the string data
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 CreateChanGainMes ( const int iChanID, const double dGain );
void CreateConClientListMes ( const CVector<int>& veciChanIDs,
const CVector<uint32_t>& veciIpAddrs,
const CVector<std::string>& vecstrNames );
void CreateConClientListMes ( const CVector<CChannelShortInfo>& vecChanInfo );
void CreateAndSendAcknMess ( const int& iID, const int& iCnt );
@ -153,6 +151,7 @@ signals:
void ChangeJittBufSize ( int iNewJitBufSize );
void ChangeNetwBlSiFact ( int iNewNetwBlSiFact );
void ChangeChanGain ( int iChanID, double dNewGain );
void ConClientListMesReceived ( CVector<CChannelShortInfo> vecChanInfo );
void ReqJittBufSize();
};

View file

@ -360,6 +360,18 @@ public:
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 ------------------------------------------------------- */
class CAudioReverb