added text label for audio fader to show the actual attenuation state

This commit is contained in:
Volker Fischer 2009-02-17 12:32:50 +00:00
parent 6299f7ce92
commit 5917ead5e6
5 changed files with 235 additions and 94 deletions

View file

@ -31,7 +31,7 @@ CClient::CClient ( const quint16 iPortNumber ) : bRun ( false ),
iSndCrdStereoBlockSizeSam ( 2 * MIN_SND_CRD_BLOCK_SIZE_SAMPLES ), iSndCrdStereoBlockSizeSam ( 2 * MIN_SND_CRD_BLOCK_SIZE_SAMPLES ),
Sound ( MIN_SND_CRD_BLOCK_SIZE_SAMPLES * 2 /* stereo */ ), Sound ( MIN_SND_CRD_BLOCK_SIZE_SAMPLES * 2 /* stereo */ ),
Socket ( &Channel, iPortNumber ), Socket ( &Channel, iPortNumber ),
iAudioInFader ( AUD_FADER_IN_MAX / 2 ), iAudioInFader ( AUD_FADER_IN_MIDDLE ),
iReverbLevel ( 0 ), iReverbLevel ( 0 ),
bReverbOnLeftChan ( false ), bReverbOnLeftChan ( false ),
iNetwBufSizeFactIn ( DEF_NET_BLOCK_SIZE_FACTOR ), iNetwBufSizeFactIn ( DEF_NET_BLOCK_SIZE_FACTOR ),
@ -298,7 +298,19 @@ void CClient::run()
} }
} }
// mix both signals depending on the fading setting // mix both signals depending on the fading setting, convert
// from double to short
if ( iAudioInFader == AUD_FADER_IN_MIDDLE )
{
// just mix channels together
for ( i = 0, j = 0; i < iMonoBlockSizeSam; i++, j += 2 )
{
vecsNetwork[i] =
Double2Short ( vecdAudioStereo[j] + vecdAudioStereo[j + 1] );
}
}
else
{
const double dAttFact = const double dAttFact =
(double) ( AUD_FADER_IN_MIDDLE - abs ( AUD_FADER_IN_MIDDLE - iAudioInFader ) ) / (double) ( AUD_FADER_IN_MIDDLE - abs ( AUD_FADER_IN_MIDDLE - iAudioInFader ) ) /
AUD_FADER_IN_MIDDLE; AUD_FADER_IN_MIDDLE;
@ -321,6 +333,7 @@ void CClient::run()
Double2Short ( vecdAudioStereo[j + 1] + dAttFact * vecdAudioStereo[j] ); Double2Short ( vecdAudioStereo[j + 1] + dAttFact * vecdAudioStereo[j] );
} }
} }
}
// send it through the network // send it through the network
Socket.SendPacket ( Channel.PrepSendPacket ( vecsNetwork ), Socket.SendPacket ( Channel.PrepSendPacket ( vecsNetwork ),

View file

@ -116,9 +116,8 @@ CLlconClientDlg::CLlconClientDlg ( CClient* pNCliP, QWidget* parent,
// init slider controls --- // init slider controls ---
// audio in fader // audio in fader
SliderAudInFader->setRange ( AUD_FADER_IN_MIN, AUD_FADER_IN_MAX ); SliderAudInFader->setRange ( AUD_FADER_IN_MIN, AUD_FADER_IN_MAX );
const int iCurAudInFader = pClient->GetAudioInFader();
SliderAudInFader->setValue ( iCurAudInFader );
SliderAudInFader->setTickInterval ( AUD_FADER_IN_MAX / 9 ); SliderAudInFader->setTickInterval ( AUD_FADER_IN_MAX / 9 );
UpdateAudioFaderSlider();
// audio reverberation // audio reverberation
SliderAudReverb->setRange ( 0, AUD_REVERB_MAX ); SliderAudReverb->setRange ( 0, AUD_REVERB_MAX );
@ -230,6 +229,41 @@ void CLlconClientDlg::closeEvent ( QCloseEvent * Event )
Event->accept(); Event->accept();
} }
void CLlconClientDlg::UpdateAudioFaderSlider()
{
// update slider and label of audio fader
const int iCurAudInFader = pClient->GetAudioInFader();
SliderAudInFader->setValue ( iCurAudInFader );
// show in label the center position and what channel is
// attenuated
if ( iCurAudInFader == AUD_FADER_IN_MIDDLE )
{
TextLabelAudFader->setText ( "Center" );
}
else
{
if ( iCurAudInFader > AUD_FADER_IN_MIDDLE )
{
// attenuation on right channel
TextLabelAudFader->setText ( "R -" +
QString().setNum ( iCurAudInFader - AUD_FADER_IN_MIDDLE ) );
}
else
{
// attenuation on left channel
TextLabelAudFader->setText ( "L -" +
QString().setNum ( AUD_FADER_IN_MIDDLE - iCurAudInFader ) );
}
}
}
void CLlconClientDlg::OnSliderAudInFader ( int value )
{
pClient->SetAudioInFader ( value );
UpdateAudioFaderSlider();
}
void CLlconClientDlg::OnConnectDisconBut() void CLlconClientDlg::OnConnectDisconBut()
{ {
// start/stop client, set button text // start/stop client, set button text

View file

@ -75,6 +75,7 @@ public:
protected: protected:
void ShowChatWindow(); void ShowChatWindow();
void UpdateAudioFaderSlider();
CClient* pClient; CClient* pClient;
bool bConnected; bool bConnected;
@ -97,7 +98,7 @@ public slots:
void OnTimerStatus() { UpdateDisplay(); } void OnTimerStatus() { UpdateDisplay(); }
void OnOpenGeneralSettings(); void OnOpenGeneralSettings();
void OnOpenChatDialog() { ShowChatWindow(); } void OnOpenChatDialog() { ShowChatWindow(); }
void OnSliderAudInFader ( int value ) { pClient->SetAudioInFader ( value ); } void OnSliderAudInFader ( int value );
void OnSliderAudReverb ( int value ) { pClient->SetReverbLevel ( value ); } void OnSliderAudReverb ( int value ) { pClient->SetReverbLevel ( value ); }
void OnRevSelL() { pClient->SetReverbOnLeftChan ( true ); } void OnRevSelL() { pClient->SetReverbOnLeftChan ( true ); }
void OnRevSelR() { pClient->SetReverbOnLeftChan ( false ); } void OnRevSelR() { pClient->SetReverbOnLeftChan ( false ); }

View file

@ -19,12 +19,6 @@
<bool>true</bool> <bool>true</bool>
</property> </property>
<layout class="QHBoxLayout" > <layout class="QHBoxLayout" >
<property name="margin" >
<number>9</number>
</property>
<property name="spacing" >
<number>6</number>
</property>
<item> <item>
<widget class="QFrame" name="FrameMain" > <widget class="QFrame" name="FrameMain" >
<property name="frameShape" > <property name="frameShape" >
@ -34,18 +28,25 @@
<enum>QFrame::Raised</enum> <enum>QFrame::Raised</enum>
</property> </property>
<layout class="QVBoxLayout" > <layout class="QVBoxLayout" >
<property name="margin" >
<number>9</number>
</property>
<property name="spacing" > <property name="spacing" >
<number>6</number> <number>6</number>
</property> </property>
<property name="leftMargin" >
<number>9</number>
</property>
<property name="topMargin" >
<number>9</number>
</property>
<property name="rightMargin" >
<number>9</number>
</property>
<property name="bottomMargin" >
<number>9</number>
</property>
<item> <item>
<widget class="QLabel" name="PixmapLabelCorrados" > <widget class="QLabel" name="PixmapLabelCorrados" >
<property name="sizePolicy" > <property name="sizePolicy" >
<sizepolicy> <sizepolicy vsizetype="Preferred" hsizetype="Preferred" >
<hsizetype>5</hsizetype>
<vsizetype>5</vsizetype>
<horstretch>0</horstretch> <horstretch>0</horstretch>
<verstretch>0</verstretch> <verstretch>0</verstretch>
</sizepolicy> </sizepolicy>
@ -66,26 +67,42 @@
</item> </item>
<item> <item>
<layout class="QHBoxLayout" > <layout class="QHBoxLayout" >
<property name="margin" >
<number>0</number>
</property>
<property name="spacing" > <property name="spacing" >
<number>6</number> <number>6</number>
</property> </property>
<item> <property name="leftMargin" >
<layout class="QVBoxLayout" >
<property name="margin" >
<number>0</number> <number>0</number>
</property> </property>
<property name="topMargin" >
<number>0</number>
</property>
<property name="rightMargin" >
<number>0</number>
</property>
<property name="bottomMargin" >
<number>0</number>
</property>
<item>
<layout class="QVBoxLayout" >
<property name="spacing" > <property name="spacing" >
<number>0</number> <number>0</number>
</property> </property>
<property name="leftMargin" >
<number>0</number>
</property>
<property name="topMargin" >
<number>0</number>
</property>
<property name="rightMargin" >
<number>0</number>
</property>
<property name="bottomMargin" >
<number>0</number>
</property>
<item> <item>
<widget class="QLabel" name="TextLabelInputLevel" > <widget class="QLabel" name="TextLabelInputLevel" >
<property name="sizePolicy" > <property name="sizePolicy" >
<sizepolicy> <sizepolicy vsizetype="MinimumExpanding" hsizetype="Minimum" >
<hsizetype>1</hsizetype>
<vsizetype>3</vsizetype>
<horstretch>0</horstretch> <horstretch>0</horstretch>
<verstretch>0</verstretch> <verstretch>0</verstretch>
</sizepolicy> </sizepolicy>
@ -101,9 +118,7 @@
<item> <item>
<widget class="QLabel" name="TextLabelInputLevel_2" > <widget class="QLabel" name="TextLabelInputLevel_2" >
<property name="sizePolicy" > <property name="sizePolicy" >
<sizepolicy> <sizepolicy vsizetype="MinimumExpanding" hsizetype="Minimum" >
<hsizetype>1</hsizetype>
<vsizetype>3</vsizetype>
<horstretch>0</horstretch> <horstretch>0</horstretch>
<verstretch>0</verstretch> <verstretch>0</verstretch>
</sizepolicy> </sizepolicy>
@ -120,18 +135,25 @@
</item> </item>
<item> <item>
<layout class="QVBoxLayout" > <layout class="QVBoxLayout" >
<property name="margin" >
<number>0</number>
</property>
<property name="spacing" > <property name="spacing" >
<number>6</number> <number>6</number>
</property> </property>
<property name="leftMargin" >
<number>0</number>
</property>
<property name="topMargin" >
<number>0</number>
</property>
<property name="rightMargin" >
<number>0</number>
</property>
<property name="bottomMargin" >
<number>0</number>
</property>
<item> <item>
<widget class="QProgressBar" name="ProgressBarInputLevelL" > <widget class="QProgressBar" name="ProgressBarInputLevelL" >
<property name="sizePolicy" > <property name="sizePolicy" >
<sizepolicy> <sizepolicy vsizetype="MinimumExpanding" hsizetype="Expanding" >
<hsizetype>7</hsizetype>
<vsizetype>3</vsizetype>
<horstretch>0</horstretch> <horstretch>0</horstretch>
<verstretch>0</verstretch> <verstretch>0</verstretch>
</sizepolicy> </sizepolicy>
@ -147,9 +169,7 @@
<item> <item>
<widget class="QProgressBar" name="ProgressBarInputLevelR" > <widget class="QProgressBar" name="ProgressBarInputLevelR" >
<property name="sizePolicy" > <property name="sizePolicy" >
<sizepolicy> <sizepolicy vsizetype="MinimumExpanding" hsizetype="Expanding" >
<hsizetype>7</hsizetype>
<vsizetype>3</vsizetype>
<horstretch>0</horstretch> <horstretch>0</horstretch>
<verstretch>0</verstretch> <verstretch>0</verstretch>
</sizepolicy> </sizepolicy>
@ -168,12 +188,21 @@
</item> </item>
<item> <item>
<layout class="QHBoxLayout" > <layout class="QHBoxLayout" >
<property name="margin" >
<number>0</number>
</property>
<property name="spacing" > <property name="spacing" >
<number>6</number> <number>6</number>
</property> </property>
<property name="leftMargin" >
<number>0</number>
</property>
<property name="topMargin" >
<number>0</number>
</property>
<property name="rightMargin" >
<number>0</number>
</property>
<property name="bottomMargin" >
<number>0</number>
</property>
<item> <item>
<widget class="QLabel" name="TextLabelServerAddr" > <widget class="QLabel" name="TextLabelServerAddr" >
<property name="text" > <property name="text" >
@ -191,12 +220,21 @@
</item> </item>
<item> <item>
<layout class="QHBoxLayout" > <layout class="QHBoxLayout" >
<property name="margin" >
<number>0</number>
</property>
<property name="spacing" > <property name="spacing" >
<number>6</number> <number>6</number>
</property> </property>
<property name="leftMargin" >
<number>0</number>
</property>
<property name="topMargin" >
<number>0</number>
</property>
<property name="rightMargin" >
<number>0</number>
</property>
<property name="bottomMargin" >
<number>0</number>
</property>
<item> <item>
<widget class="QLabel" name="TextLabelServerTag" > <widget class="QLabel" name="TextLabelServerTag" >
<property name="text" > <property name="text" >
@ -218,12 +256,21 @@
</item> </item>
<item> <item>
<layout class="QHBoxLayout" > <layout class="QHBoxLayout" >
<property name="margin" >
<number>0</number>
</property>
<property name="spacing" > <property name="spacing" >
<number>6</number> <number>6</number>
</property> </property>
<property name="leftMargin" >
<number>0</number>
</property>
<property name="topMargin" >
<number>0</number>
</property>
<property name="rightMargin" >
<number>0</number>
</property>
<property name="bottomMargin" >
<number>0</number>
</property>
<item> <item>
<spacer> <spacer>
<property name="orientation" > <property name="orientation" >
@ -254,18 +301,25 @@
</item> </item>
<item> <item>
<layout class="QHBoxLayout" > <layout class="QHBoxLayout" >
<property name="margin" >
<number>0</number>
</property>
<property name="spacing" > <property name="spacing" >
<number>6</number> <number>6</number>
</property> </property>
<property name="leftMargin" >
<number>0</number>
</property>
<property name="topMargin" >
<number>0</number>
</property>
<property name="rightMargin" >
<number>0</number>
</property>
<property name="bottomMargin" >
<number>0</number>
</property>
<item> <item>
<widget class="QLabel" name="TextLabelStatus" > <widget class="QLabel" name="TextLabelStatus" >
<property name="sizePolicy" > <property name="sizePolicy" >
<sizepolicy> <sizepolicy vsizetype="Minimum" hsizetype="Expanding" >
<hsizetype>7</hsizetype>
<vsizetype>1</vsizetype>
<horstretch>0</horstretch> <horstretch>0</horstretch>
<verstretch>0</verstretch> <verstretch>0</verstretch>
</sizepolicy> </sizepolicy>
@ -287,9 +341,7 @@
<item> <item>
<widget class="CMultiColorLED" native="1" name="LEDOverallStatus" > <widget class="CMultiColorLED" native="1" name="LEDOverallStatus" >
<property name="sizePolicy" > <property name="sizePolicy" >
<sizepolicy> <sizepolicy vsizetype="Fixed" hsizetype="Fixed" >
<hsizetype>0</hsizetype>
<vsizetype>0</vsizetype>
<horstretch>0</horstretch> <horstretch>0</horstretch>
<verstretch>0</verstretch> <verstretch>0</verstretch>
</sizepolicy> </sizepolicy>
@ -319,20 +371,38 @@
<string>Reverb</string> <string>Reverb</string>
</property> </property>
<layout class="QVBoxLayout" > <layout class="QVBoxLayout" >
<property name="margin" >
<number>9</number>
</property>
<property name="spacing" > <property name="spacing" >
<number>6</number> <number>6</number>
</property> </property>
<property name="leftMargin" >
<number>9</number>
</property>
<property name="topMargin" >
<number>9</number>
</property>
<property name="rightMargin" >
<number>9</number>
</property>
<property name="bottomMargin" >
<number>9</number>
</property>
<item> <item>
<layout class="QVBoxLayout" > <layout class="QVBoxLayout" >
<property name="margin" >
<number>0</number>
</property>
<property name="spacing" > <property name="spacing" >
<number>6</number> <number>6</number>
</property> </property>
<property name="leftMargin" >
<number>0</number>
</property>
<property name="topMargin" >
<number>0</number>
</property>
<property name="rightMargin" >
<number>0</number>
</property>
<property name="bottomMargin" >
<number>0</number>
</property>
<item> <item>
<widget class="QLabel" name="TextLabelAudReverb" > <widget class="QLabel" name="TextLabelAudReverb" >
<property name="text" > <property name="text" >
@ -348,12 +418,21 @@
</item> </item>
<item> <item>
<layout class="QHBoxLayout" > <layout class="QHBoxLayout" >
<property name="margin" >
<number>0</number>
</property>
<property name="spacing" > <property name="spacing" >
<number>6</number> <number>6</number>
</property> </property>
<property name="leftMargin" >
<number>0</number>
</property>
<property name="topMargin" >
<number>0</number>
</property>
<property name="rightMargin" >
<number>0</number>
</property>
<property name="bottomMargin" >
<number>0</number>
</property>
<item> <item>
<spacer> <spacer>
<property name="orientation" > <property name="orientation" >
@ -439,28 +518,44 @@
<string>Audio Mixer</string> <string>Audio Mixer</string>
</property> </property>
<layout class="QHBoxLayout" > <layout class="QHBoxLayout" >
<property name="margin" >
<number>9</number>
</property>
<property name="spacing" >
<number>6</number>
</property>
<item> <item>
<layout class="QVBoxLayout" > <layout class="QVBoxLayout" >
<property name="margin" > <item>
<number>0</number> <widget class="QLabel" name="TextLabelAudFader" >
<property name="minimumSize" >
<size>
<width>50</width>
<height>0</height>
</size>
</property> </property>
<property name="spacing" > <property name="text" >
<number>6</number> <string>Level</string>
</property> </property>
<property name="alignment" >
<set>Qt::AlignCenter</set>
</property>
<property name="wordWrap" >
<bool>false</bool>
</property>
</widget>
</item>
<item> <item>
<layout class="QHBoxLayout" > <layout class="QHBoxLayout" >
<property name="margin" >
<number>0</number>
</property>
<property name="spacing" > <property name="spacing" >
<number>6</number> <number>6</number>
</property> </property>
<property name="leftMargin" >
<number>0</number>
</property>
<property name="topMargin" >
<number>0</number>
</property>
<property name="rightMargin" >
<number>0</number>
</property>
<property name="bottomMargin" >
<number>0</number>
</property>
<item> <item>
<spacer> <spacer>
<property name="orientation" > <property name="orientation" >
@ -527,9 +622,7 @@ Fader</string>
<item> <item>
<widget class="CAudioMixerBoard" native="1" name="MainMixerBoard" > <widget class="CAudioMixerBoard" native="1" name="MainMixerBoard" >
<property name="sizePolicy" > <property name="sizePolicy" >
<sizepolicy> <sizepolicy vsizetype="Preferred" hsizetype="Expanding" >
<hsizetype>7</hsizetype>
<vsizetype>5</vsizetype>
<horstretch>0</horstretch> <horstretch>0</horstretch>
<verstretch>0</verstretch> <verstretch>0</verstretch>
</sizepolicy> </sizepolicy>

View file

@ -61,7 +61,7 @@ void CSettings::ReadIniFile ( const QString& sFileName )
pClient->strName = GetIniSetting ( IniXMLDocument, "client", "name" ); pClient->strName = GetIniSetting ( IniXMLDocument, "client", "name" );
// audio fader // audio fader
if ( GetNumericIniSet ( IniXMLDocument, "client", "audfad", 0, AUD_FADER_IN_MAX, iValue ) ) if ( GetNumericIniSet ( IniXMLDocument, "client", "audfad", AUD_FADER_IN_MIN, AUD_FADER_IN_MAX, iValue ) )
{ {
pClient->SetAudioInFader ( iValue ); pClient->SetAudioInFader ( iValue );
} }