]> git.sesse.net Git - nageru/blobdiff - mainwindow.cpp
Transparently send signals through a deinterlacer as needed.
[nageru] / mainwindow.cpp
index de0b4da2ef507103da245fae47285a1daec44538..8a91a3f630dc031ac8414a07fda84af2feb5d768 100644 (file)
@@ -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);