]> git.sesse.net Git - nageru/commitdiff
Make the locut filter possible to disable.
authorSteinar H. Gunderson <sgunderson@bigfoot.com>
Sun, 17 Jan 2016 20:01:21 +0000 (21:01 +0100)
committerSteinar H. Gunderson <sgunderson@bigfoot.com>
Sun, 17 Jan 2016 20:01:21 +0000 (21:01 +0100)
mainwindow.cpp
mixer.cpp
mixer.h
ui_mainwindow.ui

index 77daf078b0000e643e2b7a5c2bc2aa0e931bed8a..5535c151bfcf2594390d5bdb141785acfa4c77de 100644 (file)
@@ -110,6 +110,9 @@ void MainWindow::mixer_created(Mixer *mixer)
 
        connect(ui->locut_cutoff_knob, &QDial::valueChanged, this, &MainWindow::cutoff_knob_changed);
        cutoff_knob_changed(ui->locut_cutoff_knob->value());
+       connect(ui->locut_enabled, &QCheckBox::stateChanged, [this](int state){
+               global_mixer->set_locut_enabled(state == Qt::Checked);
+       });
 
        // Not QDial::valueChanged, as we call setValue() all the time.
        connect(ui->gainstaging_knob, &QAbstractSlider::sliderMoved, this, &MainWindow::gain_staging_knob_changed);
index 39bae192c5bda7722f2aa527da80e62b990ba7fe..cfdb5b190b1b25f828227d6b59fdc8fe9eeda455 100644 (file)
--- a/mixer.cpp
+++ b/mixer.cpp
@@ -709,7 +709,9 @@ void Mixer::process_audio_one_frame(int64_t frame_pts_int, int num_samples)
        // we don't need it for voice, and it will reduce headroom
        // and confuse the compressor. (In particular, any hums at 50 or 60 Hz
        // should be dampened.)
-       locut.render(samples_out.data(), samples_out.size() / 2, locut_cutoff_hz * 2.0 * M_PI / OUTPUT_FREQUENCY, 0.5f);
+       if (locut_enabled) {
+               locut.render(samples_out.data(), samples_out.size() / 2, locut_cutoff_hz * 2.0 * M_PI / OUTPUT_FREQUENCY, 0.5f);
+       }
 
        // Apply a level compressor to get the general level right.
        // Basically, if it's over about -40 dBFS, we squeeze it down to that level
diff --git a/mixer.h b/mixer.h
index 961c2a6c20948d72db4ca150aa7ec8c570d8e44d..3c1a952a81575ec80bfdb56f63252e0fdf4847e9 100644 (file)
--- a/mixer.h
+++ b/mixer.h
@@ -141,6 +141,11 @@ public:
                locut_cutoff_hz = cutoff_hz;
        }
 
+       void set_locut_enabled(bool enabled)
+       {
+               locut_enabled = enabled;
+       }
+
        float get_limiter_threshold_dbfs()
        {
                return limiter_threshold_dbfs;
@@ -295,8 +300,9 @@ private:
        Resampler peak_resampler;
        std::atomic<float> peak{0.0f};
 
-       StereoFilter locut;  // Default cutoff 150 Hz, 24 dB/oct.
+       StereoFilter locut;  // Default cutoff 120 Hz, 24 dB/oct.
        std::atomic<float> locut_cutoff_hz;
+       std::atomic<bool> locut_enabled{true};
 
        // First compressor; takes us up to about -12 dBFS.
        StereoCompressor level_compressor;  // Under compressor_mutex. Used to set/override gain_staging_db if <level_compressor_enabled>.
index cc041a8d95edbbc06bd25eaf370f95cc96e37afe..2d7031c8ecad6403aaddc1f51b61079eafb134cf 100644 (file)
           </property>
          </widget>
         </item>
-        <item row="3" column="0">
-         <widget class="QComboBox" name="comboBox">
-          <property name="currentText">
-           <string/>
-          </property>
-         </widget>
-        </item>
         <item row="3" column="3">
          <widget class="QCheckBox" name="limiter_enabled">
           <property name="text">
           </property>
          </widget>
         </item>
+        <item row="3" column="0">
+         <widget class="QCheckBox" name="locut_enabled">
+          <property name="text">
+           <string>Enabled</string>
+          </property>
+          <property name="checked">
+           <bool>true</bool>
+          </property>
+         </widget>
+        </item>
        </layout>
       </item>
       <item>