X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=mainwindow.cpp;h=f59824cabd053364246c22558df64147ed5991a8;hb=f3e2ecc05ad9df6b428b80bd32ad2e8d3f7192a1;hp=2ef1da4502435bffe0a2ceb1354c134b1bd1a345;hpb=c3a08ff6100840205d295a58d6bf340aa20afde0;p=nageru diff --git a/mainwindow.cpp b/mainwindow.cpp index 2ef1da4..f59824c 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -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)); @@ -411,6 +421,8 @@ void MainWindow::setup_audio_expanded_view() reduction_meter->set_ref_level(0.0f); reduction_meter->set_flip(true); } + + update_cutoff_labels(global_mixer->get_audio_mixer()->get_locut_cutoff()); } void MainWindow::mixer_shutting_down() @@ -485,7 +497,11 @@ void MainWindow::cutoff_knob_changed(int value) float octaves = value * 0.1f; float cutoff_hz = 20.0 * pow(2.0, octaves); global_mixer->get_audio_mixer()->set_locut_cutoff(cutoff_hz); + update_cutoff_labels(cutoff_hz); +} +void MainWindow::update_cutoff_labels(float cutoff_hz) +{ char buf[256]; snprintf(buf, sizeof(buf), "%ld Hz", lrintf(cutoff_hz)); ui->locut_cutoff_display->setText(buf); @@ -530,6 +546,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;