@@ -155,8 +155,8 @@ MainWindow::MainWindow(bool statupInTray,
155155 onConvolverInfoChanged (ciArgs);
156156 connect (_audioService, &IAudioService::convolverInfoChanged, this , &MainWindow::onConvolverInfoChanged);
157157
158- _eelEditor->attachHost (_audioService);
159- connect (_eelEditor, &EELEditor::executionRequested, [this ](QString path){
158+ _eelEditor->attachHost (_audioService);
159+ connect (_eelEditor, &EELEditor::executionRequested, [this ](QString path){
160160 if (QFileInfo::exists (path) && QFileInfo (path).isFile ())
161161 {
162162 ui->liveprog ->setCurrentLiveprog (path);
@@ -319,6 +319,7 @@ MainWindow::MainWindow(bool statupInTray,
319319 {
320320 _styleHelper->SetStyle ();
321321 ui->eq_widget ->setAccentColor (palette ().highlight ().color ());
322+ ui->comp_response ->setAccentColor (palette ().highlight ().color ());
322323 }
323324
324325 // Extract default EEL files if missing
@@ -379,6 +380,7 @@ MainWindow::MainWindow(bool statupInTray,
379380 ui->tabhost ->setStyleSheet (QString (" QWidget#tabHostPage1,QWidget#tabHostPage2,QWidget#tabHostPage3,QWidget#tabHostPage4,QWidget#tabHostPage5,QWidget#tabHostPage6,QWidget#tabHostPage7{background-color: %1;}" ).arg (qApp->palette ().window ().color ().lighter ().name ()));
380381 ui->tabbar ->redrawTabBar ();
381382 ui->eq_widget ->setAccentColor (palette ().highlight ().color ());
383+ ui->comp_response ->setAccentColor (palette ().highlight ().color ());
382384 });
383385
384386 connect (&AppConfig::instance (), &AppConfig::updated, this , &MainWindow::onAppConfigUpdated);
@@ -388,6 +390,7 @@ MainWindow::MainWindow(bool statupInTray,
388390 {
389391 restoreGraphicEQView ();
390392 ui->eq_widget ->setAlwaysDrawHandles (AppConfig::instance ().get <bool >(AppConfig::EqualizerShowHandles));
393+ ui->comp_response ->setAlwaysDrawHandles (AppConfig::instance ().get <bool >(AppConfig::EqualizerShowHandles));
391394
392395 ui->tabbar ->setAnimatePageChange (true );
393396 ui->tabbar ->setCustomStackWidget (ui->tabhost );
@@ -525,14 +528,15 @@ void MainWindow::onAppConfigUpdated(const AppConfig::Key &key, const QVariant &v
525528{
526529 switch (key)
527530 {
528- case AppConfig::EqualizerShowHandles:
529- ui->eq_widget ->setAlwaysDrawHandles (value.toBool ());
530- break ;
531- case AppConfig::TrayIconEnabled:
532- _trayIcon->setTrayVisible (value.toBool ());
533- break ;
534- default :
535- break ;
531+ case AppConfig::EqualizerShowHandles:
532+ ui->eq_widget ->setAlwaysDrawHandles (value.toBool ());
533+ ui->comp_response ->setAlwaysDrawHandles (value.toBool ());
534+ break ;
535+ case AppConfig::TrayIconEnabled:
536+ _trayIcon->setTrayVisible (value.toBool ());
537+ break ;
538+ default :
539+ break ;
536540 }
537541}
538542
@@ -655,10 +659,49 @@ void MainWindow::loadConfig()
655659 ui->bs2b_fcut ->setValueA (DspConfig::instance ().get <int >(DspConfig::crossfeed_bs2b_fcut));
656660 ui->bs2b_custom_box ->setEnabled (bs2bMode == 99 );
657661
658- ui->enable_comp ->setChecked (DspConfig::instance ().get <bool >(DspConfig::compression_enable));
659- ui->comp_maxattack ->setValueA (DspConfig::instance ().get <int >(DspConfig::compression_maxatk));
660- ui->comp_maxrelease ->setValueA (DspConfig::instance ().get <int >(DspConfig::compression_maxrel));
661- ui->comp_aggressiveness ->setValueA (DspConfig::instance ().get <int >(DspConfig::compression_aggressiveness));
662+ ui->enable_comp ->setChecked (DspConfig::instance ().get <bool >(DspConfig::compander_enable));
663+ ui->comp_granularity ->setValueA (DspConfig::instance ().get <int >(DspConfig::compander_granularity));
664+ ui->comp_timeconstant ->setValueA (100 * DspConfig::instance ().get <float >(DspConfig::compander_timeconstant));
665+ int companderTrans = DspConfig::instance ().get <int >(DspConfig::compander_time_freq_transforms);
666+ int companderTransIdx = ui->crossfeed_mode ->findData (companderTrans);
667+ if (companderTransIdx < 0 )
668+ Log::error (QString (" Compander TF transform index for value %1 not found" ).arg (companderTrans));
669+ else
670+ ui->comp_tf_transforms ->setCurrentIndex (companderTransIdx);
671+
672+ {
673+ // Parse compander response
674+ QVector<float > rawCompanderData;
675+
676+ for (const auto &val : chopDoubleQuotes (DspConfig::instance ().get <QString>(DspConfig::compander_response)).split (" ;" ))
677+ {
678+ rawCompanderData.push_back (val.isEmpty () ? 0 .f : val.toFloat ());
679+ }
680+
681+ // TODO: This needs to be cleaned up and put into LiquidEq subproject instead
682+ int it = 7 ;
683+ bool eqReloadRequired = false ;
684+ for (auto cur_data : ui->comp_response ->getBands ())
685+ {
686+ if (it >= rawCompanderData.count ())
687+ {
688+ break ;
689+ }
690+
691+ bool equal = isApproximatelyEqual<float >(cur_data, rawCompanderData.at (it));
692+ if (eqReloadRequired == false )
693+ {
694+ eqReloadRequired = !equal;
695+ }
696+
697+ it++;
698+ }
699+
700+ if (eqReloadRequired && rawCompanderData.length () >= 14 )
701+ {
702+ ui->comp_response ->setBands (QVector<double >(rawCompanderData.cbegin () + 7 , rawCompanderData.constEnd ()), false );
703+ }
704+ }
662705
663706 ui->limthreshold ->setValueA (DspConfig::instance ().get <int >(DspConfig::master_limthreshold));
664707 ui->limrelease ->setValueA (DspConfig::instance ().get <int >(DspConfig::master_limrelease));
@@ -806,10 +849,31 @@ void MainWindow::applyConfig()
806849 DspConfig::instance ().set (DspConfig::convolver_file, QVariant (_currentImpulseResponse));
807850 DspConfig::instance ().set (DspConfig::convolver_waveform_edit, QVariant (_currentConvWaveformEdit));
808851
809- DspConfig::instance ().set (DspConfig::compression_enable, QVariant (ui->enable_comp ->isChecked ()));
810- DspConfig::instance ().set (DspConfig::compression_maxatk, QVariant (ui->comp_maxattack ->valueA ()));
811- DspConfig::instance ().set (DspConfig::compression_maxrel, QVariant (ui->comp_maxrelease ->valueA ()));
812- DspConfig::instance ().set (DspConfig::compression_aggressiveness, QVariant (ui->comp_aggressiveness ->valueA ()));
852+ DspConfig::instance ().set (DspConfig::compander_enable, QVariant (ui->enable_comp ->isChecked ()));
853+ DspConfig::instance ().set (DspConfig::compander_granularity, QVariant (ui->comp_granularity ->valueA ()));
854+ DspConfig::instance ().set (DspConfig::compander_timeconstant, QVariant (ui->comp_timeconstant ->valueA () / 100 .0f ));
855+ DspConfig::instance ().set (DspConfig::compander_time_freq_transforms, QVariant (ui->comp_tf_transforms ->currentIndex ()));
856+ // TODO: this needs to be moved into LiquidEQ subproject too
857+ {
858+ QVector<double > compBands = ui->comp_response ->getBands ();
859+ QString rawCompString = " 95.0;200.0;400.0;800.0;1600.0;3400.0;7500.0;" ;
860+ int counter = 0 ;
861+
862+ for (auto band : compBands)
863+ {
864+ rawCompString.append (QString::number (band));
865+
866+ if (counter < 6 )
867+ {
868+ rawCompString.append (' ;' );
869+ }
870+
871+ counter++;
872+ }
873+
874+ DspConfig::instance ().set (DspConfig::compander_response, QVariant (rawCompString));
875+ }
876+
813877
814878 DspConfig::instance ().set (DspConfig::tone_enable, QVariant (ui->enable_eq ->isChecked ()));
815879 DspConfig::instance ().set (DspConfig::tone_filtertype, QVariant (ui->eqfiltertype ->currentIndex ()));
@@ -961,12 +1025,13 @@ void MainWindow::installUnitData()
9611025 ui->rev_osf ->setProperty (" unit" , " x" );
9621026
9631027 QList<QAnimatedSlider*> div100 ({ui->rev_era , ui->rev_erf , ui->rev_erw , ui->rev_width , ui->rev_bass , ui->rev_spin , ui->rev_wander , ui->rev_decay ,
964- ui->analog_tubedrive });
1028+ ui->analog_tubedrive , ui-> comp_timeconstant });
9651029
9661030 QList<QAnimatedSlider*> div10 ({ui->bs2b_feed , ui->rev_delay , ui->rev_wet , ui->rev_finalwet , ui->rev_finaldry , ui->rev_width });
9671031
9681032 QList<QAnimatedSlider*> unitDecibel ({ui->bs2b_feed , ui->rev_wet , ui->rev_finalwet , ui->rev_finaldry , ui->analog_tubedrive , ui->postgain , ui->bass_maxgain });
969- QList<QAnimatedSlider*> unitMs ({ui->rev_delay , ui->comp_maxattack , ui->comp_maxrelease , ui->limrelease });
1033+ QList<QAnimatedSlider*> unitMs ({ui->rev_delay , ui->limrelease });
1034+ QList<QAnimatedSlider*> unitS ({ui->comp_timeconstant });
9701035 QList<QAnimatedSlider*> unitHz ({ui->bs2b_fcut , ui->rev_lcb , ui->rev_lcd , ui->rev_lci , ui->rev_lco });
9711036
9721037 foreach (auto w, div100)
@@ -978,8 +1043,12 @@ void MainWindow::installUnitData()
9781043 w->setProperty (" unit" , " dB" );
9791044 foreach (auto w, unitMs)
9801045 w->setProperty (" unit" , " ms" );
1046+ foreach (auto w, unitS)
1047+ w->setProperty (" unit" , " s" );
9811048 foreach (auto w, unitHz)
9821049 w->setProperty (" unit" , " Hz" );
1050+
1051+ ui->comp_granularity ->setCustomValueStrings ({tr (" Very low" ), tr (" Low" ), tr (" Medium" ), tr (" High" ), tr (" Extreme" )});
9831052}
9841053
9851054// DDC
@@ -1217,20 +1286,20 @@ void MainWindow::saveGraphicEQView()
12171286void MainWindow::connectActions ()
12181287{
12191288 QList<QAnimatedSlider*> sliders ({
1220- ui->stereowide_level , ui->bs2b_fcut , ui->bs2b_feed , ui->rev_osf , ui->rev_erf , ui->rev_era , ui->rev_erw ,
1221- ui->rev_lci , ui->rev_lcb , ui->rev_lcd , ui->rev_lco , ui->rev_finalwet , ui->rev_finaldry , ui->rev_wet , ui->rev_width , ui->rev_spin ,
1222- ui->rev_wander , ui->rev_decay , ui->rev_delay , ui->rev_bass , ui->analog_tubedrive , ui->limthreshold ,
1223- ui->limrelease , ui->comp_maxrelease , ui->comp_maxattack , ui-> comp_aggressiveness ,
1224- ui->bass_maxgain , ui->postgain
1225- });
1289+ ui->stereowide_level , ui->bs2b_fcut , ui->bs2b_feed , ui->rev_osf , ui->rev_erf , ui->rev_era , ui->rev_erw ,
1290+ ui->rev_lci , ui->rev_lcb , ui->rev_lcd , ui->rev_lco , ui->rev_finalwet , ui->rev_finaldry , ui->rev_wet , ui->rev_width , ui->rev_spin ,
1291+ ui->rev_wander , ui->rev_decay , ui->rev_delay , ui->rev_bass , ui->analog_tubedrive , ui->limthreshold ,
1292+ ui->limrelease , ui->comp_granularity , ui->comp_timeconstant ,
1293+ ui->bass_maxgain , ui->postgain
1294+ });
12261295
12271296 QList<QWidget*> registerClick ({
1228- ui->bassboost , ui->bs2b , ui->stereowidener , ui->analog , ui->reverb , ui->enable_eq , ui->enable_comp , ui->ddc_enable , ui->conv_enable ,
1229- ui->graphicEq ->chk_enable
1230- });
1297+ ui->bassboost , ui->bs2b , ui->stereowidener , ui->analog , ui->reverb , ui->enable_eq , ui->enable_comp , ui->ddc_enable , ui->conv_enable ,
1298+ ui->graphicEq ->chk_enable
1299+ });
12311300
12321301 foreach (QAnimatedSlider* w, sliders)
1233- {
1302+ {
12341303 connect (w, &QAnimatedSlider::stringChanged, ui->info , qOverload<const QString&>(&FadingLabel::setAnimatedText));
12351304 connect (w, &QAnimatedSlider::valueChangedA, this , &MainWindow::applyConfig);
12361305 }
@@ -1257,6 +1326,9 @@ void MainWindow::connectActions()
12571326 connect (ui->eq_widget , &LiquidEqualizerWidget::bandsUpdated, this , &MainWindow::applyConfig);
12581327 connect (ui->eq_widget , &LiquidEqualizerWidget::mouseReleased, this , &MainWindow::determineEqPresetName);
12591328
1329+ connect (ui->comp_response , &LiquidCompanderWidget::bandsUpdated, this , &MainWindow::applyConfig);
1330+ connect (ui->comp_tf_transforms , qOverload<int >(&QComboBox::currentIndexChanged), this , &MainWindow::applyConfig);
1331+
12601332 connect (ui->conv_adv_wave_edit , &QAbstractButton::clicked, this , &MainWindow::onConvolverWaveformEdit);
12611333
12621334 connect (ui->graphicEq , &GraphicEQFilterGUI::mouseUp, this , &MainWindow::applyConfig);
0 commit comments