finished #43 Hybrid Mono/Stereo mode

This commit is contained in:
Volker Fischer 2014-02-24 19:51:57 +00:00
parent c8f0a376ab
commit 292cf13a21
8 changed files with 74 additions and 65 deletions

View file

@ -472,7 +472,7 @@ void CClient::SetAudioQuality ( const EAudioQuality eNAudioQuality )
}
}
void CClient::SetUseStereo ( const bool bNUseStereo )
void CClient::SetAudioChannels ( const EAudChanConf eNAudChanConf )
{
// init with new parameter, if client was running then first
// stop it and restart again after new initialization
@ -483,14 +483,7 @@ void CClient::SetUseStereo ( const bool bNUseStereo )
}
// set new parameter
if ( bNUseStereo )
{
eAudioChannelConf = CC_STEREO;
}
else
{
eAudioChannelConf = CC_MONO;
}
eAudioChannelConf = eNAudChanConf;
Init();
if ( bWasRunning )

View file

@ -129,8 +129,8 @@ public:
EAudioQuality GetAudioQuality() const { return eAudioQuality; }
void SetAudioQuality ( const EAudioQuality eNAudioQuality );
bool GetUseStereo() const { return ( eAudioChannelConf == CC_STEREO ); }
void SetUseStereo ( const bool bNUseStereo );
EAudChanConf GetAudioChannels() const { return eAudioChannelConf; }
void SetAudioChannels ( const EAudChanConf eNAudChanConf );
void SetServerListCentralServerAddress ( const QString& sNCentServAddr )
{ strCentralServerAddress = sNCentServAddr; }

View file

@ -511,8 +511,8 @@ CClientDlg::CClientDlg ( CClient* pNCliP,
QObject::connect ( &ClientSettingsDlg, SIGNAL ( GUIDesignChanged() ),
this, SLOT ( OnGUIDesignChanged() ) );
QObject::connect ( &ClientSettingsDlg, SIGNAL ( StereoCheckBoxChanged() ),
this, SLOT ( OnStereoCheckBoxChanged() ) );
QObject::connect ( &ClientSettingsDlg, SIGNAL ( AudioChannelsChanged() ),
this, SLOT ( OnAudioChannelsChanged() ) );
QObject::connect ( MainMixerBoard, SIGNAL ( ChangeChanGain ( int, double ) ),
this, SLOT ( OnChangeChanGain ( int, double ) ) );
@ -611,7 +611,7 @@ void CClientDlg::UpdateAudioFaderSlider()
void CClientDlg::UpdateRevSelection()
{
if ( pClient->GetUseStereo() )
if ( pClient->GetAudioChannels() == CC_STEREO )
{
// for stereo make channel selection invisible since
// reverberation effect is always applied to both channels

View file

@ -189,6 +189,6 @@ public slots:
void OnGUIDesignChanged()
{ SetGUIDesign ( pClient->GetGUIDesign() ); }
void OnStereoCheckBoxChanged() { UpdateRevSelection(); }
void OnAudioChannelsChanged() { UpdateRevSelection(); }
void OnNumClientsChanged ( int iNewNumClients );
};

View file

@ -192,6 +192,28 @@ CClientSettingsDlg::CClientSettingsDlg ( CClient* pNCliP, QWidget* parent,
chbGUIDesignFancy->setAccessibleName ( tr ( "Fancy skin check box" ) );
// audio channels
QString strAudioChannels = tr ( "<b>Audio Channels:</b> "
"Select the number of audio channels to be used. There are three "
"modes available. The mono and stereo modes use one and two "
"audio channels respectively. In the mono-in/stereo-out mode "
"the audio signal which is sent to the server is mono but the "
"return signal is stereo. This is useful for the case that the "
"sound card puts the instrument on one input channel and the "
"microphone on the other channel. In that case the two input signals "
"can be mixed to one mono channel but the server mix can be heard in "
"stereo.<br>"
"Enabling the stereo streaming mode will increase the "
"stream data rate. Make sure that the current upload rate does not "
"exceed the available bandwidth of your internet connection.<br>"
"In case of the stereo streaming mode, no audio channel selection "
"for the reverberation effect will be available on the main window "
"since the effect is applied on both channels in this case." );
lblAudioChannels->setWhatsThis ( strAudioChannels );
cbxAudioChannels->setWhatsThis ( strAudioChannels );
cbxAudioChannels->setAccessibleName ( tr ( "Audio channels combo box" ) );
// audio quality
QString strAudioQuality = tr ( "<b>Audio Quality:</b> "
"Select the desired audio quality. A low, normal or high audio "
@ -204,18 +226,6 @@ CClientSettingsDlg::CClientSettingsDlg ( CClient* pNCliP, QWidget* parent,
cbxAudioQuality->setWhatsThis ( strAudioQuality );
cbxAudioQuality->setAccessibleName ( tr ( "Audio quality combo box" ) );
// use stereo
chbUseStereo->setWhatsThis ( tr ( "<b>Stereo Streaming</b> "
"Enables the stereo streaming mode. If not checked, a mono streaming "
"mode is used. Enabling the stereo streaming mode will increase the "
"stream data rate. Make sure that the current upload rate does not "
"exceed the available bandwidth of your internet connection.<br>"
"In case of the stereo streaming mode, no audio channel selection "
"for the reverberation effect will be available on the main window "
"since the effect is applied on both channels in this case." ) );
chbUseStereo->setAccessibleName ( tr ( "Stereo check box" ) );
// central server address
QString strCentrServAddr = tr ( "<b>Central Server Address:</b> The "
"central server address is the IP address or URL of the central server "
@ -313,6 +323,13 @@ CClientSettingsDlg::CClientSettingsDlg ( CClient* pNCliP, QWidget* parent,
chbGUIDesignFancy->setCheckState ( Qt::Checked );
}
// "Audio Channels" combo box
cbxAudioChannels->clear();
cbxAudioChannels->addItem ( "Mono" ); // CC_MONO
cbxAudioChannels->addItem ( "Mono-in/Stereo-out" ); // CC_MONO_IN_STEREO_OUT
cbxAudioChannels->addItem ( "Stereo" ); // CC_STEREO
cbxAudioChannels->setCurrentIndex ( static_cast<int> ( pClient->GetAudioChannels() ) );
// "Audio Quality" combo box
cbxAudioQuality->clear();
cbxAudioQuality->addItem ( "Low" ); // AQ_LOW
@ -320,16 +337,6 @@ CClientSettingsDlg::CClientSettingsDlg ( CClient* pNCliP, QWidget* parent,
cbxAudioQuality->addItem ( "High" ); // AQ_HIGH
cbxAudioQuality->setCurrentIndex ( static_cast<int> ( pClient->GetAudioQuality() ) );
// "Stereo" check box
if ( pClient->GetUseStereo() )
{
chbUseStereo->setCheckState ( Qt::Checked );
}
else
{
chbUseStereo->setCheckState ( Qt::Unchecked );
}
// update default central server address check box
if ( pClient->GetUseDefaultCentralServerAddress() )
{
@ -379,9 +386,6 @@ CClientSettingsDlg::CClientSettingsDlg ( CClient* pNCliP, QWidget* parent,
QObject::connect ( chbGUIDesignFancy, SIGNAL ( stateChanged ( int ) ),
this, SLOT ( OnGUIDesignFancyStateChanged ( int ) ) );
QObject::connect ( chbUseStereo, SIGNAL ( stateChanged ( int ) ),
this, SLOT ( OnUseStereoStateChanged ( int ) ) );
QObject::connect ( chbAutoJitBuf, SIGNAL ( stateChanged ( int ) ),
this, SLOT ( OnAutoJitBufStateChanged ( int ) ) );
@ -408,6 +412,9 @@ CClientSettingsDlg::CClientSettingsDlg ( CClient* pNCliP, QWidget* parent,
QObject::connect ( cbxROutChan, SIGNAL ( activated ( int ) ),
this, SLOT ( OnROutChanActivated ( int ) ) );
QObject::connect ( cbxAudioChannels, SIGNAL ( activated ( int ) ),
this, SLOT ( OnAudioChannelsActivated ( int ) ) );
QObject::connect ( cbxAudioQuality, SIGNAL ( activated ( int ) ),
this, SLOT ( OnAudioQualityActivated ( int ) ) );
@ -630,6 +637,13 @@ void CClientSettingsDlg::OnROutChanActivated ( int iChanIdx )
UpdateSoundChannelSelectionFrame();
}
void CClientSettingsDlg::OnAudioChannelsActivated ( int iChanIdx )
{
pClient->SetAudioChannels ( static_cast<EAudChanConf> ( iChanIdx ) );
emit AudioChannelsChanged();
UpdateDisplay(); // upload rate will be changed
}
void CClientSettingsDlg::OnAudioQualityActivated ( int iQualityIdx )
{
pClient->SetAudioQuality ( static_cast<EAudioQuality> ( iQualityIdx ) );
@ -662,13 +676,6 @@ void CClientSettingsDlg::OnGUIDesignFancyStateChanged ( int value )
UpdateDisplay();
}
void CClientSettingsDlg::OnUseStereoStateChanged ( int value )
{
pClient->SetUseStereo ( value == Qt::Checked );
emit StereoCheckBoxChanged();
UpdateDisplay(); // upload rate will be changed
}
void CClientSettingsDlg::OnDefaultCentralServerStateChanged ( int value )
{
// apply new setting to the client

View file

@ -91,7 +91,6 @@ protected:
void OnAutoJitBufStateChanged ( int value );
void OnOpenChatOnNewMessageStateChanged ( int value );
void OnGUIDesignFancyStateChanged ( int value );
void OnUseStereoStateChanged ( int value );
void OnDefaultCentralServerStateChanged ( int value );
void OnCentralServerAddressEditingFinished();
void OnSndCrdBufferDelayButtonGroupClicked ( QAbstractButton* button );
@ -100,10 +99,11 @@ protected:
void OnRInChanActivated ( int iChanIdx );
void OnLOutChanActivated ( int iChanIdx );
void OnROutChanActivated ( int iChanIdx );
void OnAudioChannelsActivated ( int iChanIdx );
void OnAudioQualityActivated ( int iQualityIdx );
void OnDriverSetupClicked();
signals:
void GUIDesignChanged();
void StereoCheckBoxChanged();
void AudioChannelsChanged();
};

View file

@ -482,11 +482,18 @@
</widget>
</item>
<item>
<widget class="QCheckBox" name="chbUseStereo">
<property name="text">
<string>Stereo Streaming</string>
</property>
</widget>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<widget class="QLabel" name="lblAudioChannels">
<property name="text">
<string>Audio Channels</string>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="cbxAudioChannels"/>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
@ -683,7 +690,8 @@
<tabstop>sldNetBufServer</tabstop>
<tabstop>chbOpenChatOnNewMessage</tabstop>
<tabstop>chbGUIDesignFancy</tabstop>
<tabstop>chbUseStereo</tabstop>
<tabstop>cbxAudioChannels</tabstop>
<tabstop>cbxAudioQuality</tabstop>
<tabstop>chbDefaultCentralServer</tabstop>
<tabstop>edtCentralServerAddress</tabstop>
</tabstops>

View file

@ -223,6 +223,13 @@ void CSettings::Load()
pClient->SetGUIDesign ( static_cast<EGUIDesign> ( iValue ) );
}
// audio channels
if ( GetNumericIniSet ( IniXMLDocument, "client", "audiochannels",
0, 2 /* CC_STEREO */, iValue ) )
{
pClient->SetAudioChannels ( static_cast<EAudChanConf> ( iValue ) );
}
// audio quality
if ( GetNumericIniSet ( IniXMLDocument, "client", "audioquality",
0, 2 /* AQ_HIGH */, iValue ) )
@ -230,12 +237,6 @@ void CSettings::Load()
pClient->SetAudioQuality ( static_cast<EAudioQuality> ( iValue ) );
}
// flag whether stereo mode is used
if ( GetFlagIniSet ( IniXMLDocument, "client", "stereoaudio", bValue ) )
{
pClient->SetUseStereo ( bValue );
}
// central server address
pClient->SetServerListCentralServerAddress (
GetIniSetting ( IniXMLDocument, "client", "centralservaddr" ) );
@ -432,14 +433,14 @@ void CSettings::Save()
SetNumericIniSet ( IniXMLDocument, "client", "guidesign",
static_cast<int> ( pClient->GetGUIDesign() ) );
// audio channels
SetNumericIniSet ( IniXMLDocument, "client", "audiochannels",
static_cast<int> ( pClient->GetAudioChannels() ) );
// audio quality
SetNumericIniSet ( IniXMLDocument, "client", "audioquality",
static_cast<int> ( pClient->GetAudioQuality() ) );
// flag whether stereo mode is used
SetFlagIniSet ( IniXMLDocument, "client", "stereoaudio",
pClient->GetUseStereo() );
// central server address
PutIniSetting ( IniXMLDocument, "client", "centralservaddr",
pClient->GetServerListCentralServerAddress() );