X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=mainwindow.cpp;h=8a91a3f630dc031ac8414a07fda84af2feb5d768;hb=3dfe3da9659a3f67e3ecdfd14cca7377ed1d84b7;hp=de0b4da2ef507103da245fae47285a1daec44538;hpb=e8918c22dd8cd509d9679d50bfc6bba86661ebb3;p=nageru diff --git a/mainwindow.cpp b/mainwindow.cpp index de0b4da..8a91a3f 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -99,6 +99,8 @@ void MainWindow::mixer_created(Mixer *mixer) 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){ @@ -151,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);