X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=mainwindow.cpp;h=8a91a3f630dc031ac8414a07fda84af2feb5d768;hb=a01adea195e33f581ed0308105839616e51ca662;hp=a19a4560ab1c69b5bae9f42d871d16fff511d47f;hpb=eb15ac766b68cbb5fb563d6e1c73e4a58b2b80fb;p=nageru diff --git a/mainwindow.cpp b/mainwindow.cpp index a19a456..8a91a3f 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -92,7 +92,15 @@ 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); + cutoff_knob_changed(ui->locut_cutoff_knob->value()); + 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){ @@ -145,6 +153,18 @@ void MainWindow::reset_meters_button_clicked() void MainWindow::audio_level_callback(float level_lufs, float peak_db, float global_level_lufs, float range_low_lufs, float range_high_lufs, float auto_gain_staging_db) { + timeval now; + gettimeofday(&now, nullptr); + + // The meters are somewhat inefficient to update. Only update them + // every 100 ms or so (we get updates every 5–20 ms). + double last_update_age = now.tv_sec - last_audio_level_callback.tv_sec + + 1e-6 * (now.tv_usec - last_audio_level_callback.tv_usec); + if (last_update_age < 0.100) { + return; + } + last_audio_level_callback = now; + post_to_main_thread([=]() { ui->vu_meter->set_level(level_lufs); ui->lra_meter->set_levels(global_level_lufs, range_low_lufs, range_high_lufs);