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){
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);