X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=mainwindow.cpp;h=de0b4da2ef507103da245fae47285a1daec44538;hb=e8918c22dd8cd509d9679d50bfc6bba86661ebb3;hp=854eb08663176a4a1e1a1fcf627e48d30c2edf98;hpb=0d7183f398856c9331e58808d0374e63593334b6;p=nageru diff --git a/mainwindow.cpp b/mainwindow.cpp index 854eb08..de0b4da 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -92,7 +92,21 @@ void MainWindow::mixer_created(Mixer *mixer) connect(ui_display->wb_button, &QPushButton::clicked, bind(&MainWindow::wb_button_clicked, this, i)); } + char buf[256]; + snprintf(buf, sizeof(buf), "%.1f dB", mixer->get_limiter_threshold_dbfs()); + ui->limiter_threshold_db_display->setText(buf); + snprintf(buf, sizeof(buf), "%.1f dB", mixer->get_compressor_threshold_dbfs()); + ui->compressor_threshold_db_display->setText(buf); + connect(ui->locut_cutoff_knob, &QDial::valueChanged, this, &MainWindow::cutoff_knob_changed); + connect(ui->limiter_threshold_knob, &QDial::valueChanged, this, &MainWindow::limiter_threshold_knob_changed); + connect(ui->compressor_threshold_knob, &QDial::valueChanged, this, &MainWindow::compressor_threshold_knob_changed); + connect(ui->limiter_enabled, &QCheckBox::stateChanged, [this](int state){ + global_mixer->set_limiter_enabled(state == Qt::Checked); + }); + connect(ui->compressor_enabled, &QCheckBox::stateChanged, [this](int state){ + global_mixer->set_compressor_enabled(state == Qt::Checked); + }); connect(ui->reset_meters_button, &QPushButton::clicked, this, &MainWindow::reset_meters_button_clicked); mixer->set_audio_level_callback(bind(&MainWindow::audio_level_callback, this, _1, _2, _3, _4, _5, _6)); } @@ -108,6 +122,26 @@ void MainWindow::cutoff_knob_changed(int value) ui->locut_cutoff_display->setText(buf); } +void MainWindow::limiter_threshold_knob_changed(int value) +{ + float threshold_dbfs = value * 0.1f; + global_mixer->set_limiter_threshold_dbfs(threshold_dbfs); + + char buf[256]; + snprintf(buf, sizeof(buf), "%.1f dB", threshold_dbfs); + ui->limiter_threshold_db_display->setText(buf); +} + +void MainWindow::compressor_threshold_knob_changed(int value) +{ + float threshold_dbfs = value * 0.1f; + global_mixer->set_compressor_threshold_dbfs(threshold_dbfs); + + char buf[256]; + snprintf(buf, sizeof(buf), "%.1f dB", threshold_dbfs); + ui->compressor_threshold_db_display->setText(buf); +} + void MainWindow::reset_meters_button_clicked() { global_mixer->reset_meters();