]> git.sesse.net Git - nageru/commitdiff
Hook up the EQ controls and labels.
authorSteinar H. Gunderson <sgunderson@bigfoot.com>
Mon, 29 Aug 2016 18:23:27 +0000 (20:23 +0200)
committerSteinar H. Gunderson <sgunderson@bigfoot.com>
Wed, 19 Oct 2016 22:55:44 +0000 (00:55 +0200)
audio_mixer.h
mainwindow.cpp
mainwindow.h

index c332671e0bebd6f385d66b8ddc40fd426fd765ad..1e25f52f32ef6b62e10e3d60e1de1a8cedf3fc72 100644 (file)
@@ -124,6 +124,12 @@ public:
                eq_level_db[bus_index][band] = db_gain;
        }
 
+       float get_eq(unsigned bus_index, EQBand band) const
+       {
+               assert(band >= 0 && band < NUM_EQ_BANDS);
+               return eq_level_db[bus_index][band];
+       }
+
        float get_limiter_threshold_dbfs() const
        {
                return limiter_threshold_dbfs;
index 2ef1da4502435bffe0a2ceb1354c134b1bd1a345..ea742f701dc40cef3c37685c670cb8e046b59194 100644 (file)
@@ -369,6 +369,9 @@ void MainWindow::setup_audio_expanded_view()
                ui_audio_expanded_view->bus_desc_label->setFullText(
                        QString::fromStdString(mapping.buses[bus_index].name));
                audio_expanded_views[bus_index] = ui_audio_expanded_view;
+               update_eq_label(bus_index, EQ_BAND_TREBLE, global_mixer->get_audio_mixer()->get_eq(bus_index, EQ_BAND_TREBLE));
+               update_eq_label(bus_index, EQ_BAND_MID, global_mixer->get_audio_mixer()->get_eq(bus_index, EQ_BAND_MID));
+               update_eq_label(bus_index, EQ_BAND_BASS, global_mixer->get_audio_mixer()->get_eq(bus_index, EQ_BAND_BASS));
                // TODO: Set the fader position.
                ui->buses->addWidget(channel);
 
@@ -377,6 +380,13 @@ void MainWindow::setup_audio_expanded_view()
                        global_mixer->get_audio_mixer()->set_locut_enabled(bus_index, state == Qt::Checked);
                });
 
+               connect(ui_audio_expanded_view->treble_knob, &QDial::valueChanged,
+                       bind(&MainWindow::eq_knob_changed, this, bus_index, EQ_BAND_TREBLE, _1));
+               connect(ui_audio_expanded_view->mid_knob, &QDial::valueChanged,
+                       bind(&MainWindow::eq_knob_changed, this, bus_index, EQ_BAND_MID, _1));
+               connect(ui_audio_expanded_view->bass_knob, &QDial::valueChanged,
+                       bind(&MainWindow::eq_knob_changed, this, bus_index, EQ_BAND_BASS, _1));
+
                ui_audio_expanded_view->gainstaging_knob->setValue(global_mixer->get_audio_mixer()->get_gain_staging_db(bus_index));
                ui_audio_expanded_view->gainstaging_auto_checkbox->setChecked(global_mixer->get_audio_mixer()->get_gain_staging_auto(bus_index));
                ui_audio_expanded_view->compressor_enabled->setChecked(global_mixer->get_audio_mixer()->get_compressor_enabled(bus_index));
@@ -530,6 +540,33 @@ void MainWindow::report_disk_space(off_t free_bytes, double estimated_seconds_le
        });
 }
 
+void MainWindow::eq_knob_changed(unsigned bus_index, EQBand band, int value)
+{
+       float gain_db = value * 0.1f;
+       global_mixer->get_audio_mixer()->set_eq(bus_index, band, gain_db);
+
+       update_eq_label(bus_index, band, gain_db);
+}
+
+void MainWindow::update_eq_label(unsigned bus_index, EQBand band, float gain_db)
+{
+       Ui::AudioExpandedView *view = audio_expanded_views[bus_index];
+       string db_string = format_db(gain_db, DB_WITH_SIGN);
+       switch (band) {
+       case EQ_BAND_TREBLE:
+               view->treble_label->setText(QString::fromStdString("Treble: " + db_string));
+               break;
+       case EQ_BAND_MID:
+               view->mid_label->setText(QString::fromStdString("Mid: " + db_string));
+               break;
+       case EQ_BAND_BASS:
+               view->bass_label->setText(QString::fromStdString("Bass: " + db_string));
+               break;
+       default:
+               assert(false);
+       }
+}
+
 void MainWindow::limiter_threshold_knob_changed(int value)
 {
        float threshold_dbfs = value * 0.1f;
index 73a62357682c29d2741510f2e172a0d62bc023ae..4c9d0b886bcb08523503dc61f06e85d242d6c81d 100644 (file)
@@ -50,6 +50,7 @@ public slots:
        void gain_staging_knob_changed(unsigned bus_index, int value);
        void final_makeup_gain_knob_changed(int value);
        void cutoff_knob_changed(int value);
+       void eq_knob_changed(unsigned bus_index, EQBand band, int value);
        void limiter_threshold_knob_changed(int value);
        void compressor_threshold_knob_changed(unsigned bus_index, int value);
        void mini_fader_changed(int bus, double db_volume);
@@ -61,6 +62,7 @@ private:
        void setup_audio_expanded_view();
        bool eventFilter(QObject *watched, QEvent *event) override;
        void set_white_balance(int channel_number, int x, int y);
+       void update_eq_label(unsigned bus_index, EQBand band, float gain_db);
 
        // Called from DiskSpaceEstimator.
        void report_disk_space(off_t free_bytes, double estimated_seconds_left);