]> git.sesse.net Git - nageru/commitdiff
Fix --flat-audio; add the gain staging auto knob, and make sure the UI reflects the...
authorSteinar H. Gunderson <sgunderson@bigfoot.com>
Fri, 1 Jul 2016 21:18:20 +0000 (23:18 +0200)
committerSteinar H. Gunderson <sgunderson@bigfoot.com>
Fri, 1 Jul 2016 21:43:01 +0000 (23:43 +0200)
mainwindow.cpp
mixer.cpp
mixer.h

index cfc15699261b04ef3b9edb9847fd3b1780279e39..8196492ccfdb1560802e3be18010a39ee1c344cd 100644 (file)
@@ -120,6 +120,13 @@ void MainWindow::mixer_created(Mixer *mixer)
                connect(ui_display->wb_button, &QPushButton::clicked, bind(&MainWindow::wb_button_clicked, this, i));
        }
 
+       // TODO: Fetch all of the values these for completeness,
+       // not just the enable knobs implied by --flat-audio.
+       ui->locut_enabled->setChecked(global_mixer->get_locut_enabled());
+       ui->gainstaging_auto_checkbox->setChecked(global_mixer->get_gain_staging_auto());
+       ui->limiter_enabled->setChecked(global_mixer->get_limiter_enabled());
+       ui->compressor_enabled->setChecked(global_mixer->get_compressor_enabled());
+
        char buf[256];
        snprintf(buf, sizeof(buf), "%.1f dB", mixer->get_limiter_threshold_dbfs());
        ui->limiter_threshold_db_display->setText(buf);
index 80b0df1ea0df60d852bc530cb0d5535e99e2f92a..1934ee9429bcae271b3c6d22a9df64e2820a49fc 100644 (file)
--- a/mixer.cpp
+++ b/mixer.cpp
@@ -249,6 +249,7 @@ Mixer::Mixer(const QSurfaceFormat &format, unsigned num_cards)
        // except the final makeup gain.
        if (global_flags.flat_audio) {
                set_locut_enabled(false);
+               set_gain_staging_auto(false);
                set_limiter_enabled(false);
                set_compressor_enabled(false);
        }
diff --git a/mixer.h b/mixer.h
index 6a58575febd61d230b5e0cb7c65a6771a66248e5..e893ffb8427728b235d21f93c7a9169991c14aef 100644 (file)
--- a/mixer.h
+++ b/mixer.h
@@ -250,6 +250,11 @@ public:
                locut_enabled = enabled;
        }
 
+       bool get_locut_enabled() const
+       {
+               return locut_enabled;
+       }
+
        float get_limiter_threshold_dbfs()
        {
                return limiter_threshold_dbfs;
@@ -275,11 +280,21 @@ public:
                limiter_enabled = enabled;
        }
 
+       bool get_limiter_enabled() const
+       {
+               return limiter_enabled;
+       }
+
        void set_compressor_enabled(bool enabled)
        {
                compressor_enabled = enabled;
        }
 
+       bool get_compressor_enabled() const
+       {
+               return compressor_enabled;
+       }
+
        void set_gain_staging_db(float gain_db)
        {
                std::unique_lock<std::mutex> lock(compressor_mutex);
@@ -293,6 +308,12 @@ public:
                level_compressor_enabled = enabled;
        }
 
+       bool get_gain_staging_auto() const
+       {
+               std::unique_lock<std::mutex> lock(compressor_mutex);
+               return level_compressor_enabled;
+       }
+
        void set_final_makeup_gain_db(float gain_db)
        {
                std::unique_lock<std::mutex> lock(compressor_mutex);
@@ -473,7 +494,7 @@ private:
        std::atomic<bool> should_cut{false};
 
        audio_level_callback_t audio_level_callback = nullptr;
-       std::mutex compressor_mutex;
+       mutable std::mutex compressor_mutex;
        Ebu_r128_proc r128;  // Under compressor_mutex.
        CorrelationMeasurer correlation;  // Under compressor_mutex.