From: Steinar H. Gunderson Date: Fri, 1 Jul 2016 21:18:20 +0000 (+0200) Subject: Fix --flat-audio; add the gain staging auto knob, and make sure the UI reflects the... X-Git-Tag: 1.3.1~1 X-Git-Url: https://git.sesse.net/?a=commitdiff_plain;h=3170a65ace5cb8c5955fb5ce9d97fd1790f1c061;p=nageru Fix --flat-audio; add the gain staging auto knob, and make sure the UI reflects the state. --- diff --git a/mainwindow.cpp b/mainwindow.cpp index cfc1569..8196492 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -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); diff --git a/mixer.cpp b/mixer.cpp index 80b0df1..1934ee9 100644 --- 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 6a58575..e893ffb 100644 --- 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 lock(compressor_mutex); @@ -293,6 +308,12 @@ public: level_compressor_enabled = enabled; } + bool get_gain_staging_auto() const + { + std::unique_lock lock(compressor_mutex); + return level_compressor_enabled; + } + void set_final_makeup_gain_db(float gain_db) { std::unique_lock lock(compressor_mutex); @@ -473,7 +494,7 @@ private: std::atomic 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.