diff --git a/COMPILING.md b/COMPILING.md index b82dcab9cf..7230cbabf8 100644 --- a/COMPILING.md +++ b/COMPILING.md @@ -208,6 +208,7 @@ During compile time some CONFIG arguments can be given to enable or disable spec | `serveronly` | Only support running as Server | | `headless` | Disable GUI. Supports Client and Server. Usually used with serveronly | | `nojsonrpc` | Disable JSON-RPC support | +| `nointernaleffects` | Build the Client without the built-in input effects (boost, compressor, reverb); the effects chain stays empty | | `jackonwindows` | Use JACK instead of ASIO on Windows | | `jackonmac` | Use JACK instead of CoreAudio on macOS (untested) | | `server_bundle` | macOS only: Create an application bundle which starts server by default | diff --git a/Jamulus.pro b/Jamulus.pro index 1fcef0fdf3..225b2d50c0 100644 --- a/Jamulus.pro +++ b/Jamulus.pro @@ -50,6 +50,11 @@ contains(CONFIG, "headless") { QT += multimedia } +contains(CONFIG, "nointernaleffects") { + message(Building without the internal input effects due to CONFIG+=nointernaleffects.) + DEFINES += NO_INTERNAL_EFFECTS +} + # Do not set LRELEASE_DIR explicitly when using embed_translations. # It doesn't work with multiple targets or architectures. TRANSLATIONS = src/translation/translation_ja_JP.ts \ @@ -400,11 +405,12 @@ FORMS_GUI = src/aboutdlgbase.ui \ FORMS_GUI += src/clientdlgbase.ui \ src/clientsettingsdlgbase.ui \ src/chatdlgbase.ui \ - src/connectdlgbase.ui + src/connectdlgbase.ui \ + src/inputeffectlanebase.ui \ + src/inputeffectsdlgbase.ui } -HEADERS += src/plugins/audioreverb.h \ - src/buffer.h \ +HEADERS += src/buffer.h \ src/channel.h \ src/global.h \ src/protocol.h \ @@ -423,6 +429,11 @@ HEADERS += src/plugins/audioreverb.h \ !contains(CONFIG, "serveronly") { HEADERS += src/client.h \ + src/plugins/inputeffect.h \ + src/plugins/inputeffectchain.h \ + src/plugins/inputboost.h \ + src/plugins/audiocompressor.h \ + src/plugins/audioreverb.h \ src/sound/soundbase.h \ src/testbench.h } @@ -435,6 +446,8 @@ HEADERS_GUI = src/serverdlg.h src/clientsettingsdlg.h \ src/connectdlg.h \ src/clientdlg.h \ + src/inputeffectlane.h \ + src/inputeffectsdlg.h \ src/levelmeter.h \ src/analyzerconsole.h \ src/multicolorled.h @@ -511,8 +524,7 @@ HEADERS_OPUS_X86 = libs/opus/celt/x86/celt_lpc_sse.h \ libs/opus/celt/x86/x86cpu.h \ $$files(libs/opus/silk/x86/*.h) -SOURCES += src/plugins/audioreverb.cpp \ - src/buffer.cpp \ +SOURCES += src/buffer.cpp \ src/channel.cpp \ src/main.cpp \ src/protocol.cpp \ @@ -530,7 +542,16 @@ SOURCES += src/plugins/audioreverb.cpp \ !contains(CONFIG, "serveronly") { SOURCES += src/client.cpp \ - src/sound/soundbase.cpp \ + src/plugins/inputeffectchain.cpp \ + src/sound/soundbase.cpp + + # the internal input effects can be left out (e.g. for a build with a + # plugin host instead) + !contains(CONFIG, "nointernaleffects") { + SOURCES += src/plugins/inputboost.cpp \ + src/plugins/audiocompressor.cpp \ + src/plugins/audioreverb.cpp + } } SOURCES_GUI = src/serverdlg.cpp @@ -541,6 +562,8 @@ SOURCES_GUI = src/serverdlg.cpp src/clientsettingsdlg.cpp \ src/connectdlg.cpp \ src/clientdlg.cpp \ + src/inputeffectlane.cpp \ + src/inputeffectsdlg.cpp \ src/multicolorled.cpp \ src/levelmeter.cpp \ src/analyzerconsole.cpp diff --git a/src/client.cpp b/src/client.cpp index 9b5e502bee..c098e6895b 100644 --- a/src/client.cpp +++ b/src/client.cpp @@ -76,9 +76,7 @@ CClient::CClient ( const quint16 iPortNumber, Socket ( &Channel, iPortNumber, iQosNumber, "", "", bNDisableIPv6, bIPv6Available ), Sound ( AudioCallback, this, bNoAutoJackConnect, strNClientName ), iAudioInFader ( AUD_FADER_IN_MIDDLE ), - bReverbOnLeftChan ( false ), - iReverbLevel ( 0 ), - iInputBoost ( 1 ), + bLocalPreview ( false ), iSndCrdPrefFrameSizeFactor ( FRAME_SIZE_FACTOR_DEFAULT ), iSndCrdFrameSizeFactor ( FRAME_SIZE_FACTOR_DEFAULT ), bSndCrdConversionBufferRequired ( false ), @@ -918,6 +916,13 @@ void CClient::OnSndCrdReinitRequest ( int iSndCrdResetType ) strError = generr.GetErrorText(); } + // a local preview does not survive a failed sound card restart + if ( bLocalPreview && !Sound.IsRunning() ) + { + bLocalPreview = false; + emit LocalPreviewChanged ( false ); + } + // inform GUI about the sound card device change emit SoundDeviceChanged ( strError ); } @@ -1056,8 +1061,50 @@ void CClient::OnRawAudioSupported() } } +void CClient::SetLocalPreview ( const bool bOn ) +{ + // the preview uses the sound card, therefore it is only possible while + // not connected + if ( ( bOn == bLocalPreview ) || ( bOn && ( GetConnectionState() != CS_DISCONNECTED ) ) ) + { + return; + } + + if ( bOn ) + { + Init(); // may throw CGenErr + bLocalPreview = true; + + try + { + Sound.Start(); + } + catch ( const CGenErr& ) + { + bLocalPreview = false; + throw; + } + } + else + { + Sound.Stop(); + bLocalPreview = false; + } + + SignalLevelMeter.Reset(); + SignalLevelMeterRaw.Reset(); + + emit LocalPreviewChanged ( bLocalPreview ); +} + void CClient::Start() { + // a running local preview must end before connecting + if ( bLocalPreview ) + { + SetLocalPreview ( false ); + } + // init object Init(); @@ -1089,6 +1136,13 @@ void CClient::Start() /// Use to set CClientDlg to show not being connected void CClient::Stop() { + // the local preview ends together with the sound card + if ( bLocalPreview ) + { + bLocalPreview = false; + emit LocalPreviewChanged ( false ); + } + // stop audio interface Sound.Stop(); @@ -1132,6 +1186,7 @@ void CClient::Stop() // reset current signal level and LEDs bJitterBufferOK = true; SignalLevelMeter.Reset(); + SignalLevelMeterRaw.Reset(); #if defined( Q_OS_WINDOWS ) // Allow hibernation or display dimming if the app is running again (Windows) @@ -1461,8 +1516,8 @@ void CClient::Init() // set the channel network properties Channel.SetAudioStreamProperties ( eAudioCompressionType, iCeltNumCodedBytes, iSndCrdFrameSizeFactor, iNumAudioChannels ); - // init reverberation - AudioReverb.Init ( eAudioChannelConf, iStereoBlockSizeSam, SYSTEM_SAMPLE_RATE_HZ ); + // init the local input effects + InputEffects.Init ( eAudioChannelConf, iMonoBlockSizeSam ); // init the sound card conversion buffers if ( bSndCrdConversionBufferRequired ) @@ -1541,27 +1596,19 @@ void CClient::ProcessAudioDataIntern ( CVector& vecsStereoSndCrd ) // Transmit signal --------------------------------------------------------- - if ( iInputBoost != 1 ) - { - // apply a general gain boost to all audio input: - for ( i = 0, j = 0; i < iMonoBlockSizeSam; i++, j += 2 ) - { - vecsStereoSndCrd[j + 1] = Float2Short ( iInputBoost * vecsStereoSndCrd[j + 1] ); - vecsStereoSndCrd[j] = Float2Short ( iInputBoost * vecsStereoSndCrd[j] ); - } - } + // update the signal level meters before and after the local input + // effects (not needed in headless mode) +#ifndef HEADLESS + SignalLevelMeterRaw.Update ( vecsStereoSndCrd, iMonoBlockSizeSam, true ); +#endif + + // apply the local input effects (boost, compressor, reverberation) + InputEffects.Process ( vecsStereoSndCrd ); - // update stereo signal level meter (not needed in headless mode) #ifndef HEADLESS SignalLevelMeter.Update ( vecsStereoSndCrd, iMonoBlockSizeSam, true ); #endif - // add reverberation effect if activated - if ( iReverbLevel != 0 ) - { - AudioReverb.Process ( vecsStereoSndCrd, bReverbOnLeftChan, static_cast ( iReverbLevel ) / AUD_REVERB_MAX / 4 ); - } - // apply pan (audio fader) and mix mono signals if ( !( ( iAudioInFader == AUD_FADER_IN_MIDDLE ) && ( eAudioChannelConf == CC_STEREO ) ) ) { @@ -1612,6 +1659,23 @@ void CClient::ProcessAudioDataIntern ( CVector& vecsStereoSndCrd ) } } + // local preview (not connected): nothing is sent or received, instead the + // processed signal which would be sent is played to the sound card outputs + if ( bLocalPreview ) + { + if ( eAudioChannelConf == CC_MONO ) + { + // copy mono data in stereo sound card buffer (start from the end + // not to overwrite input values) + for ( i = iMonoBlockSizeSam - 1, j = iStereoBlockSizeSam - 2; i >= 0; i--, j -= 2 ) + { + vecsStereoSndCrd[j] = vecsStereoSndCrd[j + 1] = vecsStereoSndCrd[i]; + } + } + + return; + } + for ( i = 0, j = 0; i < iSndCrdFrameSizeFactor; i++, j += iNumAudioChannels * iOPUSFrameSizeSamples ) { // OPUS encoding or copying RAW audio? diff --git a/src/client.h b/src/client.h index 1c4c4e5428..8a0caa5602 100644 --- a/src/client.h +++ b/src/client.h @@ -61,7 +61,7 @@ #include "socket.h" #include "channel.h" #include "util.h" -#include "plugins/audioreverb.h" +#include "plugins/inputeffectchain.h" #include "buffer.h" #include "signalhandler.h" @@ -105,9 +105,6 @@ enum EConnectionState #define AUD_FADER_IN_MAX 100 #define AUD_FADER_IN_MIDDLE ( AUD_FADER_IN_MAX / 2 ) -// audio reverberation range -#define AUD_REVERB_MAX 100 - // default delay period between successive gain updates (ms) // this will be increased to double the ping time if connected to a distant server #define DEFAULT_GAIN_DELAY_PERIOD_MS 50 @@ -185,9 +182,19 @@ class CClient : public QObject // IPv6 Available bool IsIPv6Available() { return bIPv6Available; } + // signal level after the input effects (what is sent to the server) double GetLevelForMeterdBLeft() { return SignalLevelMeter.GetLevelForMeterdBLeftOrMono(); } double GetLevelForMeterdBRight() { return SignalLevelMeter.GetLevelForMeterdBRight(); } + // signal level as it comes from the sound card + double GetLevelForMeterdBRawLeft() { return SignalLevelMeterRaw.GetLevelForMeterdBLeftOrMono(); } + double GetLevelForMeterdBRawRight() { return SignalLevelMeterRaw.GetLevelForMeterdBRight(); } + + // local preview: while not connected, run the sound card and play the + // processed input signal to the outputs instead of sending it + bool IsLocalPreviewActive() const { return bLocalPreview; } + void SetLocalPreview ( const bool bOn ); + bool GetAndResetbJitterBufferOKFlag(); bool IsConnected() { return Channel.IsConnected(); } @@ -207,15 +214,7 @@ class CClient : public QObject int GetAudioInFader() const { return iAudioInFader; } void SetAudioInFader ( const int iNV ) { iAudioInFader = iNV; } - int GetReverbLevel() const { return iReverbLevel; } - void SetReverbLevel ( const int iNL ) { iReverbLevel = iNL; } - - bool IsReverbOnLeftChan() const { return bReverbOnLeftChan; } - void SetReverbOnLeftChan ( const bool bIL ) - { - bReverbOnLeftChan = bIL; - AudioReverb.Clear(); - } + CInputEffectChain& GetInputEffects() { return InputEffects; } void SetDoAutoSockBufSize ( const bool bValue ); bool GetDoAutoSockBufSize() const { return Channel.GetDoAutoSockBufSize(); } @@ -306,8 +305,6 @@ class CClient : public QObject void SetControllerInFaderLevel ( int iChannelIdx, int iValue ) { OnControllerInFaderLevel ( iChannelIdx, iValue ); } - void SetInputBoost ( const int iNewBoost ) { iInputBoost = iNewBoost; } - void SetRemoteInfo() { Channel.SetRemoteInfo ( ChannelInfo ); } void CreateChatTextMes ( const QString& strChatText ) { Channel.CreateChatTextMes ( strChatText ); } @@ -428,14 +425,13 @@ class CClient : public QObject CSound Sound; CStereoSignalLevelMeter SignalLevelMeter; + CStereoSignalLevelMeter SignalLevelMeterRaw; CVector vecbyNetwData; std::atomic iAudioInFader; - std::atomic bReverbOnLeftChan; - std::atomic iReverbLevel; - CAudioReverb AudioReverb; - std::atomic iInputBoost; + CInputEffectChain InputEffects; + std::atomic bLocalPreview; int iSndCrdPrefFrameSizeFactor; int iSndCrdFrameSizeFactor; @@ -543,6 +539,7 @@ protected slots: void Disconnected(); void SoundDeviceChanged ( QString strError ); + void LocalPreviewChanged ( bool bActive ); void ControllerInFaderLevel ( int iChannelIdx, int iValue ); void ControllerInPanValue ( int iChannelIdx, int iValue ); void ControllerInFaderIsSolo ( int iChannelIdx, bool bIsSolo ); diff --git a/src/clientdlg.cpp b/src/clientdlg.cpp index 2c7c35f02c..390f929a23 100644 --- a/src/clientdlg.cpp +++ b/src/clientdlg.cpp @@ -63,6 +63,7 @@ CClientDlg::CClientDlg ( CClient* pNCliP, eLastDesign ( GD_DEFAULT ), // " ClientSettingsDlg ( pNCliP, pNSetP, parent ), ChatDlg ( parent ), + InputEffectsDlg ( pNCliP, pNSetP, parent ), ConnectDlg ( pNCliP, pNSetP, bNewShowComplRegConnList, parent ), AnalyzerConsole ( pNCliP, parent ) { @@ -117,31 +118,13 @@ CClientDlg::CClientDlg ( CClient* pNCliP, butConnect->setAccessibleName ( tr ( "Connect and disconnect toggle button" ) ); - // reverberation level - QString strAudReverb = "" + tr ( "Reverb effect" ) + ": " + - tr ( "Reverb can be applied to one local mono audio channel or to both " - "channels in stereo mode. The mono channel selection and the " - "reverb level can be modified. For example, if " - "a microphone signal is fed in to the right audio channel of the " - "sound card and a reverb effect needs to be applied, set the " - "channel selector to right and move the fader upwards until the " - "desired reverb level is reached." ); + // input effects button + chbInputFx->setWhatsThis ( "" + tr ( "Input FX" ) + ": " + + tr ( "Opens the Input Effects window where boost, compressor, reverb and " + "input balance of your local input channels can be set up." ) ); - lblAudioReverb->setWhatsThis ( strAudReverb ); - sldAudioReverb->setWhatsThis ( strAudReverb ); - - sldAudioReverb->setAccessibleName ( tr ( "Reverb effect level setting" ) ); - - // reverberation channel selection - QString strRevChanSel = "" + tr ( "Reverb Channel Selection" ) + ": " + - tr ( "With these radio buttons the audio input channel on which the " - "reverb effect is applied can be chosen. Either the left " - "or right input channel can be selected." ); - - rbtReverbSelL->setWhatsThis ( strRevChanSel ); - rbtReverbSelL->setAccessibleName ( tr ( "Left channel selection for reverb" ) ); - rbtReverbSelR->setWhatsThis ( strRevChanSel ); - rbtReverbSelR->setAccessibleName ( tr ( "Right channel selection for reverb" ) ); + chbInputFx->setAccessibleName ( tr ( "Input effects window toggle button" ) ); + chbInputFx->setToolTip ( "

" + tr ( "Boost, compressor, reverb and balance of your input." ) + "

" ); // delay LED QString strLEDDelay = "" + tr ( "Delay Status LED" ) + ": " + tr ( "Shows the current audio delay status:" ) + @@ -257,17 +240,8 @@ CClientDlg::CClientDlg ( CClient* pNCliP, ledBuffers->Reset(); ledDelay->Reset(); - // init audio reverberation - sldAudioReverb->setRange ( 0, AUD_REVERB_MAX ); - const int iCurAudReverb = pClient->GetReverbLevel(); - sldAudioReverb->setValue ( iCurAudReverb ); - sldAudioReverb->setTickInterval ( AUD_REVERB_MAX / 5 ); - - // init input boost - pClient->SetInputBoost ( pSettings->iInputBoost ); - - // init reverb channel - UpdateRevSelection(); + // init channel dependent controls + UpdateAudioChannelsDisplay(); // init connect dialog ConnectDlg.SetShowAllMusicians ( pSettings->bConnectDlgShowAllMusicians ); @@ -392,6 +366,8 @@ CClientDlg::CClientDlg ( CClient* pNCliP, pViewMenu->addSeparator(); + pViewMenu->addAction ( tr ( "Input &Effects..." ), this, SLOT ( OnOpenInputEffectsDialog() ) ); + pViewMenu->addAction ( tr ( "C&hat..." ), this, SLOT ( OnOpenChatDialog() ), QKeySequence ( Qt::CTRL + Qt::Key_H ) ); // optionally show analyzer console entry @@ -458,6 +434,17 @@ CClientDlg::CClientDlg ( CClient* pNCliP, ShowChatWindow(); } + // input effects window + if ( !pSettings->vecWindowPosInputFx.isEmpty() && !pSettings->vecWindowPosInputFx.isNull() ) + { + InputEffectsDlg.restoreGeometry ( pSettings->vecWindowPosInputFx ); + } + + if ( pSettings->bWindowWasShownInputFx ) + { + ShowInputEffects(); + } + // connection setup window if ( !pSettings->vecWindowPosConnect.isEmpty() && !pSettings->vecWindowPosConnect.isNull() ) { @@ -473,6 +460,8 @@ CClientDlg::CClientDlg ( CClient* pNCliP, QObject::connect ( chbChat, &QCheckBox::stateChanged, this, &CClientDlg::OnChatStateChanged ); + QObject::connect ( chbInputFx, &QCheckBox::stateChanged, this, &CClientDlg::OnInputFxStateChanged ); + QObject::connect ( chbLocalMute, &QCheckBox::stateChanged, this, &CClientDlg::OnLocalMuteStateChanged ); // timers @@ -488,13 +477,6 @@ CClientDlg::CClientDlg ( CClient* pNCliP, QObject::connect ( &TimerDetectFeedback, &QTimer::timeout, this, &CClientDlg::OnTimerDetectFeedback ); - QObject::connect ( sldAudioReverb, &QSlider::valueChanged, this, &CClientDlg::OnAudioReverbValueChanged ); - - // radio buttons - QObject::connect ( rbtReverbSelL, &QRadioButton::clicked, this, &CClientDlg::OnReverbSelLClicked ); - - QObject::connect ( rbtReverbSelR, &QRadioButton::clicked, this, &CClientDlg::OnReverbSelRClicked ); - // other QObject::connect ( pClient, &CClient::ConClientListMesReceived, this, &CClientDlg::OnConClientListMesReceived ); @@ -546,6 +528,8 @@ CClientDlg::CClientDlg ( CClient* pNCliP, QObject::connect ( pClient, &CClient::SoundDeviceChanged, this, &CClientDlg::OnSoundDeviceChanged ); + QObject::connect ( pClient, &CClient::LocalPreviewChanged, this, &CClientDlg::OnLocalPreviewChanged ); + QObject::connect ( &ClientSettingsDlg, &CClientSettingsDlg::GUIDesignChanged, this, &CClientDlg::OnGUIDesignChanged ); QObject::connect ( &ClientSettingsDlg, &CClientSettingsDlg::MeterStyleChanged, this, &CClientDlg::OnMeterStyleChanged ); @@ -630,14 +614,17 @@ void CClientDlg::closeEvent ( QCloseEvent* Event ) pSettings->vecWindowPosSettings = ClientSettingsDlg.saveGeometry(); pSettings->vecWindowPosChat = ChatDlg.saveGeometry(); pSettings->vecWindowPosConnect = ConnectDlg.saveGeometry(); + pSettings->vecWindowPosInputFx = InputEffectsDlg.saveGeometry(); pSettings->bWindowWasShownSettings = ClientSettingsDlg.isVisible(); pSettings->bWindowWasShownChat = ChatDlg.isVisible(); pSettings->bWindowWasShownConnect = ConnectDlg.isVisible(); + pSettings->bWindowWasShownInputFx = InputEffectsDlg.isVisible(); // if settings/connect dialog or chat dialog is open, close it ClientSettingsDlg.close(); ChatDlg.close(); + InputEffectsDlg.close(); ConnectDlg.close(); AnalyzerConsole.close(); @@ -683,34 +670,13 @@ void CClientDlg::ManageDragNDrop ( QDropEvent* Event, const bool bCheckAccept ) } } -void CClientDlg::UpdateRevSelection() +void CClientDlg::UpdateAudioChannelsDisplay() { - if ( pClient->GetAudioChannels() == CC_STEREO ) - { - // for stereo make channel selection invisible since - // reverberation effect is always applied to both channels - rbtReverbSelL->setVisible ( false ); - rbtReverbSelR->setVisible ( false ); - } - else - { - // make radio buttons visible - rbtReverbSelL->setVisible ( true ); - rbtReverbSelR->setVisible ( true ); - - // update value - if ( pClient->IsReverbOnLeftChan() ) - { - rbtReverbSelL->setChecked ( true ); - } - else - { - rbtReverbSelR->setChecked ( true ); - } - } - // update visibility of the pan controls in the audio mixer board (pan is not supported for mono) MainMixerBoard->SetDisplayPans ( pClient->GetAudioChannels() != CC_MONO ); + + // the input effects window shows one or two input channels + InputEffectsDlg.UpdateChannelLayout(); } void CClientDlg::OnConnectDlgAccepted() @@ -770,14 +736,16 @@ void CClientDlg::OnConnectDlgAccepted() void CClientDlg::OnConnectDisconBut() { - // the connect/disconnect button implements a toggle functionality - if ( pClient->IsRunning() ) + // the connect/disconnect button implements a toggle functionality (note + // that the sound card may also be running for the local preview, so the + // connection state is checked and not the sound card state) + if ( pClient->GetConnectionState() != CS_DISCONNECTED ) { pClient->Disconnect(); } else { - // If the client isn't running, we assume that we weren't connected. Thus show the connect dialog + // not connected, thus show the connect dialog // TODO: Refactor to have robust error handling ShowConnectionSetupDialog(); } @@ -1029,6 +997,18 @@ void CClientDlg::ShowChatWindow ( const bool bForceRaise ) UpdateDisplay(); } +void CClientDlg::ShowInputEffects() +{ + InputEffectsDlg.show(); + InputEffectsDlg.setWindowTitle ( MakeClientNameTitle ( tr ( "Input Effects" ), pClient->strClientName ) ); + + // make sure dialog is upfront and has focus + InputEffectsDlg.raise(); + InputEffectsDlg.activateWindow(); + + UpdateDisplay(); +} + void CClientDlg::ShowAnalyzerConsole() { // open analyzer console dialog @@ -1063,6 +1043,46 @@ void CClientDlg::OnChatStateChanged ( int value ) } } +void CClientDlg::OnInputFxStateChanged ( int value ) +{ + if ( value == Qt::Checked ) + { + ShowInputEffects(); + } + else + { + InputEffectsDlg.hide(); + } +} + +void CClientDlg::OnLocalPreviewChanged ( bool bActive ) +{ + // the level meters and the feedback detection also run during the local + // preview (the preview plays the own input signal to the speakers) + if ( bActive ) + { + lbrInputLevelL->setEnabled ( true ); + lbrInputLevelR->setEnabled ( true ); + TimerSigMet.start ( LEVELMETER_UPDATE_TIME_MS ); + + if ( pSettings->bEnableFeedbackDetection ) + { + TimerDetectFeedback.start ( DETECT_FEEDBACK_TIME_MS ); // single shot timer + bDetectFeedback = true; + } + } + else if ( !pClient->IsRunning() ) + { + TimerSigMet.stop(); + lbrInputLevelL->setEnabled ( false ); + lbrInputLevelR->setEnabled ( false ); + lbrInputLevelL->SetValue ( 0 ); + lbrInputLevelR->SetValue ( 0 ); + TimerDetectFeedback.stop(); + bDetectFeedback = false; + } +} + void CClientDlg::OnLocalMuteStateChanged ( int value ) { pClient->SetMuteOutStream ( value == Qt::Checked ); @@ -1084,20 +1104,54 @@ void CClientDlg::OnTimerSigMet() lbrInputLevelL->SetValue ( pClient->GetLevelForMeterdBLeft() ); lbrInputLevelR->SetValue ( pClient->GetLevelForMeterdBRight() ); + // the input effects window has its own level meters + if ( InputEffectsDlg.isVisible() ) + { + InputEffectsDlg.UpdateMeters(); + } + if ( bDetectFeedback && ( pClient->GetLevelForMeterdBLeft() > NUM_STEPS_LED_BAR - 0.5 || pClient->GetLevelForMeterdBRight() > NUM_STEPS_LED_BAR - 0.5 ) ) { - // mute locally and mute channel - chbLocalMute->setCheckState ( Qt::Checked ); - MainMixerBoard->MuteMyChannel(); + const bool bWasPreview = pClient->IsLocalPreviewActive(); + + if ( bWasPreview ) + { + // the local preview is the signal path which causes the feedback + try + { + pClient->SetLocalPreview ( false ); + } + catch ( const CGenErr& ) + { + // the sound card could not be stopped, nothing more to do here + } + } + else + { + // mute locally and mute channel + chbLocalMute->setCheckState ( Qt::Checked ); + MainMixerBoard->MuteMyChannel(); + } // show message box about feedback issue QCheckBox* chb = new QCheckBox ( tr ( "Enable feedback detection" ) ); chb->setCheckState ( pSettings->bEnableFeedbackDetection ? Qt::Checked : Qt::Unchecked ); QMessageBox msgbox; - msgbox.setText ( tr ( "Audio feedback or loud signal detected.\n\n" - "We muted your channel and activated 'Mute Myself'. Please solve " - "the feedback issue first and unmute yourself afterwards." ) ); + + if ( bWasPreview ) + { + msgbox.setText ( tr ( "Audio feedback or loud signal detected.\n\n" + "We stopped the preview. Please solve the feedback issue first, " + "e.g. by using headphones." ) ); + } + else + { + msgbox.setText ( tr ( "Audio feedback or loud signal detected.\n\n" + "We muted your channel and activated 'Mute Myself'. Please solve " + "the feedback issue first and unmute yourself afterwards." ) ); + } + msgbox.setIcon ( QMessageBox::Icon::Warning ); msgbox.addButton ( QMessageBox::Ok ); msgbox.setDefaultButton ( QMessageBox::Ok ); @@ -1231,6 +1285,9 @@ void CClientDlg::OnConnecting ( const QString& strMixerBoardLabel ) // change connect button text to "disconnect" butConnect->setText ( tr ( "&Disconnect" ) ); + // the local preview is not available while connected + InputEffectsDlg.SetConnected ( true ); + // set server name in audio mixer group box title MainMixerBoard->SetServerName ( strMixerBoardLabel ); @@ -1255,6 +1312,9 @@ void CClientDlg::OnDisconnect() // change connect button text to "connect" butConnect->setText ( tr ( "C&onnect" ) ); + InputEffectsDlg.SetConnected ( false ); + InputEffectsDlg.ResetMeters(); + // reset server name in audio mixer group box title MainMixerBoard->SetServerName ( "" ); @@ -1326,6 +1386,19 @@ void CClientDlg::UpdateDisplay() chbChat->setChecked ( true ); chbChat->blockSignals ( false ); } + + if ( chbInputFx->isChecked() && !InputEffectsDlg.isVisible() ) + { + chbInputFx->blockSignals ( true ); + chbInputFx->setChecked ( false ); + chbInputFx->blockSignals ( false ); + } + if ( !chbInputFx->isChecked() && InputEffectsDlg.isVisible() ) + { + chbInputFx->blockSignals ( true ); + chbInputFx->setChecked ( true ); + chbInputFx->blockSignals ( false ); + } } void CClientDlg::SetGUIDesign ( const EGUIDesign eNewDesign ) @@ -1347,8 +1420,6 @@ void CClientDlg::SetGUIDesign ( const EGUIDesign eNewDesign ) " margin: -5px, -5px, 0px, 0px; }" "QLabel { color: rgb(220, 220, 220);" " font: bold; }" - "QRadioButton { color: rgb(220, 220, 220);" - " font: bold; }" "QScrollArea { background: transparent; }" ".QWidget { background: transparent; }" // note: matches instances of QWidget, but not of its subclasses "QGroupBox { background: transparent; }" @@ -1361,16 +1432,6 @@ void CClientDlg::SetGUIDesign ( const EGUIDesign eNewDesign ) " image: url(:/png/fader/res/ledbuttonpressed.png); }" "QCheckBox { color: rgb(220, 220, 220);" " font: bold; }" ); -#ifdef _WIN32 - // Workaround QT-Windows problem: This should not be necessary since in the - // background frame the style sheet for QRadioButton was already set. But it - // seems that it is only applied if the style was set to default and then back - // to GD_ORIGINAL. This seems to be a QT related issue... - rbtReverbSelL->setStyleSheet ( "color: rgb(220, 220, 220);" - "font: bold;" ); - rbtReverbSelR->setStyleSheet ( "color: rgb(220, 220, 220);" - "font: bold;" ); -#endif ledBuffers->SetType ( CMultiColorLED::MT_LED ); ledDelay->SetType ( CMultiColorLED::MT_LED ); @@ -1380,12 +1441,6 @@ void CClientDlg::SetGUIDesign ( const EGUIDesign eNewDesign ) // reset style sheet and set original parameters backgroundFrame->setStyleSheet ( "" ); -#ifdef _WIN32 - // Workaround QT-Windows problem: See above description - rbtReverbSelL->setStyleSheet ( "" ); - rbtReverbSelR->setStyleSheet ( "" ); -#endif - ledBuffers->SetType ( CMultiColorLED::MT_INDICATOR ); ledDelay->SetType ( CMultiColorLED::MT_INDICATOR ); break; @@ -1421,6 +1476,7 @@ void CClientDlg::SetMeterStyle ( const EMeterStyle eNewMeterStyle ) // also apply MeterStyle to child GUI controls MainMixerBoard->SetMeterStyle ( eNewMeterStyle ); + InputEffectsDlg.SetMeterStyle ( eNewMeterStyle ); } void CClientDlg::OnRecorderStateReceived ( const ERecorderState newRecorderState ) diff --git a/src/clientdlg.h b/src/clientdlg.h index b127231b27..e98d53ca61 100644 --- a/src/clientdlg.h +++ b/src/clientdlg.h @@ -74,6 +74,7 @@ #include "audiomixerboard.h" #include "clientsettingsdlg.h" #include "chatdlg.h" +#include "inputeffectsdlg.h" #include "connectdlg.h" #include "analyzerconsole.h" #include "ui_clientdlgbase.h" @@ -112,9 +113,10 @@ class CClientDlg : public CBaseDlg, private Ui_CClientDlgBase void ShowConnectionSetupDialog(); void ShowGeneralSettings ( int iTab ); void ShowChatWindow ( const bool bForceRaise = true ); + void ShowInputEffects(); void ShowAnalyzerConsole(); void UpdateAudioFaderSlider(); - void UpdateRevSelection(); + void UpdateAudioChannelsDisplay(); void ManageDragNDrop ( QDropEvent* Event, const bool bCheckAccept ); void SetPingTime ( const int iPingTime, const int iOverallDelayMs, const CMultiColorLED::ELightColor eOverallDelayLEDColor ); @@ -141,6 +143,7 @@ class CClientDlg : public CBaseDlg, private Ui_CClientDlgBase CClientSettingsDlg ClientSettingsDlg; CChatDlg ChatDlg; + CInputEffectsDlg InputEffectsDlg; CConnectDlg ConnectDlg; CAnalyzerConsole AnalyzerConsole; @@ -181,6 +184,7 @@ public slots: void OnOpenAudioNetSettings(); void OnOpenAdvancedSettings(); void OnOpenChatDialog() { ShowChatWindow(); } + void OnOpenInputEffectsDialog() { ShowInputEffects(); } void OnOpenAnalyzerConsole() { ShowAnalyzerConsole(); } void OnOwnFaderFirst() { @@ -200,14 +204,10 @@ public slots: void OnSettingsStateChanged ( int value ); void OnChatStateChanged ( int value ); + void OnInputFxStateChanged ( int value ); + void OnLocalPreviewChanged ( bool bActive ); void OnLocalMuteStateChanged ( int value ); - void OnAudioReverbValueChanged ( int value ) { pClient->SetReverbLevel ( value ); } - - void OnReverbSelLClicked() { pClient->SetReverbOnLeftChan ( true ); } - - void OnReverbSelRClicked() { pClient->SetReverbOnLeftChan ( false ); } - void OnFeedbackDetectionChanged ( int state ) { ClientSettingsDlg.SetEnableFeedbackDetection ( state == Qt::Checked ); } void OnConClientListMesReceived ( CVector vecChanInfo ); @@ -258,7 +258,7 @@ public slots: void OnMeterStyleChanged(); void OnRecorderStateReceived ( ERecorderState eRecorderState ); void SetMixerBoardDeco ( const ERecorderState newRecorderState, const EGUIDesign eNewDesign ); - void OnAudioChannelsChanged() { UpdateRevSelection(); } + void OnAudioChannelsChanged() { UpdateAudioChannelsDisplay(); } void OnNumClientsChanged ( int iNewNumClients ); void accept() { close(); } // introduced by pljones diff --git a/src/clientdlgbase.ui b/src/clientdlgbase.ui index 0c652d7325..25110d6b65 100644 --- a/src/clientdlgbase.ui +++ b/src/clientdlgbase.ui @@ -69,7 +69,7 @@ - + @@ -89,158 +89,6 @@ - - - - Qt::Vertical - - - QSizePolicy::Expanding - - - - 13 - 10 - - - - - - - - - - 3 - - - - - Reverb - - - Qt::AlignCenter - - - - - - - - - Qt::Horizontal - - - QSizePolicy::Minimum - - - - 0 - 20 - - - - - - - - - 0 - 0 - - - - - 0 - 125 - - - - - 16777215 - 300 - - - - 1 - - - Qt::Vertical - - - QSlider::TicksBothSides - - - - - - - Qt::Horizontal - - - QSizePolicy::Minimum - - - - 0 - 20 - - - - - - - - - - - - 3 - - - - - Left - - - - - - - Right - - - - - - - - - - - Qt::Vertical - - - QSizePolicy::Expanding - - - - 13 - 10 - - - - - - - - - - Qt::Vertical - - - - - @@ -499,6 +347,13 @@ + + + + Input &FX + + + @@ -640,11 +495,9 @@ butConnect chbLocalMute + chbInputFx chbSettings chbChat - sldAudioReverb - rbtReverbSelL - rbtReverbSelR diff --git a/src/clientsettingsdlg.cpp b/src/clientsettingsdlg.cpp index ad92a0f8e1..37b19973b5 100644 --- a/src/clientsettingsdlg.cpp +++ b/src/clientsettingsdlg.cpp @@ -77,23 +77,6 @@ CClientSettingsDlg::CClientSettingsDlg ( CClient* pNCliP, CClientSettings* pNSet #endif // Add help text to controls ----------------------------------------------- - // local audio input fader - QString strAudFader = "" + tr ( "Local Audio Input Fader" ) + ": " + - tr ( "Controls the relative levels of the left and right local audio " - "channels. For a mono signal it acts as a pan between the two channels. " - "For example, if a microphone is connected to " - "the right input channel and an instrument is connected to the left " - "input channel which is much louder than the microphone, move the " - "audio fader in a direction where the label above the fader shows " - "%1, where %2 is the current attenuation indicator." ) - .arg ( "" + tr ( "L" ) + " -x", "x" ); - - lblAudioPan->setWhatsThis ( strAudFader ); - lblAudioPanValue->setWhatsThis ( strAudFader ); - sldAudioPan->setWhatsThis ( strAudFader ); - - sldAudioPan->setAccessibleName ( tr ( "Local audio input fader (left/right)" ) ); - // jitter buffer QString strJitterBufferSize = "" + tr ( "Jitter Buffer Size" ) + ": " + tr ( "The jitter buffer compensates for network and sound card timing jitters. The " @@ -363,23 +346,6 @@ CClientSettingsDlg::CClientSettingsDlg ( CClient* pNCliP, CClientSettings* pNSet edtNewClientLevel->setWhatsThis ( strNewClientLevel ); edtNewClientLevel->setAccessibleName ( tr ( "New client level edit box" ) ); - // input boost - QString strInputBoost = "" + tr ( "Input Boost" ) + ": " + - tr ( "This setting allows you to increase your input signal level " - "by factors up to 10 (+20dB). " - "If your sound is too quiet, first try to increase the level by " - "getting closer to the microphone, adjusting your sound equipment " - "or increasing levels in your operating system's input settings. " - "Only if this fails, set a factor here. " - "If your sound is too loud, sounds distorted and is clipping, this " - "option will not help. Do not use it. The distortion will still be " - "there. Instead, decrease your input level by getting farther away " - "from your microphone, adjusting your sound equipment " - "or by decreasing your operating system's input settings." ); - lblInputBoost->setWhatsThis ( strInputBoost ); - cbxInputBoost->setWhatsThis ( strInputBoost ); - cbxInputBoost->setAccessibleName ( tr ( "Input Boost combo box" ) ); - // custom directories QString strCustomDirectories = "" + tr ( "Custom Directories" ) + ": " + tr ( "If you need to add additional directories to the Connect dialog Directory drop down, " @@ -485,11 +451,6 @@ CClientSettingsDlg::CClientSettingsDlg ( CClient* pNCliP, CClientSettings* pNSet butDriverSetup->hide(); #endif - // init audio in fader - sldAudioPan->setRange ( AUD_FADER_IN_MIN, AUD_FADER_IN_MAX ); - sldAudioPan->setTickInterval ( AUD_FADER_IN_MAX / 5 ); - UpdateAudioFaderSlider(); - // init delay and other information controls lblUpstreamValue->setText ( "---" ); lblUpstreamUnit->setText ( "" ); @@ -545,16 +506,6 @@ CClientSettingsDlg::CClientSettingsDlg ( CClient* pNCliP, CClientSettings* pNSet // update new client fader level edit box edtNewClientLevel->setText ( QString::number ( pSettings->iNewClientFaderLevel ) ); - // Input Boost combo box - cbxInputBoost->clear(); - cbxInputBoost->addItem ( tr ( "None" ) ); - for ( int i = 2; i <= 10; i++ ) - { - cbxInputBoost->addItem ( QString ( "%1x" ).arg ( i ) ); - } - // factor is 1-based while index is 0-based: - cbxInputBoost->setCurrentIndex ( pSettings->iInputBoost - 1 ); - // init number of mixer rows spnMixerRows->setValue ( pSettings->iNumMixerPanelRows ); @@ -781,11 +732,6 @@ CClientSettingsDlg::CClientSettingsDlg ( CClient* pNCliP, CClientSettings* pNSet QObject::connect ( cbxLanguage, &CLanguageComboBox::LanguageChanged, this, &CClientSettingsDlg::OnLanguageChanged ); - QObject::connect ( cbxInputBoost, - static_cast ( &QComboBox::activated ), - this, - &CClientSettingsDlg::OnInputBoostChanged ); - // buttons #if defined( _WIN32 ) && !defined( WITH_JACK ) // Driver Setup button is only available for Windows when JACK is not used @@ -796,9 +742,6 @@ CClientSettingsDlg::CClientSettingsDlg ( CClient* pNCliP, CClientSettings* pNSet QObject::connect ( tbtDeleteCustomDirectory, &QToolButton::clicked, this, [this] { CClientSettingsDlg::OnCustomDirectoriesChanged ( true ); } ); // misc - // sliders - QObject::connect ( sldAudioPan, &QSlider::valueChanged, this, &CClientSettingsDlg::OnAudioPanValueChanged ); - QObject::connect ( &SndCrdBufferDelayButtonGroup, static_cast ( &QButtonGroup::buttonClicked ), this, @@ -1382,13 +1325,6 @@ void CClientSettingsDlg::UpdateDirectoryComboBox() } } -void CClientSettingsDlg::OnInputBoostChanged() -{ - // index is zero-based while boost factor must be 1-based: - pSettings->iInputBoost = cbxInputBoost->currentIndex() + 1; - pClient->SetInputBoost ( pSettings->iInputBoost ); -} - void CClientSettingsDlg::OnAliasTextChanged ( const QString& strNewName ) { // check length @@ -1461,39 +1397,6 @@ void CClientSettingsDlg::OnMakeTabChange ( int iTab ) void CClientSettingsDlg::OnTabChanged ( void ) { pSettings->iSettingsTab = tabSettings->currentIndex(); } -void CClientSettingsDlg::UpdateAudioFaderSlider() -{ - // update slider and label of audio fader - const int iCurAudInFader = pClient->GetAudioInFader(); - sldAudioPan->setValue ( iCurAudInFader ); - - // show in label the center position and what channel is - // attenuated - if ( iCurAudInFader == AUD_FADER_IN_MIDDLE ) - { - lblAudioPanValue->setText ( tr ( "Center" ) ); - } - else - { - if ( iCurAudInFader > AUD_FADER_IN_MIDDLE ) - { - // attenuation on right channel - lblAudioPanValue->setText ( tr ( "L" ) + " -" + QString().setNum ( iCurAudInFader - AUD_FADER_IN_MIDDLE ) ); - } - else - { - // attenuation on left channel - lblAudioPanValue->setText ( tr ( "R" ) + " -" + QString().setNum ( AUD_FADER_IN_MIDDLE - iCurAudInFader ) ); - } - } -} - -void CClientSettingsDlg::OnAudioPanValueChanged ( int value ) -{ - pClient->SetAudioInFader ( value ); - UpdateAudioFaderSlider(); -} - void CClientSettingsDlg::ResetMidiLearn() { midiLearnTarget = None; diff --git a/src/clientsettingsdlg.h b/src/clientsettingsdlg.h index 7844f64117..f414af3b18 100644 --- a/src/clientsettingsdlg.h +++ b/src/clientsettingsdlg.h @@ -88,7 +88,6 @@ class CClientSettingsDlg : public CBaseDlg, private Ui_CClientSettingsDlgBase void UpdateJitterBufferFrame(); void UpdateSoundCardFrame(); void UpdateDirectoryComboBox(); - void UpdateAudioFaderSlider(); QString GenSndCrdBufferDelayString ( const int iFrameSize, const QString strAddText = "" ); virtual void showEvent ( QShowEvent* ) override; @@ -108,7 +107,6 @@ public slots: void OnFeedbackDetectionChanged ( int value ); void OnCustomDirectoriesChanged ( bool bDelete ); void OnNewClientLevelEditingFinished() { pSettings->iNewClientFaderLevel = edtNewClientLevel->text().toInt(); } - void OnInputBoostChanged(); void OnSndCrdBufferDelayButtonGroupClicked ( QAbstractButton* button ); void OnSoundcardActivated ( int iSndDevIdx ); void OnLInChanActivated ( int iChanIdx ); @@ -128,7 +126,6 @@ public slots: void OnSkillActivated ( int iCntryListItem ); void OnTabChanged(); void OnMakeTabChange ( int iTabIdx ); - void OnAudioPanValueChanged ( int value ); void OnMidiDeviceActivated ( int iMidiDevIdx ); #if defined( _WIN32 ) && !defined( WITH_JACK ) diff --git a/src/clientsettingsdlgbase.ui b/src/clientsettingsdlgbase.ui index 842ab9220c..65f07ef868 100644 --- a/src/clientsettingsdlgbase.ui +++ b/src/clientsettingsdlgbase.ui @@ -1102,32 +1102,6 @@ - - - - Input Boost - - - cbxInputBoost - - - - - - - - - - Qt::Vertical - - - - 20 - 40 - - - - @@ -1189,118 +1163,6 @@ - - - - Input Balance - - - - - - 3 - - - - - Pan - - - Qt::AlignCenter - - - sldAudioPan - - - - - - - - - Qt::Horizontal - - - QSizePolicy::Minimum - - - - 0 - 20 - - - - - - - - - 0 - 0 - - - - - 0 - 0 - - - - - - - 1 - - - Qt::Horizontal - - - QSlider::TicksBothSides - - - - - - - Qt::Horizontal - - - QSizePolicy::Minimum - - - - 0 - 20 - - - - - - - - - - - 50 - 0 - - - - Center - - - Qt::AlignCenter - - - false - - - - - - - - @@ -2284,9 +2146,7 @@ cbxCustomDirectories tbtDeleteCustomDirectory edtNewClientLevel - cbxInputBoost chbDetectFeedback - sldAudioPan grbMidiControls cbxMidiDevice cbxChannel diff --git a/src/inputeffectlane.cpp b/src/inputeffectlane.cpp new file mode 100644 index 0000000000..666f67f8cd --- /dev/null +++ b/src/inputeffectlane.cpp @@ -0,0 +1,324 @@ +/******************************************************************************\ + * Copyright (c) 2026 + * + * Author(s): + * Serhii Popov (uazure@gmail.com) + * + ****************************************************************************** + * + * 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., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * +\******************************************************************************/ + +#include "inputeffectlane.h" + +/* Implementation *************************************************************/ +CInputEffectLane::CInputEffectLane ( QWidget* parent ) : QGroupBox ( parent ), pClient ( nullptr ), iLane ( 0 ) +{ + setupUi ( this ); + + // Add help text to controls ----------------------------------------------- + QString strBoost = "" + tr ( "Boost" ) + ": " + + tr ( "Raises the input volume by up to %1 dB before the other effects. " + "If your sound is too quiet, first try to increase the level by " + "getting closer to the microphone, with the gain control of your " + "audio interface or in your operating system's input settings. " + "Only if this fails, switch on the boost. " + "If your sound is too loud, sounds distorted and is clipping, the " + "boost will not help. Instead, decrease your input level." ) + .arg ( FX_BOOST_DB_MAX ); + + grbBoost->setWhatsThis ( strBoost ); + lblBoostGain->setWhatsThis ( strBoost ); + sldBoost->setWhatsThis ( strBoost ); + lblBoostValue->setWhatsThis ( strBoost ); + grbBoost->setAccessibleName ( tr ( "Boost on/off group box" ) ); + sldBoost->setAccessibleName ( tr ( "Boost gain slider" ) ); + + QString strComp = "" + tr ( "Compressor" ) + ": " + + tr ( "Compresses the dynamic range of your sound: loud parts are turned " + "down and the whole signal is raised to compensate, so your sound " + "gets louder and more even. The amount sets how strongly loud parts " + "are turned down, the threshold is the level above which the " + "compression starts. Input which is already compressed, e.g. by a " + "mixer or a pedal, usually needs no compression here." ); + + grbComp->setWhatsThis ( strComp ); + lblCompAmount->setWhatsThis ( strComp ); + cbxCompAmount->setWhatsThis ( strComp ); + lblCompThreshold->setWhatsThis ( strComp ); + sldCompThreshold->setWhatsThis ( strComp ); + lblCompThresholdValue->setWhatsThis ( strComp ); + grbComp->setAccessibleName ( tr ( "Compressor on/off group box" ) ); + cbxCompAmount->setAccessibleName ( tr ( "Compressor amount combo box" ) ); + sldCompThreshold->setAccessibleName ( tr ( "Compressor threshold slider" ) ); + + QString strReverb = "" + tr ( "Reverb" ) + ": " + + tr ( "Adds a reverberation effect to this input channel. Move the " + "slider to the right until the desired reverb level is reached." ); + + grbReverb->setWhatsThis ( strReverb ); + lblReverbLevel->setWhatsThis ( strReverb ); + sldReverb->setWhatsThis ( strReverb ); + lblReverbValue->setWhatsThis ( strReverb ); + grbReverb->setAccessibleName ( tr ( "Reverb on/off group box" ) ); + sldReverb->setAccessibleName ( tr ( "Reverb level slider" ) ); + + QString strMeters = "" + tr ( "Level Meters" ) + ": " + + tr ( "The left meter shows the level as it comes from the sound card, " + "the right meter shows the level after the effects, which is what " + "is sent to the server." ); + + lbrInputRaw->setWhatsThis ( strMeters ); + lbrOutput->setWhatsThis ( strMeters ); + lblMeterIn->setWhatsThis ( strMeters ); + lblMeterOut->setWhatsThis ( strMeters ); + lbrInputRaw->setAccessibleName ( tr ( "Input level before the effects" ) ); + lbrOutput->setAccessibleName ( tr ( "Input level after the effects" ) ); + + // short tooltips (rich text, so that long tooltips wrap) + sldBoost->setToolTip ( + "

" + tr ( "Raises the input volume before the other effects. Prefer the gain control on your audio interface if it has one." ) + "

" ); + grbComp->setToolTip ( "

" + + tr ( "Compresses the dynamic range: loud parts are turned down and the whole signal is raised to compensate, " + "so your sound gets louder and more even." ) + + "

" ); + cbxCompAmount->setToolTip ( "

" + tr ( "Light: vocals, acoustic guitar." ) + "
" + tr ( "Moderate: expressive singing, bass, percussion." ) + + "
" + tr ( "Strong: drums, very dynamic sources." ) + "

" + + tr ( "Note: already compressed input (mixer, pedal) needs none." ) + "

" ); + sldCompThreshold->setToolTip ( "

" + tr ( "Level above which compression starts. Lower means more compression and more volume." ) + "

" ); + sldReverb->setToolTip ( "

" + tr ( "Amount of reverb mixed into the signal." ) + "

" ); + lbrInputRaw->setToolTip ( "

" + tr ( "Level from the sound card, before the effects." ) + "

" ); + lbrOutput->setToolTip ( "

" + tr ( "Level after the effects, as sent to the server." ) + "

" ); + + // init controls ----------------------------------------------------------- +#ifndef NO_INTERNAL_EFFECTS + sldBoost->setRange ( 0, FX_BOOST_DB_MAX ); + sldBoost->setTickInterval ( 6 ); + + cbxCompAmount->clear(); + cbxCompAmount->addItem ( tr ( "Light (2:1)" ) ); + cbxCompAmount->addItem ( tr ( "Moderate (3:1)" ) ); + cbxCompAmount->addItem ( tr ( "Strong (4:1)" ) ); + + sldCompThreshold->setRange ( FX_COMP_THRESHOLD_DB_MIN, FX_COMP_THRESHOLD_DB_MAX ); + sldCompThreshold->setTickInterval ( 10 ); + + sldReverb->setRange ( 0, AUD_REVERB_MAX ); + sldReverb->setTickInterval ( AUD_REVERB_MAX / 5 ); +#else + // this build has no internal effects: only the meters are shown + grbBoost->hide(); + grbComp->hide(); + grbReverb->hide(); +#endif + + ResetMeters(); + + // Connections ------------------------------------------------------------- + QObject::connect ( grbBoost, &QGroupBox::toggled, this, &CInputEffectLane::OnBoostToggled ); + QObject::connect ( sldBoost, &QSlider::valueChanged, this, &CInputEffectLane::OnBoostSliderChanged ); + QObject::connect ( grbComp, &QGroupBox::toggled, this, &CInputEffectLane::OnCompToggled ); + QObject::connect ( cbxCompAmount, + static_cast ( &QComboBox::activated ), + this, + &CInputEffectLane::OnCompAmountActivated ); + QObject::connect ( sldCompThreshold, &QSlider::valueChanged, this, &CInputEffectLane::OnCompThresholdSliderChanged ); + QObject::connect ( grbReverb, &QGroupBox::toggled, this, &CInputEffectLane::OnReverbToggled ); + QObject::connect ( sldReverb, &QSlider::valueChanged, this, &CInputEffectLane::OnReverbSliderChanged ); +} + +void CInputEffectLane::SetClientAndLane ( CClient* pNCliP, const int iNLane ) +{ + pClient = pNCliP; + iLane = iNLane; + UpdateFromClient(); +} + +void CInputEffectLane::UpdateFromClient() +{ +#ifndef NO_INTERNAL_EFFECTS + if ( pClient == nullptr ) + { + return; + } + + CInputEffectChain& Fx = pClient->GetInputEffects(); + + // do not fire signals since this is an update from the effect parameters + grbBoost->blockSignals ( true ); + sldBoost->blockSignals ( true ); + grbComp->blockSignals ( true ); + cbxCompAmount->blockSignals ( true ); + sldCompThreshold->blockSignals ( true ); + grbReverb->blockSignals ( true ); + sldReverb->blockSignals ( true ); + + grbBoost->setChecked ( Fx.Boost ( iLane ).IsEnabled() ); + sldBoost->setValue ( qRound ( Fx.Boost ( iLane ).GetGainDb() ) ); + grbComp->setChecked ( Fx.Compressor ( iLane ).IsEnabled() ); + cbxCompAmount->setCurrentIndex ( Fx.Compressor ( iLane ).GetRatioIdx() ); + sldCompThreshold->setValue ( qRound ( Fx.Compressor ( iLane ).GetThresholdDb() ) ); + grbReverb->setChecked ( Fx.Reverb ( iLane ).IsEnabled() ); + sldReverb->setValue ( Fx.Reverb ( iLane ).GetLevel() ); + + grbBoost->blockSignals ( false ); + sldBoost->blockSignals ( false ); + grbComp->blockSignals ( false ); + cbxCompAmount->blockSignals ( false ); + sldCompThreshold->blockSignals ( false ); + grbReverb->blockSignals ( false ); + sldReverb->blockSignals ( false ); + + UpdateValueLabels(); +#endif +} + +void CInputEffectLane::UpdateValueLabels() +{ + lblBoostValue->setText ( tr ( "+%1 dB" ).arg ( sldBoost->value() ) ); + lblCompThresholdValue->setText ( tr ( "%1 dB" ).arg ( sldCompThreshold->value() ) ); + lblReverbValue->setText ( tr ( "%1 %" ).arg ( sldReverb->value() ) ); +} + +void CInputEffectLane::UpdateMeters ( const double dRawDb, const double dOutDb ) +{ + lbrInputRaw->SetValue ( dRawDb ); + lbrOutput->SetValue ( dOutDb ); +} + +void CInputEffectLane::ResetMeters() +{ + lbrInputRaw->SetValue ( 0 ); + lbrOutput->SetValue ( 0 ); +} + +void CInputEffectLane::SetMeterStyle ( const EMeterStyle eNewMeterStyle ) +{ + // same mapping as the input meter on the main window + switch ( eNewMeterStyle ) + { + case MT_LED_STRIPE: + lbrInputRaw->SetLevelMeterType ( CLevelMeter::MT_LED_STRIPE ); + lbrOutput->SetLevelMeterType ( CLevelMeter::MT_LED_STRIPE ); + break; + + case MT_LED_ROUND_BIG: + case MT_LED_ROUND_SMALL: + lbrInputRaw->SetLevelMeterType ( CLevelMeter::MT_LED_ROUND_BIG ); + lbrOutput->SetLevelMeterType ( CLevelMeter::MT_LED_ROUND_BIG ); + break; + + case MT_BAR_WIDE: + case MT_BAR_NARROW: + lbrInputRaw->SetLevelMeterType ( CLevelMeter::MT_BAR_WIDE ); + lbrOutput->SetLevelMeterType ( CLevelMeter::MT_BAR_WIDE ); + break; + } +} + +void CInputEffectLane::OnBoostToggled ( bool bChecked ) +{ +#ifndef NO_INTERNAL_EFFECTS + if ( pClient != nullptr ) + { + pClient->GetInputEffects().Boost ( iLane ).SetEnabled ( bChecked ); + emit ParamChanged(); + } +#else + Q_UNUSED ( bChecked ) +#endif +} + +void CInputEffectLane::OnBoostSliderChanged ( int iValue ) +{ +#ifndef NO_INTERNAL_EFFECTS + if ( pClient != nullptr ) + { + pClient->GetInputEffects().Boost ( iLane ).SetGainDb ( static_cast ( iValue ) ); + UpdateValueLabels(); + emit ParamChanged(); + } +#else + Q_UNUSED ( iValue ) +#endif +} + +void CInputEffectLane::OnCompToggled ( bool bChecked ) +{ +#ifndef NO_INTERNAL_EFFECTS + if ( pClient != nullptr ) + { + pClient->GetInputEffects().Compressor ( iLane ).SetEnabled ( bChecked ); + emit ParamChanged(); + } +#else + Q_UNUSED ( bChecked ) +#endif +} + +void CInputEffectLane::OnCompAmountActivated ( int iIdx ) +{ +#ifndef NO_INTERNAL_EFFECTS + if ( pClient != nullptr ) + { + pClient->GetInputEffects().Compressor ( iLane ).SetRatioIdx ( iIdx ); + emit ParamChanged(); + } +#else + Q_UNUSED ( iIdx ) +#endif +} + +void CInputEffectLane::OnCompThresholdSliderChanged ( int iValue ) +{ +#ifndef NO_INTERNAL_EFFECTS + if ( pClient != nullptr ) + { + pClient->GetInputEffects().Compressor ( iLane ).SetThresholdDb ( static_cast ( iValue ) ); + UpdateValueLabels(); + emit ParamChanged(); + } +#else + Q_UNUSED ( iValue ) +#endif +} + +void CInputEffectLane::OnReverbToggled ( bool bChecked ) +{ +#ifndef NO_INTERNAL_EFFECTS + if ( pClient != nullptr ) + { + pClient->GetInputEffects().Reverb ( iLane ).SetEnabled ( bChecked ); + emit ParamChanged(); + } +#else + Q_UNUSED ( bChecked ) +#endif +} + +void CInputEffectLane::OnReverbSliderChanged ( int iValue ) +{ +#ifndef NO_INTERNAL_EFFECTS + if ( pClient != nullptr ) + { + pClient->GetInputEffects().Reverb ( iLane ).SetLevel ( iValue ); + UpdateValueLabels(); + emit ParamChanged(); + } +#else + Q_UNUSED ( iValue ) +#endif +} diff --git a/src/inputeffectlane.h b/src/inputeffectlane.h new file mode 100644 index 0000000000..75340d864c --- /dev/null +++ b/src/inputeffectlane.h @@ -0,0 +1,76 @@ +/******************************************************************************\ + * Copyright (c) 2026 + * + * Author(s): + * Serhii Popov (uazure@gmail.com) + * + ****************************************************************************** + * + * 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., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * +\******************************************************************************/ + +#pragma once + +#include +#include +#include +#include +#include +#include "global.h" +#include "util.h" +#include "client.h" +#include "levelmeter.h" +#include "ui_inputeffectlanebase.h" + +/* Classes ********************************************************************/ +// one column of the Input Effects window: the controls of all effects of one +// lane (input channel) plus the level meters before and after the effects +class CInputEffectLane : public QGroupBox, private Ui_CInputEffectLaneBase +{ + Q_OBJECT + +public: + CInputEffectLane ( QWidget* parent = nullptr ); + + // binds the controls to the effects of the given lane + void SetClientAndLane ( CClient* pNCliP, const int iNLane ); + + // controls <- effect parameters + void UpdateFromClient(); + + void UpdateMeters ( const double dRawDb, const double dOutDb ); + void ResetMeters(); + void SetMeterStyle ( const EMeterStyle eNewMeterStyle ); + +protected: + void UpdateValueLabels(); + + CClient* pClient; + int iLane; + +public slots: + void OnBoostToggled ( bool bChecked ); + void OnBoostSliderChanged ( int iValue ); + void OnCompToggled ( bool bChecked ); + void OnCompAmountActivated ( int iIdx ); + void OnCompThresholdSliderChanged ( int iValue ); + void OnReverbToggled ( bool bChecked ); + void OnReverbSliderChanged ( int iValue ); + +signals: + // a parameter was changed by the user + void ParamChanged(); +}; diff --git a/src/inputeffectlanebase.ui b/src/inputeffectlanebase.ui new file mode 100644 index 0000000000..295da54841 --- /dev/null +++ b/src/inputeffectlanebase.ui @@ -0,0 +1,294 @@ + + + CInputEffectLaneBase + + + + 0 + 0 + 360 + 300 + + + + Left + + + + + + + + Boost + + + true + + + false + + + + + + Gain + + + sldBoost + + + + + + + Qt::Horizontal + + + 1 + + + QSlider::TicksBelow + + + + + + + + 55 + 0 + + + + +6 dB + + + Qt::AlignRight|Qt::AlignVCenter + + + + + + + + + + Compressor + + + true + + + false + + + + + + Amount + + + cbxCompAmount + + + + + + + + + + Threshold + + + sldCompThreshold + + + + + + + Qt::Horizontal + + + 1 + + + QSlider::TicksBelow + + + + + + + + 55 + 0 + + + + -20 dB + + + Qt::AlignRight|Qt::AlignVCenter + + + + + + + + + + Reverb + + + true + + + false + + + + + + Level + + + sldReverb + + + + + + + Qt::Horizontal + + + 1 + + + QSlider::TicksBelow + + + + + + + + 55 + 0 + + + + 30 % + + + Qt::AlignRight|Qt::AlignVCenter + + + + + + + + + + Qt::Vertical + + + + 20 + 0 + + + + + + + + + + + + + + + 0 + 0 + + + + + 0 + 125 + + + + + + + + In + + + Qt::AlignCenter + + + + + + + + + + + + 0 + 0 + + + + + 0 + 125 + + + + + + + + Out + + + Qt::AlignCenter + + + + + + + + + + + + CLevelMeter + QWidget +
levelmeter.h
+ 1 +
+
+ + grbBoost + sldBoost + grbComp + cbxCompAmount + sldCompThreshold + grbReverb + sldReverb + + + +
diff --git a/src/inputeffectsdlg.cpp b/src/inputeffectsdlg.cpp new file mode 100644 index 0000000000..1ec3e67e82 --- /dev/null +++ b/src/inputeffectsdlg.cpp @@ -0,0 +1,358 @@ +/******************************************************************************\ + * Copyright (c) 2026 + * + * Author(s): + * Serhii Popov (uazure@gmail.com) + * + ****************************************************************************** + * + * 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., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * +\******************************************************************************/ + +#include "inputeffectsdlg.h" + +/* Implementation *************************************************************/ +CInputEffectsDlg::CInputEffectsDlg ( CClient* pNCliP, CClientSettings* pNSetP, QWidget* parent ) : + CBaseDlg ( parent, Qt::Window ), // use Qt::Window to get min/max window buttons + pClient ( pNCliP ), + pSettings ( pNSetP ), + bMobile ( false ), + iMobileLane ( 0 ) +{ + setupUi ( this ); + +#if defined( Q_OS_IOS ) + // iOS needs menu to close + QMenuBar* pMenu = new QMenuBar ( this ); + QAction* action = pMenu->addAction ( tr ( "&Close" ) ); + connect ( action, SIGNAL ( triggered() ), this, SLOT ( close() ) ); + + // Now tell the layout about the menu + layout()->setMenuBar ( pMenu ); + bMobile = true; +#endif + +#if defined( Q_OS_ANDROID ) || defined( ANDROID ) + // Android too + QMenuBar* pMenu = new QMenuBar ( this ); + QMenu* pCloseMenu = new QMenu ( tr ( "&Close" ), this ); + pCloseMenu->addAction ( tr ( "&Close" ), this, SLOT ( close() ) ); + pMenu->addMenu ( pCloseMenu ); + + // Now tell the layout about the menu + layout()->setMenuBar ( pMenu ); + bMobile = true; +#endif + + // Add help text to controls ----------------------------------------------- + QString strLinked = "" + tr ( "Same settings for L and R" ) + ": " + + tr ( "If checked, the effects are set once and applied to both input " + "channels in the same way. Uncheck it to set up the left and right " + "input channel separately, e.g. a microphone on one and an " + "instrument on the other channel." ); + + chbLinked->setWhatsThis ( strLinked ); + chbLinked->setAccessibleName ( tr ( "Same settings for left and right check box" ) ); + + QString strChannel = "" + tr ( "Channel" ) + ": " + + tr ( "Select which input channel to set up. \"Both\" sets the effects " + "once for the left and right input channel." ); + + lblChannel->setWhatsThis ( strChannel ); + cbxChannel->setWhatsThis ( strChannel ); + cbxChannel->setAccessibleName ( tr ( "Input channel selection combo box" ) ); + + QString strPreview = "" + tr ( "Preview" ) + ": " + + tr ( "Plays your processed sound locally so that you can check the " + "effects. Use headphones to avoid feedback. The preview is only " + "available while you are not connected to a server." ); + + butPreview->setWhatsThis ( strPreview ); + butPreview->setToolTip ( "

" + tr ( "Play your processed sound locally to check the effects. Use headphones to avoid feedback." ) + "

" ); + butPreview->setAccessibleName ( tr ( "Preview toggle button" ) ); + + // local audio input fader + QString strAudFader = "" + tr ( "Input Balance" ) + ": " + + tr ( "Controls the relative levels of the left and right local audio " + "channels. For a mono signal it acts as a pan between the two channels. " + "For example, if a microphone is connected to " + "the right input channel and an instrument is connected to the left " + "input channel which is much louder than the microphone, move the " + "audio fader in a direction where the label next to the fader shows " + "%1, where %2 is the current attenuation indicator." ) + .arg ( "" + tr ( "L" ) + " -x", "x" ); + + lblAudioPan->setWhatsThis ( strAudFader ); + lblAudioPanValue->setWhatsThis ( strAudFader ); + sldAudioPan->setWhatsThis ( strAudFader ); + sldAudioPan->setAccessibleName ( tr ( "Local audio input fader (left/right)" ) ); + + // short tooltips (rich text, so that long tooltips wrap) + chbLinked->setToolTip ( "

" + tr ( "Use one set of effects for both input channels." ) + "

" ); + cbxChannel->setToolTip ( "

" + tr ( "Input channel to set up." ) + "

" ); + sldAudioPan->setToolTip ( "

" + tr ( "Balance between the left and right input channel." ) + "

" ); + + // init controls ----------------------------------------------------------- + wdgLaneL->SetClientAndLane ( pClient, 0 ); + wdgLaneR->SetClientAndLane ( pClient, 1 ); + +#ifdef NO_INTERNAL_EFFECTS + chbLinked->hide(); + lblChannel->hide(); + cbxChannel->hide(); +#else + lblNoEffects->hide(); +#endif + + // init audio in fader + sldAudioPan->setRange ( AUD_FADER_IN_MIN, AUD_FADER_IN_MAX ); + sldAudioPan->setTickInterval ( AUD_FADER_IN_MAX / 10 ); // a tick at the center position + UpdateAudioFaderSlider(); + + UpdateChannelLayout(); + SetConnected ( false ); + + // Connections ------------------------------------------------------------- + QObject::connect ( chbLinked, &QCheckBox::toggled, this, &CInputEffectsDlg::OnLinkedToggled ); + + QObject::connect ( cbxChannel, + static_cast ( &QComboBox::activated ), + this, + &CInputEffectsDlg::OnChannelActivated ); + + QObject::connect ( wdgLaneL, &CInputEffectLane::ParamChanged, this, &CInputEffectsDlg::OnLaneParamChanged ); + + QObject::connect ( wdgLaneR, &CInputEffectLane::ParamChanged, this, &CInputEffectsDlg::OnLaneParamChanged ); + + QObject::connect ( butPreview, &QPushButton::toggled, this, &CInputEffectsDlg::OnPreviewToggled ); + + QObject::connect ( pClient, &CClient::LocalPreviewChanged, this, &CInputEffectsDlg::OnLocalPreviewChanged ); + + QObject::connect ( sldAudioPan, &QSlider::valueChanged, this, &CInputEffectsDlg::OnAudioPanValueChanged ); +} + +void CInputEffectsDlg::UpdateChannelLayout() +{ + const bool bStereo = ( pClient->GetAudioChannels() == CC_STEREO ); + const bool bLinked = pSettings->bInputEffectsLinked; + + if ( bLinked && !bStereo ) + { + // only the left lane is shown and edited: make sure the right lane + // processes with the same parameters (e.g. after a switch from stereo + // mode, where the right lane is not used) + CopyLaneParams ( 0, 1 ); + } + +#ifndef NO_INTERNAL_EFFECTS + // the linking controls make no sense in stereo mode (one source) + chbLinked->setVisible ( !bStereo && !bMobile ); + lblChannel->setVisible ( !bStereo && bMobile ); + cbxChannel->setVisible ( !bStereo && bMobile ); + + chbLinked->blockSignals ( true ); + chbLinked->setChecked ( bLinked ); + chbLinked->blockSignals ( false ); + + cbxChannel->blockSignals ( true ); + cbxChannel->setCurrentIndex ( bLinked ? 0 : iMobileLane + 1 ); + cbxChannel->blockSignals ( false ); +#endif + + if ( bStereo ) + { + wdgLaneL->setTitle ( tr ( "Stereo" ) ); + wdgLaneL->setVisible ( true ); + wdgLaneR->setVisible ( false ); + } + else if ( bLinked ) + { + wdgLaneL->setTitle ( tr ( "Left and Right" ) ); + wdgLaneL->setVisible ( true ); + wdgLaneR->setVisible ( false ); + } + else + { + wdgLaneL->setTitle ( tr ( "Left (In 1)" ) ); + wdgLaneR->setTitle ( tr ( "Right (In 2)" ) ); + wdgLaneL->setVisible ( !bMobile || ( iMobileLane == 0 ) ); + wdgLaneR->setVisible ( !bMobile || ( iMobileLane == 1 ) ); + } + + wdgLaneL->UpdateFromClient(); + wdgLaneR->UpdateFromClient(); +} + +void CInputEffectsDlg::UpdateMeters() +{ + wdgLaneL->UpdateMeters ( pClient->GetLevelForMeterdBRawLeft(), pClient->GetLevelForMeterdBLeft() ); + wdgLaneR->UpdateMeters ( pClient->GetLevelForMeterdBRawRight(), pClient->GetLevelForMeterdBRight() ); +} + +void CInputEffectsDlg::ResetMeters() +{ + wdgLaneL->ResetMeters(); + wdgLaneR->ResetMeters(); +} + +void CInputEffectsDlg::SetMeterStyle ( const EMeterStyle eNewMeterStyle ) +{ + wdgLaneL->SetMeterStyle ( eNewMeterStyle ); + wdgLaneR->SetMeterStyle ( eNewMeterStyle ); +} + +void CInputEffectsDlg::SetConnected ( const bool bConnected ) +{ + // the sound card is in use while connected + butPreview->setEnabled ( !bConnected ); +} + +void CInputEffectsDlg::UpdateAudioFaderSlider() +{ + // update slider and label of audio fader + const int iCurAudInFader = pClient->GetAudioInFader(); + sldAudioPan->setValue ( iCurAudInFader ); + + // show in label the center position and what channel is + // attenuated + if ( iCurAudInFader == AUD_FADER_IN_MIDDLE ) + { + lblAudioPanValue->setText ( tr ( "Center" ) ); + } + else + { + if ( iCurAudInFader > AUD_FADER_IN_MIDDLE ) + { + // attenuation on right channel + lblAudioPanValue->setText ( tr ( "L" ) + " -" + QString().setNum ( iCurAudInFader - AUD_FADER_IN_MIDDLE ) ); + } + else + { + // attenuation on left channel + lblAudioPanValue->setText ( tr ( "R" ) + " -" + QString().setNum ( AUD_FADER_IN_MIDDLE - iCurAudInFader ) ); + } + } +} + +void CInputEffectsDlg::hideEvent ( QHideEvent* ) +{ + // the preview belongs to this window + StopPreview(); +} + +void CInputEffectsDlg::StopPreview() +{ + if ( pClient->IsLocalPreviewActive() ) + { + try + { + pClient->SetLocalPreview ( false ); + } + catch ( const CGenErr& ) + { + // stopping the preview failed, nothing more to do here + } + } +} + +void CInputEffectsDlg::CopyLaneParams ( const int iFrom, const int iTo ) +{ +#ifndef NO_INTERNAL_EFFECTS + CInputEffectChain& Fx = pClient->GetInputEffects(); + + Fx.Boost ( iTo ).SetEnabled ( Fx.Boost ( iFrom ).IsEnabled() ); + Fx.Boost ( iTo ).SetGainDb ( Fx.Boost ( iFrom ).GetGainDb() ); + Fx.Compressor ( iTo ).SetEnabled ( Fx.Compressor ( iFrom ).IsEnabled() ); + Fx.Compressor ( iTo ).SetRatioIdx ( Fx.Compressor ( iFrom ).GetRatioIdx() ); + Fx.Compressor ( iTo ).SetThresholdDb ( Fx.Compressor ( iFrom ).GetThresholdDb() ); + Fx.Reverb ( iTo ).SetEnabled ( Fx.Reverb ( iFrom ).IsEnabled() ); + Fx.Reverb ( iTo ).SetLevel ( Fx.Reverb ( iFrom ).GetLevel() ); +#else + Q_UNUSED ( iFrom ) + Q_UNUSED ( iTo ) +#endif +} + +void CInputEffectsDlg::OnLinkedToggled ( bool bChecked ) +{ + pSettings->bInputEffectsLinked = bChecked; + + if ( bChecked ) + { + // from now on the left settings are used for both channels + CopyLaneParams ( 0, 1 ); + } + + UpdateChannelLayout(); +} + +void CInputEffectsDlg::OnChannelActivated ( int iIdx ) +{ + // 0: both (linked), 1: left, 2: right + if ( iIdx == 0 ) + { + OnLinkedToggled ( true ); + } + else + { + iMobileLane = iIdx - 1; + pSettings->bInputEffectsLinked = false; + UpdateChannelLayout(); + } +} + +void CInputEffectsDlg::OnLaneParamChanged() +{ + if ( pSettings->bInputEffectsLinked && ( pClient->GetAudioChannels() != CC_STEREO ) ) + { + // only the left lane is visible when linked + CopyLaneParams ( 0, 1 ); + wdgLaneR->UpdateFromClient(); + } +} + +void CInputEffectsDlg::OnPreviewToggled ( bool bChecked ) +{ + try + { + pClient->SetLocalPreview ( bChecked ); + } + catch ( const CGenErr& generr ) + { + QMessageBox::critical ( this, APP_NAME, generr.GetErrorText(), tr ( "Ok" ), nullptr ); + } + + // the client reports the actual state (which may differ from the request) + OnLocalPreviewChanged ( pClient->IsLocalPreviewActive() ); +} + +void CInputEffectsDlg::OnLocalPreviewChanged ( bool bActive ) +{ + butPreview->blockSignals ( true ); + butPreview->setChecked ( bActive ); + butPreview->blockSignals ( false ); + + if ( !bActive ) + { + ResetMeters(); + } +} + +void CInputEffectsDlg::OnAudioPanValueChanged ( int value ) +{ + pClient->SetAudioInFader ( value ); + UpdateAudioFaderSlider(); +} diff --git a/src/inputeffectsdlg.h b/src/inputeffectsdlg.h new file mode 100644 index 0000000000..6309fcd8a5 --- /dev/null +++ b/src/inputeffectsdlg.h @@ -0,0 +1,83 @@ +/******************************************************************************\ + * Copyright (c) 2026 + * + * Author(s): + * Serhii Popov (uazure@gmail.com) + * + ****************************************************************************** + * + * 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., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * +\******************************************************************************/ + +#pragma once + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "global.h" +#include "util.h" +#include "client.h" +#include "settings.h" +#include "inputeffectlane.h" +#include "ui_inputeffectsdlgbase.h" + +/* Classes ********************************************************************/ +// non-modal window with all local input effects, one column per input channel +class CInputEffectsDlg : public CBaseDlg, private Ui_CInputEffectsDlgBase +{ + Q_OBJECT + +public: + CInputEffectsDlg ( CClient* pNCliP, CClientSettings* pNSetP, QWidget* parent = nullptr ); + + // shows one or two lanes depending on the audio channel configuration, + // the linked setting and (on phones) the selected channel + void UpdateChannelLayout(); + + void UpdateMeters(); + void ResetMeters(); + void SetMeterStyle ( const EMeterStyle eNewMeterStyle ); + + // the preview is only available while not connected + void SetConnected ( const bool bConnected ); + + void UpdateAudioFaderSlider(); + +protected: + virtual void hideEvent ( QHideEvent* ) override; + + void CopyLaneParams ( const int iFrom, const int iTo ); + void StopPreview(); + + CClient* pClient; + CClientSettings* pSettings; + bool bMobile; + int iMobileLane; // lane shown on phones when not linked + +public slots: + void OnLinkedToggled ( bool bChecked ); + void OnChannelActivated ( int iIdx ); + void OnLaneParamChanged(); + void OnPreviewToggled ( bool bChecked ); + void OnLocalPreviewChanged ( bool bActive ); + void OnAudioPanValueChanged ( int value ); +}; diff --git a/src/inputeffectsdlgbase.ui b/src/inputeffectsdlgbase.ui new file mode 100644 index 0000000000..892e96547e --- /dev/null +++ b/src/inputeffectsdlgbase.ui @@ -0,0 +1,201 @@ + + + CInputEffectsDlgBase + + + + 0 + 0 + 760 + 480 + + + + Input Effects + + + + :/png/main/res/fronticon.png:/png/main/res/fronticon.png + + + true + + + + + + + + Same settings for L and R + + + + + + + Channel + + + cbxChannel + + + + + + + + Both + + + + + Left + + + + + Right + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + &Preview + + + true + + + + + + + + + Applied to your sound before it is sent to the server. All effects are off by default. + + + true + + + + + + + This build has no built-in effects. + + + true + + + + + + + + + Left + + + + + + + Right + + + + + + + + + Input Balance + + + + + + Pan + + + sldAudioPan + + + + + + + + 0 + 0 + + + + 1 + + + Qt::Horizontal + + + QSlider::TicksBothSides + + + + + + + + 50 + 0 + + + + Center + + + Qt::AlignCenter + + + + + + + + + + + CInputEffectLane + QGroupBox +
inputeffectlane.h
+ 1 +
+
+ + chbLinked + cbxChannel + butPreview + wdgLaneL + wdgLaneR + sldAudioPan + + + + + +
diff --git a/src/plugins/audiocompressor.cpp b/src/plugins/audiocompressor.cpp new file mode 100644 index 0000000000..8eaed3a398 --- /dev/null +++ b/src/plugins/audiocompressor.cpp @@ -0,0 +1,158 @@ +/******************************************************************************\ + * Copyright (c) 2026 + * + * Author(s): + * Serhii Popov (uazure@gmail.com) + * + ****************************************************************************** + * + * 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., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * +\******************************************************************************/ + +#include +#include +#include "audiocompressor.h" +#include "global.h" + +namespace +{ +// 20 / ln(10) and ln(10) / 20, used for fast dB <-> linear conversion +const float fLinToDbFact = 8.685889638f; +const float fDbToLinFact = 0.1151292546f; + +// smallest level considered by the detector (-120 dBFS) +const float fMinDetectorLevel = 1e-6f; + +const float afRatios[FX_COMP_NUM_RATIOS] = { 2.0f, 3.0f, 4.0f }; + +inline float DbToLin ( const float fDb ) { return expf ( fDb * fDbToLinFact ); } + +inline float TimeConstToCoef ( const float fTimeS ) { return expf ( -1.0f / ( fTimeS * SYSTEM_SAMPLE_RATE_HZ ) ); } +} // namespace + +CAudioCompressor::CAudioCompressor() : + iNumChannels ( 1 ), + iRatioIdx ( FX_COMP_RATIO_IDX_DEFAULT ), + fThresholdDb ( FX_COMP_THRESHOLD_DB_DEFAULT ), + fAttackCoef ( 0.0f ), + fReleaseCoef ( 0.0f ), + fGainReductionDb ( 0.0f ) +{} + +float CAudioCompressor::GetRatio ( const int iIdx ) +{ + if ( ( iIdx < 0 ) || ( iIdx >= FX_COMP_NUM_RATIOS ) ) + { + return afRatios[FX_COMP_RATIO_IDX_DEFAULT]; + } + + return afRatios[iIdx]; +} + +void CAudioCompressor::SetRatioIdx ( const int iNewIdx ) +{ + if ( ( iNewIdx >= 0 ) && ( iNewIdx < FX_COMP_NUM_RATIOS ) ) + { + iRatioIdx = iNewIdx; + } +} + +void CAudioCompressor::SetThresholdDb ( const float fNewThresholdDb ) +{ + fThresholdDb = + std::min ( static_cast ( FX_COMP_THRESHOLD_DB_MAX ), std::max ( static_cast ( FX_COMP_THRESHOLD_DB_MIN ), fNewThresholdDb ) ); +} + +void CAudioCompressor::Activate ( const int iNNumChannels, const int /* iMaxFrames */ ) +{ + iNumChannels = iNNumChannels; + fAttackCoef = TimeConstToCoef ( FX_COMP_ATTACK_S ); + fReleaseCoef = TimeConstToCoef ( FX_COMP_RELEASE_S ); + Reset(); +} + +void CAudioCompressor::Reset() { fGainReductionDb = 0.0f; } + +void CAudioCompressor::Process ( float* const* ppfChannels, const int iNumFrames ) +{ + // read the parameters once per block + const float fRatio = GetRatio ( iRatioIdx ); + const float fThreshDb = fThresholdDb; + const float fSlope = 1.0f / fRatio - 1.0f; + + // makeup gain which brings a full scale input back to full scale + const float fMakeupDb = -fThreshDb * ( 1.0f - 1.0f / fRatio ); + + for ( int i = 0; i < iNumFrames; i++ ) + { + // peak detector over all channels of the lane + float fLevel = fabsf ( ppfChannels[0][i] ); + + for ( int c = 1; c < iNumChannels; c++ ) + { + fLevel = std::max ( fLevel, fabsf ( ppfChannels[c][i] ) ); + } + + // level detection in the log domain + const float fLevelDb = fLinToDbFact * logf ( std::max ( fLevel, fMinDetectorLevel ) ); + const float fOvershootDb = fLevelDb - fThreshDb; + + // static characteristic with soft knee + float fTargetGrDb; + + if ( 2.0f * fOvershootDb < -FX_COMP_KNEE_DB ) + { + // below the knee: no compression + fTargetGrDb = 0.0f; + } + else if ( 2.0f * fOvershootDb > FX_COMP_KNEE_DB ) + { + // above the knee: full ratio + fTargetGrDb = fOvershootDb * fSlope; + } + else + { + // inside the knee: quadratic transition + const float fKneePos = fOvershootDb + FX_COMP_KNEE_DB / 2; + + fTargetGrDb = fSlope * fKneePos * fKneePos / ( 2.0f * FX_COMP_KNEE_DB ); + } + + // smoothing: attack if the gain reduction increases, release otherwise + if ( fTargetGrDb < fGainReductionDb ) + { + fGainReductionDb = fAttackCoef * fGainReductionDb + ( 1.0f - fAttackCoef ) * fTargetGrDb; + } + else + { + fGainReductionDb = fReleaseCoef * fGainReductionDb + ( 1.0f - fReleaseCoef ) * fTargetGrDb; + } + + // flush to zero: the release decays towards zero and would end up in + // denormal numbers, which are very slow on many CPUs (real-time safety) + if ( fGainReductionDb > -1e-6f ) + { + fGainReductionDb = 0.0f; + } + + const float fGain = DbToLin ( fGainReductionDb + fMakeupDb ); + + for ( int c = 0; c < iNumChannels; c++ ) + { + ppfChannels[c][i] *= fGain; + } + } +} diff --git a/src/plugins/audiocompressor.h b/src/plugins/audiocompressor.h new file mode 100644 index 0000000000..b17dbc4cfe --- /dev/null +++ b/src/plugins/audiocompressor.h @@ -0,0 +1,78 @@ +/******************************************************************************\ + * Copyright (c) 2026 + * + * Author(s): + * Serhii Popov (uazure@gmail.com) + * + ****************************************************************************** + * + * 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., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * +\******************************************************************************/ + +/* + Feed-forward compressor with automatic makeup gain, following + D. Giannoulis, M. Massberg, J. D. Reiss, "Digital Dynamic Range Compressor + Design - A Tutorial and Analysis", J. Audio Eng. Soc., Vol. 60, No. 6, 2012: + soft-knee static curve in the log domain, followed by a smoothed gain + reduction with separate attack and release time constants. There is no + look-ahead, so no latency is added. A two channel lane uses one common + detector so that the stereo image does not shift. +*/ + +#pragma once + +#include "inputeffect.h" + +/* Definitions ****************************************************************/ +// selectable ratios (index into the table) +#define FX_COMP_NUM_RATIOS 3 +#define FX_COMP_RATIO_IDX_DEFAULT 0 // 2:1 + +#define FX_COMP_THRESHOLD_DB_MIN ( -40 ) +#define FX_COMP_THRESHOLD_DB_MAX 0 +#define FX_COMP_THRESHOLD_DB_DEFAULT ( -20 ) + +// fixed (not configurable) dynamics parameters +#define FX_COMP_ATTACK_S 0.005f +#define FX_COMP_RELEASE_S 0.1f +#define FX_COMP_KNEE_DB 6.0f + +/* Classes ********************************************************************/ +class CAudioCompressor : public CInputEffect +{ +public: + CAudioCompressor(); + + void SetRatioIdx ( const int iNewIdx ); + int GetRatioIdx() const { return iRatioIdx; } + void SetThresholdDb ( const float fNewThresholdDb ); + float GetThresholdDb() const { return fThresholdDb; } + + static float GetRatio ( const int iIdx ); + + // the compressor has no block buffer, therefore iMaxFrames is not needed + virtual void Activate ( const int iNNumChannels, const int /* iMaxFrames */ ) override; + virtual void Reset() override; + virtual void Process ( float* const* ppfChannels, const int iNumFrames ) override; + +protected: + int iNumChannels; + std::atomic iRatioIdx; + std::atomic fThresholdDb; + float fAttackCoef; + float fReleaseCoef; + float fGainReductionDb; // smoothed envelope, audio thread only +}; diff --git a/src/plugins/audioreverb.cpp b/src/plugins/audioreverb.cpp index a10c415bb8..62c89bacd0 100644 --- a/src/plugins/audioreverb.cpp +++ b/src/plugins/audioreverb.cpp @@ -16,11 +16,21 @@ #include "audioreverb.h" -void CAudioReverb::Init ( const EAudChanConf eNAudioChannelConf, const int iNStereoBlockSizeSam, const int iSampleRate, const float fT60 ) +void CAudioReverb::SetLevel ( const int iNewLevel ) +{ + if ( ( iNewLevel >= 0 ) && ( iNewLevel <= AUD_REVERB_MAX ) ) + { + iLevel = iNewLevel; + } +} + +void CAudioReverb::Activate ( const int iNNumChannels, const int /* iMaxFrames */ ) { // store parameters - eAudioChannelConf = eNAudioChannelConf; - iStereoBlockSizeSam = iNStereoBlockSizeSam; + iNumChannels = iNNumChannels; + + const int iSampleRate = SYSTEM_SAMPLE_RATE_HZ; + const float fT60 = 1.1f; // reverberation decay time in seconds // delay lengths for 44100 Hz sample rate int lengths[9] = { 1116, 1356, 1422, 1617, 225, 341, 441, 211, 179 }; @@ -61,7 +71,7 @@ void CAudioReverb::Init ( const EAudChanConf eNAudioChannelConf, const int iNSte outLeftDelay.Init ( lengths[7] ); outRightDelay.Init ( lengths[8] ); allpassCoefficient = 0.7f; - Clear(); + Reset(); } bool CAudioReverb::isPrime ( const int number ) @@ -93,7 +103,7 @@ bool CAudioReverb::isPrime ( const int number ) } } -void CAudioReverb::Clear() +void CAudioReverb::Reset() { // reset and clear all internal state allpassDelays[0].Reset ( 0 ); @@ -135,28 +145,31 @@ float CAudioReverb::COnePole::Calc ( const float fIn ) return fLastSample; } -void CAudioReverb::Process ( CVector& vecsStereoInOut, const bool bReverbOnLeftChan, const float fAttenuation ) +void CAudioReverb::Process ( float* const* ppfChannels, const int iNumFrames ) { + // the level is read once per block; 0 means no reverberation + const int iCurLevel = iLevel; + + if ( iCurLevel == 0 ) + { + return; + } + + const float fAttenuation = static_cast ( iCurLevel ) / AUD_REVERB_MAX / 4; + float fMixedInput, temp, temp0, temp1, temp2; - for ( int i = 0; i < iStereoBlockSizeSam; i += 2 ) + for ( int i = 0; i < iNumFrames; i++ ) { - // we sum up the stereo input channels (in case mono input is used, a zero - // shall be input for the right channel) - if ( eAudioChannelConf == CC_STEREO ) + // we sum up the channels of the lane (both channels in stereo mode, + // only the own channel in the mono modes) + if ( iNumChannels == 2 ) { - fMixedInput = 0.5f * ( vecsStereoInOut[i] + vecsStereoInOut[i + 1] ); + fMixedInput = 0.5f * ( ppfChannels[0][i] + ppfChannels[1][i] ); } else { - if ( bReverbOnLeftChan ) - { - fMixedInput = vecsStereoInOut[i]; - } - else - { - fMixedInput = vecsStereoInOut[i + 1]; - } + fMixedInput = ppfChannels[0][i]; } temp = allpassDelays[0].Get(); @@ -192,16 +205,17 @@ void CAudioReverb::Process ( CVector& vecsStereoInOut, const bool bReve outLeftDelay.Add ( filtout ); outRightDelay.Add ( filtout ); - // inplace apply the attenuated reverb signal (for stereo always apply - // reverberation effect on both channels) - if ( ( eAudioChannelConf == CC_STEREO ) || bReverbOnLeftChan ) + // inplace apply the attenuated reverb signal to all channels of the lane + ppfChannels[0][i] = ( 1.0f - fAttenuation ) * ppfChannels[0][i] + 0.5f * fAttenuation * outLeftDelay.Get(); + + if ( iNumChannels == 2 ) { - vecsStereoInOut[i] = Float2Short ( ( 1.0f - fAttenuation ) * vecsStereoInOut[i] + 0.5f * fAttenuation * outLeftDelay.Get() ); + ppfChannels[1][i] = ( 1.0f - fAttenuation ) * ppfChannels[1][i] + 0.5f * fAttenuation * outRightDelay.Get(); } - - if ( ( eAudioChannelConf == CC_STEREO ) || !bReverbOnLeftChan ) + else { - vecsStereoInOut[i + 1] = Float2Short ( ( 1.0f - fAttenuation ) * vecsStereoInOut[i + 1] + 0.5f * fAttenuation * outRightDelay.Get() ); + // keep the second decorrelation delay line running + outRightDelay.Get(); } } } \ No newline at end of file diff --git a/src/plugins/audioreverb.h b/src/plugins/audioreverb.h index a5da6fac61..af918c8c14 100644 --- a/src/plugins/audioreverb.h +++ b/src/plugins/audioreverb.h @@ -16,16 +16,26 @@ #pragma once #include "util.h" +#include "inputeffect.h" -class CAudioReverb +/* Definitions ****************************************************************/ +#define AUD_REVERB_MAX 100 +#define AUD_REVERB_DEFAULT 30 + +/* Classes ********************************************************************/ +class CAudioReverb : public CInputEffect { public: - CAudioReverb() {} + CAudioReverb() : iNumChannels ( 1 ), iLevel ( AUD_REVERB_DEFAULT ) {} - void Init ( const EAudChanConf eNAudioChannelConf, const int iNStereoBlockSizeSam, const int iSampleRate, const float fT60 = 1.1f ); + // reverberation level in the range 0 .. AUD_REVERB_MAX + void SetLevel ( const int iNewLevel ); + int GetLevel() const { return iLevel; } - void Clear(); - void Process ( CVector& vecsStereoInOut, const bool bReverbOnLeftChan, const float fAttenuation ); + // the delay lines are sized by the decay time, iMaxFrames is not needed + virtual void Activate ( const int iNNumChannels, const int /* iMaxFrames */ ) override; + virtual void Reset() override; + virtual void Process ( float* const* ppfChannels, const int iNumFrames ) override; protected: void setT60 ( const float fT60, const int iSampleRate ); @@ -45,13 +55,13 @@ class CAudioReverb float fLastSample; }; - EAudChanConf eAudioChannelConf; - int iStereoBlockSizeSam; - CFIFO allpassDelays[3]; - CFIFO combDelays[4]; - COnePole combFilters[4]; - CFIFO outLeftDelay; - CFIFO outRightDelay; - float allpassCoefficient; - float combCoefficient[4]; + int iNumChannels; + std::atomic iLevel; + CFIFO allpassDelays[3]; + CFIFO combDelays[4]; + COnePole combFilters[4]; + CFIFO outLeftDelay; + CFIFO outRightDelay; + float allpassCoefficient; + float combCoefficient[4]; }; diff --git a/src/plugins/inputboost.cpp b/src/plugins/inputboost.cpp new file mode 100644 index 0000000000..20f3a51631 --- /dev/null +++ b/src/plugins/inputboost.cpp @@ -0,0 +1,76 @@ +/******************************************************************************\ + * Copyright (c) 2026 + * + * Author(s): + * Serhii Popov (uazure@gmail.com) + * + ****************************************************************************** + * + * 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., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * +\******************************************************************************/ + +#include +#include "inputboost.h" + +void CInputBoost::SetGainDb ( const float fNewGainDb ) +{ + float fClipped = fNewGainDb; + + if ( fClipped < 0.0f ) + { + fClipped = 0.0f; + } + + if ( fClipped > FX_BOOST_DB_MAX ) + { + fClipped = FX_BOOST_DB_MAX; + } + + fGainDb = fClipped; + fGain = powf ( 10.0f, fClipped / 20.0f ); +} + +void CInputBoost::Process ( float* const* ppfChannels, const int iNumFrames ) +{ + const float fCurGain = fGain; + + if ( fCurGain == 1.0f ) + { + return; + } + + for ( int c = 0; c < iNumChannels; c++ ) + { + float* pfChan = ppfChannels[c]; + + for ( int i = 0; i < iNumFrames; i++ ) + { + // clamp to full scale (the same saturation as Float2Short does) + float fSample = fCurGain * pfChan[i]; + + if ( fSample > 1.0f ) + { + fSample = 1.0f; + } + else if ( fSample < -1.0f ) + { + fSample = -1.0f; + } + + pfChan[i] = fSample; + } + } +} diff --git a/src/plugins/inputboost.h b/src/plugins/inputboost.h new file mode 100644 index 0000000000..87e5a6e3c3 --- /dev/null +++ b/src/plugins/inputboost.h @@ -0,0 +1,53 @@ +/******************************************************************************\ + * Copyright (c) 2026 + * + * Author(s): + * Serhii Popov (uazure@gmail.com) + * + ****************************************************************************** + * + * 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., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * +\******************************************************************************/ + +#pragma once + +#include "inputeffect.h" + +/* Definitions ****************************************************************/ +#define FX_BOOST_DB_MAX 24 +#define FX_BOOST_DB_DEFAULT 6 + +/* Classes ********************************************************************/ +// Input boost: a plain gain in dB. The output is clamped to full scale. +class CInputBoost : public CInputEffect +{ +public: + CInputBoost() : iNumChannels ( 1 ), fGainDb ( 0.0f ), fGain ( 1.0f ) { SetGainDb ( FX_BOOST_DB_DEFAULT ); } + + // gain in dB in the range 0 .. FX_BOOST_DB_MAX + void SetGainDb ( const float fNewGainDb ); + float GetGainDb() const { return fGainDb; } + + // the boost has no block buffer, therefore iMaxFrames is not needed + virtual void Activate ( const int iNNumChannels, const int /* iMaxFrames */ ) override { iNumChannels = iNNumChannels; } + virtual void Reset() override {} + virtual void Process ( float* const* ppfChannels, const int iNumFrames ) override; + +protected: + int iNumChannels; + std::atomic fGainDb; + std::atomic fGain; +}; diff --git a/src/plugins/inputeffect.h b/src/plugins/inputeffect.h new file mode 100644 index 0000000000..ae65717af7 --- /dev/null +++ b/src/plugins/inputeffect.h @@ -0,0 +1,68 @@ +/******************************************************************************\ + * Copyright (c) 2026 + * + * Author(s): + * Serhii Popov (uazure@gmail.com) + * + ****************************************************************************** + * + * 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., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * +\******************************************************************************/ + +/* + Interface of one local input effect. + + An effect processes one "lane": one channel (left or right input in the + mono modes) or two channels (stereo mode). The audio is planar float with + full scale 1.0, which is also the audio port format of CLAP, so a future + plugin host can be plugged in as another CInputEffect. + + Parameters are set from the GUI thread and read from the audio thread, + therefore they are stored in std::atomic members. +*/ + +#pragma once + +#include + +/* Definitions ****************************************************************/ +// maximum number of channels in one lane +#define MAX_FX_CHANNELS 2 + +/* Classes ********************************************************************/ +class CInputEffect +{ +public: + CInputEffect() : bEnabled ( false ) {} // all effects are off by default + virtual ~CInputEffect() {} + + // called with the sound card stopped, may allocate memory + virtual void Activate ( const int iNumChannels, const int iMaxFrames ) = 0; + + // real-time safe: clear delay lines, envelopes etc., keep the parameters + virtual void Reset() = 0; + + // real-time safe, in place processing: ppfChannels holds iNumChannels (as + // given to Activate) pointers to iNumFrames samples each + virtual void Process ( float* const* ppfChannels, const int iNumFrames ) = 0; + + // switched on/off by the user + void SetEnabled ( const bool bNewEnabled ) { bEnabled = bNewEnabled; } + bool IsEnabled() const { return bEnabled; } + +protected: + std::atomic bEnabled; +}; diff --git a/src/plugins/inputeffectchain.cpp b/src/plugins/inputeffectchain.cpp new file mode 100644 index 0000000000..19bad42965 --- /dev/null +++ b/src/plugins/inputeffectchain.cpp @@ -0,0 +1,153 @@ +/******************************************************************************\ + * Copyright (c) 2026 + * + * Author(s): + * Serhii Popov (uazure@gmail.com) + * + ****************************************************************************** + * + * 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., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * +\******************************************************************************/ + +#include "inputeffectchain.h" + +CInputEffectChain::CInputEffectChain() : iNumLanes ( 2 ), iNumChannelsPerLane ( 1 ), iMonoBlockSizeSam ( 0 ), iNumEffectsPerLane ( 0 ) +{ + for ( int iLane = 0; iLane < MAX_FX_LANES; iLane++ ) + { + for ( int iEff = 0; iEff < MAX_FX_EFFECTS_LANE; iEff++ ) + { + apEffects[iLane][iEff] = nullptr; + abWasEnabled[iLane][iEff] = false; + } + } +} + +void CInputEffectChain::Init ( const EAudChanConf eNAudioChannelConf, const int iNMonoBlockSizeSam ) +{ + // in stereo mode both channels form one source which is processed by one + // lane, in the mono modes each input channel has its own lane + if ( eNAudioChannelConf == CC_STEREO ) + { + iNumLanes = 1; + iNumChannelsPerLane = 2; + } + else + { + iNumLanes = 2; + iNumChannelsPerLane = 1; + } + + iMonoBlockSizeSam = iNMonoBlockSizeSam; + + for ( int c = 0; c < MAX_FX_CHANNELS; c++ ) + { + vecfChan[c].Init ( iMonoBlockSizeSam, 0.0f ); + } + +#ifndef NO_INTERNAL_EFFECTS + iNumEffectsPerLane = 3; + + for ( int iLane = 0; iLane < MAX_FX_LANES; iLane++ ) + { + apEffects[iLane][0] = &Boost_[iLane]; + apEffects[iLane][1] = &Compressor_[iLane]; + apEffects[iLane][2] = &Reverb_[iLane]; + } +#else + iNumEffectsPerLane = 0; +#endif + + for ( int iLane = 0; iLane < iNumLanes; iLane++ ) + { + for ( int iEff = 0; iEff < iNumEffectsPerLane; iEff++ ) + { + apEffects[iLane][iEff]->Activate ( iNumChannelsPerLane, iMonoBlockSizeSam ); + apEffects[iLane][iEff]->Reset(); + abWasEnabled[iLane][iEff] = false; + } + } +} + +bool CInputEffectChain::IsAnyEnabled() const +{ + for ( int iLane = 0; iLane < iNumLanes; iLane++ ) + { + for ( int iEff = 0; iEff < iNumEffectsPerLane; iEff++ ) + { + if ( apEffects[iLane][iEff]->IsEnabled() || abWasEnabled[iLane][iEff] ) + { + return true; + } + } + } + + return false; +} + +void CInputEffectChain::Process ( CVector& vecsStereoInOut ) +{ + // nothing to do if no effect is (or just was) enabled: keep the fast path + if ( !IsAnyEnabled() ) + { + return; + } + + const float fToFloat = 1.0f / 32768.0f; + + // de-interleave to planar float, full scale 1.0 + for ( int i = 0, j = 0; i < iMonoBlockSizeSam; i++, j += 2 ) + { + vecfChan[0][i] = fToFloat * vecsStereoInOut[j]; + vecfChan[1][i] = fToFloat * vecsStereoInOut[j + 1]; + } + + for ( int iLane = 0; iLane < iNumLanes; iLane++ ) + { + // channel pointers of this lane: a mono lane sees only its own input + // channel (left for lane 0, right for lane 1), the stereo lane (always + // lane 0) sees both + float* apfLane[MAX_FX_CHANNELS]; + apfLane[0] = &vecfChan[iLane][0]; + apfLane[1] = &vecfChan[1][0]; // only used by the stereo lane + + for ( int iEff = 0; iEff < iNumEffectsPerLane; iEff++ ) + { + CInputEffect* pEffect = apEffects[iLane][iEff]; + const bool bEnabled = pEffect->IsEnabled(); + + if ( bEnabled ) + { + pEffect->Process ( apfLane, iMonoBlockSizeSam ); + } + else if ( abWasEnabled[iLane][iEff] ) + { + // just switched off: clear the state so that nothing stale is + // heard when it is switched on again + pEffect->Reset(); + } + + abWasEnabled[iLane][iEff] = bEnabled; + } + } + + // back to interleaved int16 + for ( int i = 0, j = 0; i < iMonoBlockSizeSam; i++, j += 2 ) + { + vecsStereoInOut[j] = Float2Short ( vecfChan[0][i] * 32768.0f ); + vecsStereoInOut[j + 1] = Float2Short ( vecfChan[1][i] * 32768.0f ); + } +} diff --git a/src/plugins/inputeffectchain.h b/src/plugins/inputeffectchain.h new file mode 100644 index 0000000000..4e680d862e --- /dev/null +++ b/src/plugins/inputeffectchain.h @@ -0,0 +1,87 @@ +/******************************************************************************\ + * Copyright (c) 2026 + * + * Author(s): + * Serhii Popov (uazure@gmail.com) + * + ****************************************************************************** + * + * 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., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * +\******************************************************************************/ + +/* + Chain of local input effects, applied to the sound card input before the + signal is sent to the server. + + The interleaved stereo sound card block is converted once to planar float + and back. In stereo mode there is one lane with two channels, in the mono + modes there are two lanes (left and right input) with one channel each. + Each lane runs the effects in this fixed order: boost, compressor, reverb. + + With NO_INTERNAL_EFFECTS defined (qmake CONFIG+=nointernaleffects) the + chain is empty; the parameter accessors are not available. +*/ + +#pragma once + +#include "util.h" +#include "inputeffect.h" +#include "inputboost.h" +#include "audiocompressor.h" +#include "audioreverb.h" + +/* Definitions ****************************************************************/ +#define MAX_FX_LANES 2 +#define MAX_FX_EFFECTS_LANE 3 + +/* Classes ********************************************************************/ +class CInputEffectChain +{ +public: + CInputEffectChain(); + + // called with the sound card stopped: allocates the buffers and activates + // the effects for the given channel configuration + void Init ( const EAudChanConf eNAudioChannelConf, const int iNMonoBlockSizeSam ); + + // real-time safe: in place processing of an interleaved stereo block of + // iMonoBlockSizeSam frames + void Process ( CVector& vecsStereoInOut ); + + // real-time safe + bool IsAnyEnabled() const; + +#ifndef NO_INTERNAL_EFFECTS + CInputBoost& Boost ( const int iLane ) { return Boost_[iLane]; } + CAudioCompressor& Compressor ( const int iLane ) { return Compressor_[iLane]; } + CAudioReverb& Reverb ( const int iLane ) { return Reverb_[iLane]; } +#endif + +protected: + int iNumLanes; // 1 for stereo, else 2 + int iNumChannelsPerLane; // 2 for stereo, else 1 + int iMonoBlockSizeSam; + int iNumEffectsPerLane; + CVector vecfChan[MAX_FX_CHANNELS]; // planar buffers: left, right + CInputEffect* apEffects[MAX_FX_LANES][MAX_FX_EFFECTS_LANE]; + bool abWasEnabled[MAX_FX_LANES][MAX_FX_EFFECTS_LANE]; + +#ifndef NO_INTERNAL_EFFECTS + CInputBoost Boost_[MAX_FX_LANES]; + CAudioCompressor Compressor_[MAX_FX_LANES]; + CAudioReverb Reverb_[MAX_FX_LANES]; +#endif +}; diff --git a/src/settings.cpp b/src/settings.cpp index dc725c1b76..484ad1aed5 100644 --- a/src/settings.cpp +++ b/src/settings.cpp @@ -44,6 +44,7 @@ * \******************************************************************************/ +#include #include "settings.h" /* Implementation *************************************************************/ @@ -415,12 +416,6 @@ void CClientSettings::ReadSettingsFromXML ( const QDomDocument& IniXMLDocument, iNewClientFaderLevel = iValue; } - // input boost - if ( GetNumericIniSet ( IniXMLDocument, "client", "inputboost", 1, 10, iValue ) ) - { - iInputBoost = iValue; - } - if ( GetFlagIniSet ( IniXMLDocument, "client", "enablefeedbackdetection", bValue ) ) { bEnableFeedbackDetection = bValue; @@ -496,17 +491,98 @@ void CClientSettings::ReadSettingsFromXML ( const QDomDocument& IniXMLDocument, pClient->SetAudioInFader ( iValue ); } - // reverberation level - if ( GetNumericIniSet ( IniXMLDocument, "client", "revlev", 0, AUD_REVERB_MAX, iValue ) ) + // input effects + if ( GetFlagIniSet ( IniXMLDocument, "client", "fxlinked", bValue ) ) { - pClient->SetReverbLevel ( iValue ); + bInputEffectsLinked = bValue; } - // reverberation channel assignment - if ( GetFlagIniSet ( IniXMLDocument, "client", "reverblchan", bValue ) ) +# ifndef NO_INTERNAL_EFFECTS + CInputEffectChain& Fx = pClient->GetInputEffects(); + + if ( GetIniSetting ( IniXMLDocument, "client", "fxrevlev0" ).isEmpty() ) + { + // settings written by a version without the input effects window: take + // over the old input boost and reverberation settings so that the + // sound stays the same after the update + if ( GetNumericIniSet ( IniXMLDocument, "client", "inputboost", 2, 10, iValue ) ) + { + const float fBoostDb = static_cast ( qRound ( 20.0 * log10 ( static_cast ( iValue ) ) ) ); + + for ( int iLane = 0; iLane < MAX_FX_LANES; iLane++ ) + { + Fx.Boost ( iLane ).SetEnabled ( true ); + Fx.Boost ( iLane ).SetGainDb ( fBoostDb ); + } + } + + if ( GetNumericIniSet ( IniXMLDocument, "client", "revlev", 1, AUD_REVERB_MAX, iValue ) ) + { + // the reverb was applied to both channels in stereo mode, otherwise + // to one channel only (the right one by default) + int iAudioChannels = 0; + bool bReverbOnLeftChan = false; + GetNumericIniSet ( IniXMLDocument, "client", "audiochannels", 0, 2 /* CC_STEREO */, iAudioChannels ); + GetFlagIniSet ( IniXMLDocument, "client", "reverblchan", bReverbOnLeftChan ); + + const bool bStereo = ( iAudioChannels == static_cast ( CC_STEREO ) ); + const int iLane = ( bStereo || bReverbOnLeftChan ) ? 0 : 1; + + Fx.Reverb ( iLane ).SetEnabled ( true ); + Fx.Reverb ( iLane ).SetLevel ( iValue ); + + if ( !bStereo ) + { + bInputEffectsLinked = false; + } + } + } + else { - pClient->SetReverbOnLeftChan ( bValue ); + for ( int iLane = 0; iLane < MAX_FX_LANES; iLane++ ) + { + if ( GetFlagIniSet ( IniXMLDocument, "client", QString ( "fxbooston%1" ).arg ( iLane ), bValue ) ) + { + Fx.Boost ( iLane ).SetEnabled ( bValue ); + } + + if ( GetNumericIniSet ( IniXMLDocument, "client", QString ( "fxboostdb%1" ).arg ( iLane ), 0, FX_BOOST_DB_MAX, iValue ) ) + { + Fx.Boost ( iLane ).SetGainDb ( static_cast ( iValue ) ); + } + + if ( GetFlagIniSet ( IniXMLDocument, "client", QString ( "fxcompon%1" ).arg ( iLane ), bValue ) ) + { + Fx.Compressor ( iLane ).SetEnabled ( bValue ); + } + + if ( GetNumericIniSet ( IniXMLDocument, "client", QString ( "fxcompratio%1" ).arg ( iLane ), 0, FX_COMP_NUM_RATIOS - 1, iValue ) ) + { + Fx.Compressor ( iLane ).SetRatioIdx ( iValue ); + } + + if ( GetNumericIniSet ( IniXMLDocument, + "client", + QString ( "fxcompthresh%1" ).arg ( iLane ), + FX_COMP_THRESHOLD_DB_MIN, + FX_COMP_THRESHOLD_DB_MAX, + iValue ) ) + { + Fx.Compressor ( iLane ).SetThresholdDb ( static_cast ( iValue ) ); + } + + if ( GetFlagIniSet ( IniXMLDocument, "client", QString ( "fxrevon%1" ).arg ( iLane ), bValue ) ) + { + Fx.Reverb ( iLane ).SetEnabled ( bValue ); + } + + if ( GetNumericIniSet ( IniXMLDocument, "client", QString ( "fxrevlev%1" ).arg ( iLane ), 0, AUD_REVERB_MAX, iValue ) ) + { + Fx.Reverb ( iLane ).SetLevel ( iValue ); + } + } } +# endif // sound card selection const QString strError = pClient->SetSndCrdDev ( FromBase64ToString ( GetIniSetting ( IniXMLDocument, "client", "auddev_base64", "" ) ) ); @@ -805,6 +881,9 @@ void CClientSettings::ReadSettingsFromXML ( const QDomDocument& IniXMLDocument, // window position of the connect window vecWindowPosConnect = FromBase64ToByteArray ( GetIniSetting ( IniXMLDocument, "client", "winposcon_base64" ) ); + // window position of the input effects window + vecWindowPosInputFx = FromBase64ToByteArray ( GetIniSetting ( IniXMLDocument, "client", "winposfx_base64" ) ); + // visibility state of the settings window if ( GetFlagIniSet ( IniXMLDocument, "client", "winvisset", bValue ) ) { @@ -823,6 +902,12 @@ void CClientSettings::ReadSettingsFromXML ( const QDomDocument& IniXMLDocument, bWindowWasShownConnect = bValue; } + // visibility state of the input effects window + if ( GetFlagIniSet ( IniXMLDocument, "client", "winvisfx", bValue ) ) + { + bWindowWasShownInputFx = bValue; + } + // selected Settings Tab if ( GetNumericIniSet ( IniXMLDocument, "client", "settingstab", 0, 3, iValue ) ) { @@ -903,9 +988,6 @@ void CClientSettings::WriteSettingsToXML ( QDomDocument& IniXMLDocument, bool is // new client level SetNumericIniSet ( IniXMLDocument, "client", "newclientlevel", iNewClientFaderLevel ); - // input boost - SetNumericIniSet ( IniXMLDocument, "client", "inputboost", iInputBoost ); - // feedback detection SetFlagIniSet ( IniXMLDocument, "client", "enablefeedbackdetection", bEnableFeedbackDetection ); @@ -945,11 +1027,26 @@ void CClientSettings::WriteSettingsToXML ( QDomDocument& IniXMLDocument, bool is // audio fader SetNumericIniSet ( IniXMLDocument, "client", "audfad", pClient->GetAudioInFader() ); - // reverberation level - SetNumericIniSet ( IniXMLDocument, "client", "revlev", pClient->GetReverbLevel() ); + // input effects + SetFlagIniSet ( IniXMLDocument, "client", "fxlinked", bInputEffectsLinked ); - // reverberation channel assignment - SetFlagIniSet ( IniXMLDocument, "client", "reverblchan", pClient->IsReverbOnLeftChan() ); +# ifndef NO_INTERNAL_EFFECTS + CInputEffectChain& Fx = pClient->GetInputEffects(); + + for ( int iLane = 0; iLane < MAX_FX_LANES; iLane++ ) + { + SetFlagIniSet ( IniXMLDocument, "client", QString ( "fxbooston%1" ).arg ( iLane ), Fx.Boost ( iLane ).IsEnabled() ); + SetNumericIniSet ( IniXMLDocument, "client", QString ( "fxboostdb%1" ).arg ( iLane ), qRound ( Fx.Boost ( iLane ).GetGainDb() ) ); + SetFlagIniSet ( IniXMLDocument, "client", QString ( "fxcompon%1" ).arg ( iLane ), Fx.Compressor ( iLane ).IsEnabled() ); + SetNumericIniSet ( IniXMLDocument, "client", QString ( "fxcompratio%1" ).arg ( iLane ), Fx.Compressor ( iLane ).GetRatioIdx() ); + SetNumericIniSet ( IniXMLDocument, + "client", + QString ( "fxcompthresh%1" ).arg ( iLane ), + qRound ( Fx.Compressor ( iLane ).GetThresholdDb() ) ); + SetFlagIniSet ( IniXMLDocument, "client", QString ( "fxrevon%1" ).arg ( iLane ), Fx.Reverb ( iLane ).IsEnabled() ); + SetNumericIniSet ( IniXMLDocument, "client", QString ( "fxrevlev%1" ).arg ( iLane ), Fx.Reverb ( iLane ).GetLevel() ); + } +# endif // sound card selection PutIniSetting ( IniXMLDocument, "client", "auddev_base64", ToBase64 ( pClient->GetSndCrdDev() ) ); @@ -1017,6 +1114,9 @@ void CClientSettings::WriteSettingsToXML ( QDomDocument& IniXMLDocument, bool is // window position of the connect window PutIniSetting ( IniXMLDocument, "client", "winposcon_base64", ToBase64 ( vecWindowPosConnect ) ); + // window position of the input effects window + PutIniSetting ( IniXMLDocument, "client", "winposfx_base64", ToBase64 ( vecWindowPosInputFx ) ); + // visibility state of the settings window SetFlagIniSet ( IniXMLDocument, "client", "winvisset", bWindowWasShownSettings ); @@ -1026,6 +1126,9 @@ void CClientSettings::WriteSettingsToXML ( QDomDocument& IniXMLDocument, bool is // visibility state of the connect window SetFlagIniSet ( IniXMLDocument, "client", "winviscon", bWindowWasShownConnect ); + // visibility state of the input effects window + SetFlagIniSet ( IniXMLDocument, "client", "winvisfx", bWindowWasShownInputFx ); + // Settings Tab SetNumericIniSet ( IniXMLDocument, "client", "settingstab", iSettingsTab ); diff --git a/src/settings.h b/src/settings.h index 4086a217fa..9656271359 100644 --- a/src/settings.h +++ b/src/settings.h @@ -170,7 +170,6 @@ class CClientSettings : public CSettings vecStoredFaderGroupID ( MAX_NUM_STORED_FADER_SETTINGS, INVALID_INDEX ), vstrIPAddress ( MAX_NUM_SERVER_ADDR_ITEMS, "" ), iNewClientFaderLevel ( 100 ), - iInputBoost ( 1 ), iSettingsTab ( SETTING_TAB_AUDIONET ), bConnectDlgShowAllMusicians ( true ), eChannelSortType ( ST_NO_SORT ), @@ -179,12 +178,15 @@ class CClientSettings : public CSettings eDirectoryType ( AT_DEFAULT ), bEnableFeedbackDetection ( true ), bEnableAudioAlerts ( false ), + bInputEffectsLinked ( true ), vecWindowPosSettings(), // empty array vecWindowPosChat(), // empty array vecWindowPosConnect(), // empty array + vecWindowPosInputFx(), // empty array bWindowWasShownSettings ( false ), bWindowWasShownChat ( false ), bWindowWasShownConnect ( false ), + bWindowWasShownInputFx ( false ), bOwnFaderFirst ( false ), iMidiChannel ( 0 ), iMidiMuteMyself ( 0 ), @@ -242,7 +244,6 @@ class CClientSettings : public CSettings CVector vecStoredFaderGroupID; CVector vstrIPAddress; int iNewClientFaderLevel; - int iInputBoost; int iSettingsTab; bool bConnectDlgShowAllMusicians; EChSortType eChannelSortType; @@ -252,14 +253,17 @@ class CClientSettings : public CSettings int iCustomDirectoryIndex; // index of selected custom directory bool bEnableFeedbackDetection; bool bEnableAudioAlerts; + bool bInputEffectsLinked; // same input effect settings for left and right // window position/state settings QByteArray vecWindowPosSettings; QByteArray vecWindowPosChat; QByteArray vecWindowPosConnect; + QByteArray vecWindowPosInputFx; bool bWindowWasShownSettings; bool bWindowWasShownChat; bool bWindowWasShownConnect; + bool bWindowWasShownInputFx; bool bOwnFaderFirst; // MIDI settings