X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=mainwindow.cpp;h=ecdb131028f6a1ef691d190d4edc9f0ef2a1ddea;hb=0665b6e2785cc5f1b7b2ca7e5073060e002b2f30;hp=0fc17b539fc4bad49795e163b8f2965bfc2610cf;hpb=8d0d68b7cca3a4c58268fa0822ca38bb1863dd19;p=nageru diff --git a/mainwindow.cpp b/mainwindow.cpp index 0fc17b5..ecdb131 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -1,5 +1,4 @@ #include "mainwindow.h" -#include "window.h" #include #include #include @@ -17,9 +16,12 @@ using namespace std; Q_DECLARE_METATYPE(std::vector); +MainWindow *global_mainwindow = nullptr; + MainWindow::MainWindow() : ui(new Ui::MainWindow) { + global_mainwindow = this; ui->setupUi(this); ui->me_live->set_output(Mixer::OUTPUT_LIVE); @@ -79,10 +81,6 @@ MainWindow::MainWindow() qRegisterMetaType>("std::vector"); connect(ui->preview1, SIGNAL(transition_names_updated(std::vector)), this, SLOT(set_transition_names(std::vector))); - - // global_mixer does not exist yet, so need to delay the actual hookups. - global_vu_meter = ui->vu_meter; - global_peak_display = ui->peak_display; } void MainWindow::resizeEvent(QResizeEvent* event) @@ -94,6 +92,23 @@ void MainWindow::resizeEvent(QResizeEvent* event) QMetaObject::invokeMethod(this, "relayout", Qt::QueuedConnection); } +void MainWindow::mixer_created(Mixer *mixer) +{ + mixer->set_audio_level_callback([this](float level_lufs, float peak_db, float global_level_lufs, float range_low_lufs, float range_high_lufs){ + ui->vu_meter->set_level(level_lufs); + ui->lra_meter->set_levels(global_level_lufs, range_low_lufs, range_high_lufs); + + char buf[256]; + snprintf(buf, sizeof(buf), "%.1f", peak_db); + ui->peak_display->setText(buf); + if (peak_db > -0.1f) { // -0.1 dBFS is EBU peak limit. + ui->peak_display->setStyleSheet("QLabel { background-color: red; color: white; }"); + } else { + ui->peak_display->setStyleSheet(""); + } + }); +} + void MainWindow::relayout() { int width = size().width();