X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=nageru%2Fmainwindow.cpp;h=980059af5a1f9752bd0853ecbf4a8c2a6a2d4879;hb=refs%2Fheads%2Faudio-delay;hp=73362229ce35e8efc70f9cf5dcfe4c25a6e73037;hpb=2e1b69c339862fb9b8147bf0ac07d87ca4810d4e;p=nageru diff --git a/nageru/mainwindow.cpp b/nageru/mainwindow.cpp index 7336222..980059a 100644 --- a/nageru/mainwindow.cpp +++ b/nageru/mainwindow.cpp @@ -198,7 +198,7 @@ MainWindow::MainWindow() global_mainwindow = this; ui->setupUi(this); - global_disk_space_estimator = new DiskSpaceEstimator(bind(&MainWindow::report_disk_space, this, _1, _2)); + global_disk_space_estimator = new DiskSpaceEstimator(bind(&MainWindow::report_disk_space, this, _1, _2, _3)); disk_free_label = new QLabel(this); disk_free_label->setStyleSheet("QLabel {padding-right: 5px;}"); ui->menuBar->setCornerWidget(disk_free_label); @@ -216,6 +216,7 @@ MainWindow::MainWindow() connect(ui->manual_action, &QAction::triggered, this, &MainWindow::manual_triggered); connect(ui->about_action, &QAction::triggered, this, &MainWindow::about_triggered); connect(ui->open_analyzer_action, &QAction::triggered, this, &MainWindow::open_analyzer_triggered); + connect(ui->open_delay_analyzer_action, &QAction::triggered, this, &MainWindow::open_delay_analyzer_triggered); connect(ui->simple_audio_mode, &QAction::triggered, this, &MainWindow::simple_audio_mode_triggered); connect(ui->multichannel_audio_mode, &QAction::triggered, this, &MainWindow::multichannel_audio_mode_triggered); connect(ui->input_mapping_action, &QAction::triggered, this, &MainWindow::input_mapping_triggered); @@ -252,6 +253,9 @@ MainWindow::MainWindow() connect(ui->me_live, &GLWidget::transition_names_updated, this, &MainWindow::set_transition_names); qRegisterMetaType("Mixer::Output"); + connect(ui->me_live, &GLWidget::name_updated, this, &MainWindow::update_channel_name); + connect(ui->me_preview, &GLWidget::name_updated, this, &MainWindow::update_channel_name); + // Hook up the prev/next buttons on the audio views. connect(ui->compact_prev_page, &QAbstractButton::clicked, this, &MainWindow::prev_page); connect(ui->compact_next_page, &QAbstractButton::clicked, this, &MainWindow::next_page); @@ -441,6 +445,9 @@ void MainWindow::mixer_created(Mixer *mixer) midi_mapper.start_thread(); analyzer.reset(new Analyzer); + delay_analyzer.reset(new DelayAnalyzer); + + mixer->get_audio_mixer()->set_delay_analyzer(delay_analyzer.get()); global_mixer->set_theme_menu_callback(bind(&MainWindow::setup_theme_menu, this)); setup_theme_menu(); @@ -467,6 +474,7 @@ void MainWindow::reset_audio_mapping_ui() ui->multichannel_audio_mode->setChecked(!simple); ui->input_mapping_action->setEnabled(!simple); ui->midi_mapping_action->setEnabled(!simple); + ui->open_delay_analyzer_action->setEnabled(!simple); ui->locut_enabled->setVisible(simple); ui->gainstaging_label->setVisible(simple); @@ -675,6 +683,11 @@ void MainWindow::open_analyzer_triggered() analyzer->show(); } +void MainWindow::open_delay_analyzer_triggered() +{ + delay_analyzer->show(); +} + void MainWindow::simple_audio_mode_triggered() { if (global_audio_mixer->get_mapping_mode() == AudioMixer::MappingMode::SIMPLE) { @@ -783,7 +796,7 @@ void MainWindow::update_cutoff_labels(float cutoff_hz) } } -void MainWindow::report_disk_space(off_t free_bytes, double estimated_seconds_left) +void MainWindow::report_disk_space(off_t free_bytes, double estimated_seconds_left, double file_length_seconds) { char time_str[256]; if (estimated_seconds_left < 60.0) { @@ -808,7 +821,9 @@ void MainWindow::report_disk_space(off_t free_bytes, double estimated_seconds_le char buf[256]; snprintf(buf, sizeof(buf), "Disk free: %'.0f MB (approx. %s)", free_bytes / 1048576.0, time_str); - std::string label = buf; + // NOTE: The default formatter does not use file_length_seconds for anything, + // but the theme might want to do so. + std::string label = global_mixer->format_status_line(buf, file_length_seconds); post_to_main_thread([this, label]{ disk_free_label->setText(QString::fromStdString(label)); @@ -1503,7 +1518,11 @@ void MainWindow::set_transition_names(vector transition_names) void MainWindow::update_channel_name(Mixer::Output output, const string &name) { - if (output >= Mixer::OUTPUT_INPUT0) { + if (output == Mixer::OUTPUT_LIVE) { + ui->label_live->setText(name.c_str()); + } else if (output == Mixer::OUTPUT_PREVIEW) { + ui->label_preview->setText(name.c_str()); + } else if (output >= Mixer::OUTPUT_INPUT0) { unsigned channel = output - Mixer::OUTPUT_INPUT0; previews[channel]->label->setText(name.c_str()); }