2006-01-28 12:29:22 +01:00
|
|
|
/******************************************************************************\
|
|
|
|
* Copyright (c) 2004-2006
|
|
|
|
*
|
|
|
|
* Author(s):
|
2006-11-25 15:46:57 +01:00
|
|
|
* Volker Fischer
|
2006-01-28 12:29:22 +01:00
|
|
|
*
|
|
|
|
******************************************************************************
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify it under
|
|
|
|
* the terms of the GNU General Public License as published by the Free Software
|
|
|
|
* Foundation; either version 2 of the License, or (at your option) any later
|
|
|
|
* version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful, but WITHOUT
|
|
|
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
|
|
|
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
|
|
|
* details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License along with
|
|
|
|
* this program; if not, write to the Free Software Foundation, Inc.,
|
|
|
|
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
|
|
*
|
|
|
|
\******************************************************************************/
|
|
|
|
|
|
|
|
#include "llconclientdlg.h"
|
|
|
|
|
|
|
|
|
|
|
|
/* Implementation *************************************************************/
|
|
|
|
CLlconClientDlg::CLlconClientDlg ( CClient* pNCliP, QWidget* parent,
|
2006-11-25 15:46:57 +01:00
|
|
|
const char* name, bool modal, WFlags f) : pClient ( pNCliP ),
|
|
|
|
CLlconClientDlgBase ( parent, name, modal, f ),
|
2006-12-09 16:00:24 +01:00
|
|
|
ClientSettingsDlg ( pNCliP, 0, 0, FALSE, Qt::WStyle_MinMax )
|
2006-01-28 12:29:22 +01:00
|
|
|
{
|
2006-11-25 15:46:57 +01:00
|
|
|
/* add help text to controls */
|
|
|
|
QString strInpLevH = tr("<b>Input level meter:</b> Shows the level of the "
|
|
|
|
"input audio signal of the sound card. The level is in dB. Overload "
|
|
|
|
"should be avoided.");
|
|
|
|
QWhatsThis::add(TextLabelInputLevel, strInpLevH);
|
|
|
|
QWhatsThis::add(ProgressBarInputLevelL, strInpLevH);
|
|
|
|
QWhatsThis::add(ProgressBarInputLevelR, strInpLevH);
|
2006-01-28 12:29:22 +01:00
|
|
|
|
2006-11-25 15:46:57 +01:00
|
|
|
QWhatsThis::add(PushButtonConnect, tr("<b>Connect / Disconnect Button:"
|
|
|
|
"</b> Push this button to connect the server. A valid IP address has "
|
|
|
|
"to be specified before. If the client is connected, pressing this "
|
|
|
|
"button will disconnect the connection."));
|
2006-01-28 12:29:22 +01:00
|
|
|
|
2006-11-25 15:46:57 +01:00
|
|
|
QWhatsThis::add(TextLabelStatus, tr("<b>Status Bar:</b> In the status bar "
|
|
|
|
"different messages are displayed. E.g., if an error ocurred or the "
|
|
|
|
"status of the connection is shown."));
|
2006-01-28 12:29:22 +01:00
|
|
|
|
2006-11-25 15:46:57 +01:00
|
|
|
QString strServAddrH = tr("<b>Server Address:</b> In this edit control, "
|
|
|
|
"the IP address of the server can be set. If an invalid address was "
|
|
|
|
"chosen, an error message is shown in the status bar.");
|
|
|
|
QWhatsThis::add(TextLabelServerAddr, strServAddrH);
|
|
|
|
QWhatsThis::add(LineEditServerAddr, strServAddrH);
|
|
|
|
|
|
|
|
QString strAudFader = tr ( "<b>Audio Fader:</b> With the audio fader "
|
|
|
|
"control the level of left and right audio input channels can "
|
|
|
|
"be controlled." );
|
|
|
|
QWhatsThis::add ( TextAudInFader, strAudFader );
|
|
|
|
QWhatsThis::add ( SliderAudInFader, strAudFader );
|
|
|
|
|
|
|
|
QString strAudReverb = tr ( "<b>Reverberation Level:</b> The level of "
|
|
|
|
"reverberation effect can be set with this control. The channel to "
|
|
|
|
"which that reverberation effect shall be applied can be chosen "
|
|
|
|
"with the Reverberation Channel Selection radio buttons." );
|
|
|
|
QWhatsThis::add ( TextLabelAudReverb, strAudReverb );
|
|
|
|
QWhatsThis::add ( SliderAudReverb, strAudReverb );
|
|
|
|
|
|
|
|
QString strRevChanSel = tr ( "<b>Reverberation Channel Selection:</b> "
|
|
|
|
"With these radio buttons the audio input channel on which the "
|
|
|
|
"reverberation effect is applied can be chosen. Either the left "
|
|
|
|
"or right input channel can be selected." );
|
|
|
|
QWhatsThis::add ( TextLabelReverbSelection, strRevChanSel );
|
|
|
|
QWhatsThis::add ( RadioButtonRevSelL, strRevChanSel );
|
|
|
|
QWhatsThis::add ( RadioButtonRevSelR, strRevChanSel );
|
|
|
|
|
2006-12-09 16:00:24 +01:00
|
|
|
QWhatsThis::add ( LEDOverallStatus, tr ( "<b>Overall Status:</b> "
|
2006-11-25 15:46:57 +01:00
|
|
|
"The overall status of the software is shown. If either the "
|
|
|
|
"network or sound interface has bad status, this LED will show "
|
|
|
|
"red color." ) );
|
2006-01-28 12:29:22 +01:00
|
|
|
|
2006-11-25 15:46:57 +01:00
|
|
|
/* init server address line edit */
|
2006-12-06 21:22:41 +01:00
|
|
|
LineEditServerAddr->setText ( pClient->strIPAddress.c_str() );
|
2006-01-28 12:29:22 +01:00
|
|
|
|
2006-11-25 15:46:57 +01:00
|
|
|
/* init status label */
|
2006-12-06 21:22:41 +01:00
|
|
|
OnTimerStatus();
|
2006-01-28 12:29:22 +01:00
|
|
|
|
2006-11-25 15:46:57 +01:00
|
|
|
/* init connection button text */
|
|
|
|
PushButtonConnect->setText ( CON_BUT_CONNECTTEXT );
|
2006-01-28 12:29:22 +01:00
|
|
|
|
2006-11-25 15:46:57 +01:00
|
|
|
/* init input level meter bars */
|
|
|
|
ProgressBarInputLevelL->setTotalSteps ( NUM_STEPS_INP_LEV_METER );
|
|
|
|
ProgressBarInputLevelL->setProgress ( 0 );
|
|
|
|
ProgressBarInputLevelR->setTotalSteps ( NUM_STEPS_INP_LEV_METER );
|
|
|
|
ProgressBarInputLevelR->setProgress ( 0 );
|
2006-01-28 12:29:22 +01:00
|
|
|
|
|
|
|
|
2006-11-25 15:46:57 +01:00
|
|
|
/* init slider controls --- */
|
2006-12-06 21:22:41 +01:00
|
|
|
// audio in fader
|
|
|
|
SliderAudInFader->setRange ( 0, AUD_FADER_IN_MAX );
|
2006-11-25 15:46:57 +01:00
|
|
|
const int iCurAudInFader = pClient->GetAudioInFader();
|
2006-12-06 21:22:41 +01:00
|
|
|
SliderAudInFader->setValue ( iCurAudInFader );
|
|
|
|
SliderAudInFader->setTickInterval ( AUD_FADER_IN_MAX / 9 );
|
2006-01-28 12:29:22 +01:00
|
|
|
|
2006-12-06 21:22:41 +01:00
|
|
|
// audio reverberation
|
|
|
|
SliderAudReverb->setRange ( 0, AUD_REVERB_MAX );
|
2006-11-25 15:46:57 +01:00
|
|
|
const int iCurAudReverb = pClient->GetReverbLevel();
|
|
|
|
SliderAudReverb->setValue ( AUD_REVERB_MAX - iCurAudReverb );
|
2006-12-06 21:22:41 +01:00
|
|
|
SliderAudReverb->setTickInterval ( AUD_REVERB_MAX / 9 );
|
2006-01-28 12:29:22 +01:00
|
|
|
|
|
|
|
|
2006-11-25 15:46:57 +01:00
|
|
|
/* set radio buttons --- */
|
2006-12-06 21:22:41 +01:00
|
|
|
// reverb channel
|
2006-12-09 16:00:24 +01:00
|
|
|
if ( pClient->IsReverbOnLeftChan() )
|
2006-12-07 19:57:26 +01:00
|
|
|
{
|
2006-12-09 16:00:24 +01:00
|
|
|
RadioButtonRevSelL->setChecked ( true );
|
2006-12-07 19:57:26 +01:00
|
|
|
}
|
2006-11-25 15:46:57 +01:00
|
|
|
else
|
2006-12-07 19:57:26 +01:00
|
|
|
{
|
2006-12-09 16:00:24 +01:00
|
|
|
RadioButtonRevSelR->setChecked ( true );
|
2006-12-07 19:57:26 +01:00
|
|
|
}
|
2006-01-28 12:29:22 +01:00
|
|
|
|
2006-12-06 21:22:41 +01:00
|
|
|
|
2006-11-25 15:46:57 +01:00
|
|
|
/* Settings menu ------------------------------------------------------- */
|
|
|
|
pSettingsMenu = new QPopupMenu ( this );
|
|
|
|
CHECK_PTR ( pSettingsMenu );
|
2006-11-03 19:54:12 +01:00
|
|
|
|
2006-11-25 15:46:57 +01:00
|
|
|
pSettingsMenu->insertItem ( tr ( "&General Settings..." ), this,
|
|
|
|
SLOT ( OnOpenGeneralSettings() ) );
|
2006-11-03 19:54:12 +01:00
|
|
|
|
2006-01-28 12:29:22 +01:00
|
|
|
|
2006-11-25 15:46:57 +01:00
|
|
|
/* Main menu bar -------------------------------------------------------- */
|
|
|
|
pMenu = new QMenuBar ( this );
|
|
|
|
CHECK_PTR ( pMenu );
|
2006-11-03 19:54:12 +01:00
|
|
|
|
2006-11-25 15:46:57 +01:00
|
|
|
pMenu->insertItem ( tr ( "&Settings" ), pSettingsMenu );
|
|
|
|
pMenu->insertItem ( tr ( "&?"), new CLlconHelpMenu ( this ) );
|
|
|
|
pMenu->setSeparator ( QMenuBar::InWindowsStyle );
|
2006-01-28 12:29:22 +01:00
|
|
|
|
2006-11-25 15:46:57 +01:00
|
|
|
/* Now tell the layout about the menu */
|
|
|
|
CLlconClientDlgBaseLayout->setMenuBar ( pMenu );
|
2006-12-07 19:57:26 +01:00
|
|
|
|
2006-01-28 12:29:22 +01:00
|
|
|
|
2006-12-09 16:00:24 +01:00
|
|
|
// connections -------------------------------------------------------------
|
2006-12-06 21:22:41 +01:00
|
|
|
// push-buttons
|
2006-01-28 12:29:22 +01:00
|
|
|
QObject::connect(PushButtonConnect, SIGNAL(clicked()),
|
2006-11-25 15:46:57 +01:00
|
|
|
this, SLOT(OnConnectDisconBut()));
|
2006-01-28 12:29:22 +01:00
|
|
|
|
2006-12-06 21:22:41 +01:00
|
|
|
// timers
|
2006-11-25 15:46:57 +01:00
|
|
|
QObject::connect(&TimerSigMet, SIGNAL(timeout()),
|
|
|
|
this, SLOT(OnTimerSigMet()));
|
|
|
|
QObject::connect(&TimerStatus, SIGNAL(timeout()),
|
|
|
|
this, SLOT(OnTimerStatus()));
|
2006-01-28 12:29:22 +01:00
|
|
|
|
2006-12-06 21:22:41 +01:00
|
|
|
// sliders
|
2006-11-25 15:46:57 +01:00
|
|
|
QObject::connect(SliderAudInFader, SIGNAL(valueChanged(int)),
|
|
|
|
this, SLOT(OnSliderAudInFader(int)));
|
|
|
|
QObject::connect(SliderAudReverb, SIGNAL(valueChanged(int)),
|
|
|
|
this, SLOT(OnSliderAudReverb(int)));
|
|
|
|
|
2006-12-06 21:22:41 +01:00
|
|
|
// radio buttons
|
2006-11-25 15:46:57 +01:00
|
|
|
QObject::connect(RadioButtonRevSelL, SIGNAL(clicked()),
|
|
|
|
this, SLOT(OnRevSelL()));
|
|
|
|
QObject::connect(RadioButtonRevSelR, SIGNAL(clicked()),
|
|
|
|
this, SLOT(OnRevSelR()));
|
2006-02-19 15:50:18 +01:00
|
|
|
|
2006-11-26 22:25:56 +01:00
|
|
|
// other
|
2006-12-09 16:00:24 +01:00
|
|
|
QObject::connect ( pClient,
|
|
|
|
SIGNAL ( ConClientListMesReceived ( CVector<CChannelShortInfo> ) ),
|
2006-11-26 22:25:56 +01:00
|
|
|
this, SLOT ( OnConClientListMesReceived ( CVector<CChannelShortInfo> ) ) );
|
2006-12-09 16:00:24 +01:00
|
|
|
QObject::connect ( MainMixerBoard, SIGNAL ( ChangeChanGain ( int, double ) ),
|
|
|
|
this, SLOT ( OnChangeChanGain ( int, double ) ) );
|
2006-11-26 22:25:56 +01:00
|
|
|
|
2006-01-28 12:29:22 +01:00
|
|
|
|
2006-12-09 16:00:24 +01:00
|
|
|
// timers ------------------------------------------------------------------
|
2006-12-06 21:22:41 +01:00
|
|
|
// start timer for status bar
|
2006-11-25 15:46:57 +01:00
|
|
|
TimerStatus.start(STATUSBAR_UPDATE_TIME);
|
2006-01-28 12:29:22 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
CLlconClientDlg::~CLlconClientDlg()
|
|
|
|
{
|
2006-11-25 15:46:57 +01:00
|
|
|
/* if connected, terminate connection */
|
|
|
|
if (pClient->IsRunning())
|
|
|
|
{
|
|
|
|
pClient->Stop();
|
|
|
|
}
|
2006-01-28 12:29:22 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
void CLlconClientDlg::closeEvent ( QCloseEvent * Event )
|
|
|
|
{
|
2006-11-25 15:46:57 +01:00
|
|
|
// store IP address
|
|
|
|
pClient->strIPAddress = LineEditServerAddr->text().latin1();
|
2006-01-28 12:29:22 +01:00
|
|
|
|
2006-11-25 15:46:57 +01:00
|
|
|
// default implementation of this event handler routine
|
|
|
|
Event->accept();
|
2006-01-28 12:29:22 +01:00
|
|
|
}
|
|
|
|
|
2006-12-09 16:00:24 +01:00
|
|
|
void CLlconClientDlg::OnConnectDisconBut()
|
2006-11-27 23:35:22 +01:00
|
|
|
{
|
2006-12-09 16:00:24 +01:00
|
|
|
// start/stop client, set button text
|
|
|
|
if ( pClient->IsRunning() )
|
2006-11-25 15:46:57 +01:00
|
|
|
{
|
2006-12-09 16:00:24 +01:00
|
|
|
pClient->Stop();
|
2006-11-25 15:46:57 +01:00
|
|
|
PushButtonConnect->setText ( CON_BUT_CONNECTTEXT );
|
2006-01-28 12:29:22 +01:00
|
|
|
|
2006-12-09 16:00:24 +01:00
|
|
|
// stop timer for level meter bars and reset them
|
|
|
|
TimerSigMet.stop();
|
2006-11-25 15:46:57 +01:00
|
|
|
ProgressBarInputLevelL->setProgress ( 0 );
|
|
|
|
ProgressBarInputLevelR->setProgress ( 0 );
|
2006-01-28 12:29:22 +01:00
|
|
|
|
2006-12-09 16:00:24 +01:00
|
|
|
// immediately update status bar
|
|
|
|
OnTimerStatus();
|
2006-12-07 19:57:26 +01:00
|
|
|
|
2006-12-09 16:00:24 +01:00
|
|
|
// clear mixer board (remove all faders)
|
|
|
|
MainMixerBoard->Clear();
|
2006-11-25 15:46:57 +01:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2006-12-09 16:00:24 +01:00
|
|
|
// set address and check if address is valid
|
|
|
|
if ( pClient->SetServerAddr ( LineEditServerAddr->text() ) )
|
2006-11-25 15:46:57 +01:00
|
|
|
{
|
2006-10-03 23:16:23 +02:00
|
|
|
#if ( QT_VERSION > 300 )
|
2006-11-25 15:46:57 +01:00
|
|
|
pClient->start ( QThread::TimeCriticalPriority );
|
2006-10-03 23:16:23 +02:00
|
|
|
#else
|
2006-12-09 16:00:24 +01:00
|
|
|
pClient->start();
|
2006-10-03 23:16:23 +02:00
|
|
|
#endif
|
2006-11-25 15:46:57 +01:00
|
|
|
PushButtonConnect->setText ( CON_BUT_DISCONNECTTEXT );
|
2006-01-28 12:29:22 +01:00
|
|
|
|
2006-12-09 16:00:24 +01:00
|
|
|
// start timer for level meter bar
|
2006-11-25 15:46:57 +01:00
|
|
|
TimerSigMet.start ( LEVELMETER_UPDATE_TIME );
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2006-12-09 16:00:24 +01:00
|
|
|
// Restart timer to ensure that the text is visible at
|
|
|
|
// least the time for one complete interval
|
2006-11-25 15:46:57 +01:00
|
|
|
TimerStatus.changeInterval ( STATUSBAR_UPDATE_TIME );
|
2006-01-28 12:29:22 +01:00
|
|
|
|
2006-12-09 16:00:24 +01:00
|
|
|
// show the error in the status bar
|
2006-11-25 15:46:57 +01:00
|
|
|
TextLabelStatus->setText ( tr ( "invalid address" ) );
|
|
|
|
}
|
|
|
|
}
|
2006-01-28 12:29:22 +01:00
|
|
|
}
|
2006-03-12 12:50:35 +01:00
|
|
|
|
2006-11-03 19:54:12 +01:00
|
|
|
void CLlconClientDlg::OnOpenGeneralSettings()
|
2006-03-12 12:50:35 +01:00
|
|
|
{
|
2006-11-25 15:46:57 +01:00
|
|
|
// open general settings dialog
|
|
|
|
ClientSettingsDlg.show();
|
2006-03-12 12:50:35 +01:00
|
|
|
}
|
2006-01-28 12:29:22 +01:00
|
|
|
|
2006-12-09 16:00:24 +01:00
|
|
|
void CLlconClientDlg::OnTimerSigMet()
|
2006-12-06 21:22:41 +01:00
|
|
|
{
|
2006-11-25 15:46:57 +01:00
|
|
|
/* get current input levels */
|
2006-12-09 16:00:24 +01:00
|
|
|
double dCurSigLevelL = pClient->MicLevelL();
|
|
|
|
double dCurSigLevelR = pClient->MicLevelR();
|
2006-01-28 12:29:22 +01:00
|
|
|
|
2006-11-25 15:46:57 +01:00
|
|
|
/* linear transformation of the input level range to the progress-bar
|
|
|
|
range */
|
|
|
|
dCurSigLevelL -= LOW_BOUND_SIG_METER;
|
|
|
|
dCurSigLevelL *= NUM_STEPS_INP_LEV_METER /
|
|
|
|
( UPPER_BOUND_SIG_METER - LOW_BOUND_SIG_METER );
|
|
|
|
|
|
|
|
// lower bound the signal
|
|
|
|
if ( dCurSigLevelL < 0 )
|
|
|
|
{
|
|
|
|
dCurSigLevelL = 0;
|
|
|
|
}
|
2006-02-18 18:03:24 +01:00
|
|
|
|
2006-11-25 15:46:57 +01:00
|
|
|
dCurSigLevelR -= LOW_BOUND_SIG_METER;
|
|
|
|
dCurSigLevelR *= NUM_STEPS_INP_LEV_METER /
|
|
|
|
( UPPER_BOUND_SIG_METER - LOW_BOUND_SIG_METER );
|
|
|
|
|
|
|
|
// lower bound the signal
|
|
|
|
if ( dCurSigLevelR < 0 )
|
|
|
|
{
|
|
|
|
dCurSigLevelR = 0;
|
|
|
|
}
|
2006-01-28 12:29:22 +01:00
|
|
|
|
2006-11-25 15:46:57 +01:00
|
|
|
/* show current level */
|
|
|
|
ProgressBarInputLevelL->setProgress ( (int) ceil ( dCurSigLevelL ) );
|
|
|
|
ProgressBarInputLevelR->setProgress ( (int) ceil ( dCurSigLevelR ) );
|
2006-01-28 12:29:22 +01:00
|
|
|
}
|
2006-03-12 14:19:41 +01:00
|
|
|
|
|
|
|
void CLlconClientDlg::UpdateDisplay()
|
|
|
|
{
|
2006-11-25 15:46:57 +01:00
|
|
|
/* show connection status in status bar */
|
|
|
|
if ( pClient->IsConnected () && pClient->IsRunning () )
|
|
|
|
{
|
|
|
|
TextLabelStatus->setText ( tr ( "connected" ) );
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
TextLabelStatus->setText ( tr ( "disconnected" ) );
|
|
|
|
}
|
2006-01-28 12:29:22 +01:00
|
|
|
}
|
|
|
|
|
2006-11-03 19:54:12 +01:00
|
|
|
void CLlconClientDlg::customEvent ( QCustomEvent* Event )
|
2006-01-28 12:29:22 +01:00
|
|
|
{
|
2006-11-25 15:46:57 +01:00
|
|
|
if ( Event->type() == QEvent::User + 11 )
|
|
|
|
{
|
|
|
|
const int iMessType = ( (CLlconEvent*) Event ) ->iMessType;
|
|
|
|
const int iStatus = ( (CLlconEvent*) Event ) ->iStatus;
|
2006-01-28 12:29:22 +01:00
|
|
|
|
2006-11-25 15:46:57 +01:00
|
|
|
switch ( iMessType )
|
|
|
|
{
|
|
|
|
case MS_SOUND_IN:
|
|
|
|
case MS_SOUND_OUT:
|
|
|
|
case MS_JIT_BUF_PUT:
|
|
|
|
case MS_JIT_BUF_GET:
|
|
|
|
|
|
|
|
// show overall status -> if any LED goes red, this LED will go red
|
2006-12-09 16:00:24 +01:00
|
|
|
LEDOverallStatus->SetLight ( iStatus );
|
2006-11-25 15:46:57 +01:00
|
|
|
break;
|
2006-01-28 12:29:22 +01:00
|
|
|
|
2006-11-25 15:46:57 +01:00
|
|
|
case MS_RESET_ALL:
|
2006-12-09 16:00:24 +01:00
|
|
|
LEDOverallStatus->Reset();
|
2006-11-25 15:46:57 +01:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
// update general settings dialog, too
|
|
|
|
ClientSettingsDlg.SetStatus ( iMessType, iStatus );
|
|
|
|
}
|
2006-01-28 12:29:22 +01:00
|
|
|
}
|