1 #include "mainwindow.h"
11 #include <QInputDialog>
12 #include <QKeySequence>
14 #include <QMessageBox>
16 #include <QPushButton>
17 #include <QResizeEvent>
22 #include "aboutdialog.h"
23 #include "disk_space_estimator.h"
26 #include "input_mapping_dialog.h"
28 #include "midi_mapping.pb.h"
29 #include "midi_mapping_dialog.h"
31 #include "post_to_main_thread.h"
32 #include "ui_audio_miniview.h"
33 #include "ui_audio_expanded_view.h"
34 #include "ui_display.h"
35 #include "ui_mainwindow.h"
41 using namespace std::chrono;
42 using namespace std::placeholders;
44 Q_DECLARE_METATYPE(std::string);
45 Q_DECLARE_METATYPE(std::vector<std::string>);
47 MainWindow *global_mainwindow = nullptr;
49 // -0.1 dBFS is EBU peak limit. We use it consistently, even for the bus meters
50 // (which don't calculate interpolate peak, and in general don't follow EBU recommendations).
51 constexpr float peak_limit_dbfs = -0.1f;
55 void schedule_cut_signal(int ignored)
57 global_mixer->schedule_cut();
60 void quit_signal(int ignored)
62 global_mainwindow->close();
65 void slave_knob(QDial *master, QDial *slave)
67 QWidget::connect(master, &QDial::valueChanged, [slave](int value){
68 slave->blockSignals(true);
69 slave->setValue(value);
70 slave->blockSignals(false);
72 QWidget::connect(slave, &QDial::valueChanged, [master](int value){
73 master->setValue(value);
77 void slave_checkbox(QCheckBox *master, QCheckBox *slave)
79 QWidget::connect(master, &QCheckBox::stateChanged, [slave](int state){
80 slave->blockSignals(true);
81 slave->setCheckState(Qt::CheckState(state));
82 slave->blockSignals(false);
84 QWidget::connect(slave, &QCheckBox::stateChanged, [master](int state){
85 master->setCheckState(Qt::CheckState(state));
89 void slave_fader(NonLinearFader *master, NonLinearFader *slave)
91 QWidget::connect(master, &NonLinearFader::dbValueChanged, [slave](double value) {
92 slave->blockSignals(true);
93 slave->setDbValue(value);
94 slave->blockSignals(false);
96 QWidget::connect(slave, &NonLinearFader::dbValueChanged, [master](double value){
97 master->setDbValue(value);
101 constexpr unsigned DB_NO_FLAGS = 0x0;
102 constexpr unsigned DB_WITH_SIGN = 0x1;
103 constexpr unsigned DB_BARE = 0x2;
105 string format_db(double db, unsigned flags)
108 if (flags & DB_WITH_SIGN) {
111 snprintf(buf, sizeof(buf), "%+.1f", db);
113 } else if (db < 0.0) {
116 // Should never happen, really.
122 snprintf(buf, sizeof(buf), "%.1f", db);
124 } else if (db < 0.0) {
127 // Should never happen, really.
131 if (!(flags & DB_BARE)) {
137 void set_peak_label(QLabel *peak_label, float peak_db)
139 peak_label->setText(QString::fromStdString(format_db(peak_db, DB_BARE)));
141 if (peak_db > peak_limit_dbfs) {
142 peak_label->setStyleSheet("QLabel { background-color: red; color: white; }");
144 peak_label->setStyleSheet("");
150 MainWindow::MainWindow()
151 : ui(new Ui::MainWindow), midi_mapper(this)
153 global_mainwindow = this;
156 global_disk_space_estimator = new DiskSpaceEstimator(bind(&MainWindow::report_disk_space, this, _1, _2));
157 disk_free_label = new QLabel(this);
158 disk_free_label->setStyleSheet("QLabel {padding-right: 5px;}");
159 ui->menuBar->setCornerWidget(disk_free_label);
161 QActionGroup *audio_mapping_group = new QActionGroup(this);
162 ui->simple_audio_mode->setActionGroup(audio_mapping_group);
163 ui->multichannel_audio_mode->setActionGroup(audio_mapping_group);
165 ui->me_live->set_output(Mixer::OUTPUT_LIVE);
166 ui->me_preview->set_output(Mixer::OUTPUT_PREVIEW);
169 connect(ui->cut_action, &QAction::triggered, this, &MainWindow::cut_triggered);
170 connect(ui->exit_action, &QAction::triggered, this, &MainWindow::exit_triggered);
171 connect(ui->about_action, &QAction::triggered, this, &MainWindow::about_triggered);
172 connect(ui->simple_audio_mode, &QAction::triggered, this, &MainWindow::simple_audio_mode_triggered);
173 connect(ui->multichannel_audio_mode, &QAction::triggered, this, &MainWindow::multichannel_audio_mode_triggered);
174 connect(ui->input_mapping_action, &QAction::triggered, this, &MainWindow::input_mapping_triggered);
175 connect(ui->midi_mapping_action, &QAction::triggered, this, &MainWindow::midi_mapping_triggered);
177 if (global_flags.x264_video_to_http) {
178 connect(ui->x264_bitrate_action, &QAction::triggered, this, &MainWindow::x264_bitrate_triggered);
180 ui->x264_bitrate_action->setEnabled(false);
183 // Hook up the transition buttons. (Keyboard shortcuts are set in set_transition_names().)
184 // TODO: Make them dynamic.
185 connect(ui->transition_btn1, &QPushButton::clicked, bind(&MainWindow::transition_clicked, this, 0));
186 connect(ui->transition_btn2, &QPushButton::clicked, bind(&MainWindow::transition_clicked, this, 1));
187 connect(ui->transition_btn3, &QPushButton::clicked, bind(&MainWindow::transition_clicked, this, 2));
190 transition_btn1 = ui->transition_btn1;
191 transition_btn2 = ui->transition_btn2;
192 transition_btn3 = ui->transition_btn3;
193 qRegisterMetaType<string>("std::string");
194 qRegisterMetaType<vector<string>>("std::vector<std::string>");
195 connect(ui->me_live, &GLWidget::transition_names_updated, this, &MainWindow::set_transition_names);
196 qRegisterMetaType<Mixer::Output>("Mixer::Output");
198 // Hook up the prev/next buttons on the audio views.
199 connect(ui->compact_prev_page, &QAbstractButton::clicked, bind(&QStackedWidget::setCurrentIndex, ui->audio_views, 1));
200 connect(ui->compact_next_page, &QAbstractButton::clicked, bind(&QStackedWidget::setCurrentIndex, ui->audio_views, 1));
201 connect(ui->full_prev_page, &QAbstractButton::clicked, bind(&QStackedWidget::setCurrentIndex, ui->audio_views, 0));
202 connect(ui->full_next_page, &QAbstractButton::clicked, bind(&QStackedWidget::setCurrentIndex, ui->audio_views, 0));
204 // And bind the same to PgUp/PgDown.
205 auto switch_page = [this]{
206 if (global_audio_mixer->get_mapping_mode() == AudioMixer::MappingMode::MULTICHANNEL) {
207 ui->audio_views->setCurrentIndex(1 - ui->audio_views->currentIndex());
210 connect(new QShortcut(QKeySequence::MoveToNextPage, this), &QShortcut::activated, switch_page);
211 connect(new QShortcut(QKeySequence::MoveToPreviousPage, this), &QShortcut::activated, switch_page);
213 last_audio_level_callback = steady_clock::now() - seconds(1);
215 if (!global_flags.midi_mapping_filename.empty()) {
216 MIDIMappingProto midi_mapping;
217 if (!load_midi_mapping_from_file(global_flags.midi_mapping_filename, &midi_mapping)) {
218 fprintf(stderr, "Couldn't load MIDI mapping '%s'; exiting.\n",
219 global_flags.midi_mapping_filename.c_str());
222 midi_mapper.set_midi_mapping(midi_mapping);
224 midi_mapper.start_thread();
227 void MainWindow::resizeEvent(QResizeEvent* event)
229 QMainWindow::resizeEvent(event);
231 // Ask for a relayout, but only after the event loop is done doing relayout
232 // on everything else.
233 QMetaObject::invokeMethod(this, "relayout", Qt::QueuedConnection);
236 void MainWindow::mixer_created(Mixer *mixer)
238 // Make the previews.
239 unsigned num_previews = mixer->get_num_channels();
241 for (unsigned i = 0; i < num_previews; ++i) {
242 Mixer::Output output = Mixer::Output(Mixer::OUTPUT_INPUT0 + i);
244 QWidget *preview = new QWidget(this);
245 Ui::Display *ui_display = new Ui::Display;
246 ui_display->setupUi(preview);
247 ui_display->label->setText(mixer->get_channel_name(output).c_str());
248 ui_display->display->set_output(output);
249 ui->preview_displays->insertWidget(previews.size(), preview, 1);
250 previews.push_back(ui_display);
252 // Hook up the click.
253 connect(ui_display->display, &GLWidget::clicked, bind(&MainWindow::channel_clicked, this, i));
255 // Let the theme update the text whenever the resolution or color changed.
256 connect(ui_display->display, &GLWidget::name_updated, this, &MainWindow::update_channel_name);
257 connect(ui_display->display, &GLWidget::color_updated, this, &MainWindow::update_channel_color);
259 // Hook up the keyboard key.
260 QShortcut *shortcut = new QShortcut(QKeySequence(Qt::Key_1 + i), this);
261 connect(shortcut, &QShortcut::activated, bind(&MainWindow::channel_clicked, this, i));
263 // Hook up the white balance button (irrelevant if invisible).
264 ui_display->wb_button->setVisible(mixer->get_supports_set_wb(output));
265 connect(ui_display->wb_button, &QPushButton::clicked, bind(&MainWindow::wb_button_clicked, this, i));
268 global_audio_mixer->set_state_changed_callback(bind(&MainWindow::audio_state_changed, this));
270 slave_knob(ui->locut_cutoff_knob, ui->locut_cutoff_knob_2);
271 slave_knob(ui->limiter_threshold_knob, ui->limiter_threshold_knob_2);
272 slave_knob(ui->makeup_gain_knob, ui->makeup_gain_knob_2);
273 slave_checkbox(ui->makeup_gain_auto_checkbox, ui->makeup_gain_auto_checkbox_2);
274 slave_checkbox(ui->limiter_enabled, ui->limiter_enabled_2);
276 reset_audio_mapping_ui();
278 // TODO: Fetch all of the values these for completeness,
279 // not just the enable knobs implied by flags.
280 ui->limiter_enabled->setChecked(global_audio_mixer->get_limiter_enabled());
281 ui->makeup_gain_auto_checkbox->setChecked(global_audio_mixer->get_final_makeup_gain_auto());
283 // Controls used only for simple audio fetch their state from the first bus.
284 constexpr unsigned simple_bus_index = 0;
285 if (global_audio_mixer->get_mapping_mode() == AudioMixer::MappingMode::SIMPLE) {
286 ui->locut_enabled->setChecked(global_audio_mixer->get_locut_enabled(simple_bus_index));
287 ui->gainstaging_knob->setValue(global_audio_mixer->get_gain_staging_db(simple_bus_index));
288 ui->gainstaging_auto_checkbox->setChecked(global_audio_mixer->get_gain_staging_auto(simple_bus_index));
289 ui->compressor_enabled->setChecked(global_audio_mixer->get_compressor_enabled(simple_bus_index));
290 ui->compressor_threshold_db_display->setText(
291 QString::fromStdString(format_db(mixer->get_audio_mixer()->get_compressor_threshold_dbfs(simple_bus_index), DB_WITH_SIGN)));
293 connect(ui->locut_enabled, &QCheckBox::stateChanged, [this](int state){
294 global_audio_mixer->set_locut_enabled(simple_bus_index, state == Qt::Checked);
295 midi_mapper.refresh_lights();
297 connect(ui->gainstaging_knob, &QAbstractSlider::valueChanged,
298 bind(&MainWindow::gain_staging_knob_changed, this, simple_bus_index, _1));
299 connect(ui->gainstaging_auto_checkbox, &QCheckBox::stateChanged, [this, simple_bus_index](int state){
300 global_audio_mixer->set_gain_staging_auto(simple_bus_index, state == Qt::Checked);
301 midi_mapper.refresh_lights();
303 connect(ui->compressor_threshold_knob, &QDial::valueChanged,
304 bind(&MainWindow::compressor_threshold_knob_changed, this, simple_bus_index, _1));
305 connect(ui->compressor_enabled, &QCheckBox::stateChanged, [this, simple_bus_index](int state){
306 global_audio_mixer->set_compressor_enabled(simple_bus_index, state == Qt::Checked);
307 midi_mapper.refresh_lights();
310 // Global mastering controls.
311 QString limiter_threshold_label(
312 QString::fromStdString(format_db(mixer->get_audio_mixer()->get_limiter_threshold_dbfs(), DB_WITH_SIGN)));
313 ui->limiter_threshold_db_display->setText(limiter_threshold_label);
314 ui->limiter_threshold_db_display_2->setText(limiter_threshold_label);
316 connect(ui->locut_cutoff_knob, &QDial::valueChanged, this, &MainWindow::cutoff_knob_changed);
317 cutoff_knob_changed(ui->locut_cutoff_knob->value());
319 connect(ui->makeup_gain_knob, &QAbstractSlider::valueChanged, this, &MainWindow::final_makeup_gain_knob_changed);
320 connect(ui->makeup_gain_auto_checkbox, &QCheckBox::stateChanged, [this](int state){
321 global_audio_mixer->set_final_makeup_gain_auto(state == Qt::Checked);
322 midi_mapper.refresh_lights();
325 connect(ui->limiter_threshold_knob, &QDial::valueChanged, this, &MainWindow::limiter_threshold_knob_changed);
326 connect(ui->limiter_enabled, &QCheckBox::stateChanged, [this](int state){
327 global_audio_mixer->set_limiter_enabled(state == Qt::Checked);
328 midi_mapper.refresh_lights();
330 connect(ui->reset_meters_button, &QPushButton::clicked, this, &MainWindow::reset_meters_button_clicked);
331 // Even though we have a reset button right next to it, the fact that
332 // the expanded audio view labels are clickable makes it natural to
333 // click this one as well.
334 connect(ui->peak_display, &ClickableLabel::clicked, this, &MainWindow::reset_meters_button_clicked);
335 mixer->get_audio_mixer()->set_audio_level_callback(bind(&MainWindow::audio_level_callback, this, _1, _2, _3, _4, _5, _6, _7, _8));
337 midi_mapper.refresh_highlights();
338 midi_mapper.refresh_lights();
340 struct sigaction act;
341 memset(&act, 0, sizeof(act));
342 act.sa_handler = schedule_cut_signal;
343 act.sa_flags = SA_RESTART;
344 sigaction(SIGHUP, &act, nullptr);
346 // Mostly for debugging. Don't override SIGINT, that's so evil if
347 // shutdown isn't instant.
348 memset(&act, 0, sizeof(act));
349 act.sa_handler = quit_signal;
350 act.sa_flags = SA_RESTART;
351 sigaction(SIGUSR1, &act, nullptr);
354 void MainWindow::reset_audio_mapping_ui()
356 bool simple = (global_audio_mixer->get_mapping_mode() == AudioMixer::MappingMode::SIMPLE);
358 ui->simple_audio_mode->setChecked(simple);
359 ui->multichannel_audio_mode->setChecked(!simple);
360 ui->input_mapping_action->setEnabled(!simple);
361 ui->midi_mapping_action->setEnabled(!simple);
363 ui->locut_enabled->setVisible(simple);
364 ui->gainstaging_label->setVisible(simple);
365 ui->gainstaging_knob->setVisible(simple);
366 ui->gainstaging_db_display->setVisible(simple);
367 ui->gainstaging_auto_checkbox->setVisible(simple);
368 ui->compressor_threshold_label->setVisible(simple);
369 ui->compressor_threshold_knob->setVisible(simple);
370 ui->compressor_threshold_db_display->setVisible(simple);
371 ui->compressor_enabled->setVisible(simple);
373 setup_audio_miniview();
374 setup_audio_expanded_view();
377 ui->audio_views->setCurrentIndex(0);
379 ui->compact_header->setVisible(!simple);
381 midi_mapper.refresh_highlights();
382 midi_mapper.refresh_lights();
385 void MainWindow::setup_audio_miniview()
387 // Remove any existing channels.
388 for (QLayoutItem *item; (item = ui->faders->takeAt(0)) != nullptr; ) {
389 delete item->widget();
392 audio_miniviews.clear();
394 if (global_audio_mixer->get_mapping_mode() == AudioMixer::MappingMode::SIMPLE) {
398 // Set up brand new ones from the input mapping.
399 InputMapping mapping = global_audio_mixer->get_input_mapping();
400 audio_miniviews.resize(mapping.buses.size());
401 for (unsigned bus_index = 0; bus_index < mapping.buses.size(); ++bus_index) {
402 QWidget *channel = new QWidget(this);
403 Ui::AudioMiniView *ui_audio_miniview = new Ui::AudioMiniView;
404 ui_audio_miniview->setupUi(channel);
405 ui_audio_miniview->bus_desc_label->setFullText(
406 QString::fromStdString(mapping.buses[bus_index].name));
407 audio_miniviews[bus_index] = ui_audio_miniview;
409 // Set up the peak meter.
410 VUMeter *peak_meter = ui_audio_miniview->peak_meter;
411 peak_meter->set_min_level(-30.0f);
412 peak_meter->set_max_level(0.0f);
413 peak_meter->set_ref_level(0.0f);
415 ui_audio_miniview->fader->setDbValue(global_audio_mixer->get_fader_volume(bus_index));
417 ui->faders->addWidget(channel);
419 connect(ui_audio_miniview->fader, &NonLinearFader::dbValueChanged,
420 bind(&MainWindow::mini_fader_changed, this, bus_index, _1));
421 connect(ui_audio_miniview->peak_display_label, &ClickableLabel::clicked,
423 global_audio_mixer->reset_peak(bus_index);
428 void MainWindow::setup_audio_expanded_view()
430 // Remove any existing channels.
431 for (QLayoutItem *item; (item = ui->buses->takeAt(0)) != nullptr; ) {
432 delete item->widget();
435 audio_expanded_views.clear();
437 if (global_audio_mixer->get_mapping_mode() == AudioMixer::MappingMode::SIMPLE) {
441 // Set up brand new ones from the input mapping.
442 InputMapping mapping = global_audio_mixer->get_input_mapping();
443 audio_expanded_views.resize(mapping.buses.size());
444 for (unsigned bus_index = 0; bus_index < mapping.buses.size(); ++bus_index) {
445 QWidget *channel = new QWidget(this);
446 Ui::AudioExpandedView *ui_audio_expanded_view = new Ui::AudioExpandedView;
447 ui_audio_expanded_view->setupUi(channel);
448 ui_audio_expanded_view->bus_desc_label->setFullText(
449 QString::fromStdString(mapping.buses[bus_index].name));
450 audio_expanded_views[bus_index] = ui_audio_expanded_view;
451 update_eq_label(bus_index, EQ_BAND_TREBLE, global_audio_mixer->get_eq(bus_index, EQ_BAND_TREBLE));
452 update_eq_label(bus_index, EQ_BAND_MID, global_audio_mixer->get_eq(bus_index, EQ_BAND_MID));
453 update_eq_label(bus_index, EQ_BAND_BASS, global_audio_mixer->get_eq(bus_index, EQ_BAND_BASS));
454 ui_audio_expanded_view->fader->setDbValue(global_audio_mixer->get_fader_volume(bus_index));
455 ui->buses->addWidget(channel);
457 ui_audio_expanded_view->locut_enabled->setChecked(global_audio_mixer->get_locut_enabled(bus_index));
458 connect(ui_audio_expanded_view->locut_enabled, &QCheckBox::stateChanged, [this, bus_index](int state){
459 global_audio_mixer->set_locut_enabled(bus_index, state == Qt::Checked);
460 midi_mapper.refresh_lights();
463 connect(ui_audio_expanded_view->treble_knob, &QDial::valueChanged,
464 bind(&MainWindow::eq_knob_changed, this, bus_index, EQ_BAND_TREBLE, _1));
465 connect(ui_audio_expanded_view->mid_knob, &QDial::valueChanged,
466 bind(&MainWindow::eq_knob_changed, this, bus_index, EQ_BAND_MID, _1));
467 connect(ui_audio_expanded_view->bass_knob, &QDial::valueChanged,
468 bind(&MainWindow::eq_knob_changed, this, bus_index, EQ_BAND_BASS, _1));
470 ui_audio_expanded_view->gainstaging_knob->setValue(global_audio_mixer->get_gain_staging_db(bus_index));
471 ui_audio_expanded_view->gainstaging_auto_checkbox->setChecked(global_audio_mixer->get_gain_staging_auto(bus_index));
472 ui_audio_expanded_view->compressor_enabled->setChecked(global_audio_mixer->get_compressor_enabled(bus_index));
474 connect(ui_audio_expanded_view->gainstaging_knob, &QAbstractSlider::valueChanged, bind(&MainWindow::gain_staging_knob_changed, this, bus_index, _1));
475 connect(ui_audio_expanded_view->gainstaging_auto_checkbox, &QCheckBox::stateChanged, [this, bus_index](int state){
476 global_audio_mixer->set_gain_staging_auto(bus_index, state == Qt::Checked);
477 midi_mapper.refresh_lights();
480 connect(ui_audio_expanded_view->compressor_threshold_knob, &QDial::valueChanged, bind(&MainWindow::compressor_threshold_knob_changed, this, bus_index, _1));
481 connect(ui_audio_expanded_view->compressor_enabled, &QCheckBox::stateChanged, [this, bus_index](int state){
482 global_audio_mixer->set_compressor_enabled(bus_index, state == Qt::Checked);
483 midi_mapper.refresh_lights();
486 slave_fader(audio_miniviews[bus_index]->fader, ui_audio_expanded_view->fader);
488 // Set up the peak meter.
489 VUMeter *peak_meter = ui_audio_expanded_view->peak_meter;
490 peak_meter->set_min_level(-30.0f);
491 peak_meter->set_max_level(0.0f);
492 peak_meter->set_ref_level(0.0f);
494 connect(ui_audio_expanded_view->peak_display_label, &ClickableLabel::clicked,
495 [this, bus_index]() {
496 global_audio_mixer->reset_peak(bus_index);
497 midi_mapper.refresh_lights();
500 // Set up the compression attenuation meter.
501 VUMeter *reduction_meter = ui_audio_expanded_view->reduction_meter;
502 reduction_meter->set_min_level(0.0f);
503 reduction_meter->set_max_level(10.0f);
504 reduction_meter->set_ref_level(0.0f);
505 reduction_meter->set_flip(true);
508 update_cutoff_labels(global_audio_mixer->get_locut_cutoff());
511 void MainWindow::mixer_shutting_down()
513 ui->me_live->clean_context();
514 ui->me_preview->clean_context();
515 for (Ui::Display *display : previews) {
516 display->display->clean_context();
520 void MainWindow::cut_triggered()
522 global_mixer->schedule_cut();
525 void MainWindow::x264_bitrate_triggered()
528 int new_bitrate = QInputDialog::getInt(this, "Change x264 bitrate", "Choose new bitrate for x264 HTTP output (from 100–100,000 kbit/sec):", global_flags.x264_bitrate, /*min=*/100, /*max=*/100000, /*step=*/100, &ok);
529 if (ok && new_bitrate >= 100 && new_bitrate <= 100000) {
530 global_flags.x264_bitrate = new_bitrate;
531 global_mixer->change_x264_bitrate(new_bitrate);
535 void MainWindow::exit_triggered()
540 void MainWindow::about_triggered()
542 AboutDialog().exec();
545 void MainWindow::simple_audio_mode_triggered()
547 if (global_audio_mixer->get_mapping_mode() == AudioMixer::MappingMode::SIMPLE) {
550 unsigned card_index = global_audio_mixer->get_simple_input();
551 if (card_index == numeric_limits<unsigned>::max()) {
552 QMessageBox::StandardButton reply =
553 QMessageBox::question(this,
554 "Mapping too complex",
555 "The current audio mapping is too complicated to be representable in simple mode, "
556 "and will be discarded if you proceed. Really go to simple audio mode?",
557 QMessageBox::Yes | QMessageBox::No);
558 if (reply == QMessageBox::No) {
559 ui->simple_audio_mode->setChecked(false);
560 ui->multichannel_audio_mode->setChecked(true);
565 global_audio_mixer->set_simple_input(/*card_index=*/card_index);
566 reset_audio_mapping_ui();
569 void MainWindow::multichannel_audio_mode_triggered()
571 if (global_audio_mixer->get_mapping_mode() == AudioMixer::MappingMode::MULTICHANNEL) {
575 // Take the generated input mapping from the simple input,
576 // and set it as a normal multichannel mapping, which causes
577 // the mode to go to multichannel.
578 global_audio_mixer->set_input_mapping(global_audio_mixer->get_input_mapping());
579 reset_audio_mapping_ui();
582 void MainWindow::input_mapping_triggered()
584 if (InputMappingDialog().exec() == QDialog::Accepted) {
585 setup_audio_miniview();
586 setup_audio_expanded_view();
588 midi_mapper.refresh_highlights();
589 midi_mapper.refresh_lights();
592 void MainWindow::midi_mapping_triggered()
594 MIDIMappingDialog(&midi_mapper).exec();
597 void MainWindow::gain_staging_knob_changed(unsigned bus_index, int value)
599 if (bus_index == 0) {
600 ui->gainstaging_auto_checkbox->setCheckState(Qt::Unchecked);
602 if (bus_index < audio_expanded_views.size()) {
603 audio_expanded_views[bus_index]->gainstaging_auto_checkbox->setCheckState(Qt::Unchecked);
606 float gain_db = value * 0.1f;
607 global_audio_mixer->set_gain_staging_db(bus_index, gain_db);
609 // The label will be updated by the audio level callback.
612 void MainWindow::final_makeup_gain_knob_changed(int value)
614 ui->makeup_gain_auto_checkbox->setCheckState(Qt::Unchecked);
616 float gain_db = value * 0.1f;
617 global_audio_mixer->set_final_makeup_gain_db(gain_db);
619 // The label will be updated by the audio level callback.
622 void MainWindow::cutoff_knob_changed(int value)
624 float octaves = value * 0.1f;
625 float cutoff_hz = 20.0 * pow(2.0, octaves);
626 global_audio_mixer->set_locut_cutoff(cutoff_hz);
627 update_cutoff_labels(cutoff_hz);
630 void MainWindow::update_cutoff_labels(float cutoff_hz)
633 snprintf(buf, sizeof(buf), "%ld Hz", lrintf(cutoff_hz));
634 ui->locut_cutoff_display->setText(buf);
635 ui->locut_cutoff_display_2->setText(buf);
637 for (unsigned bus_index = 0; bus_index < audio_expanded_views.size(); ++bus_index) {
638 audio_expanded_views[bus_index]->locut_enabled->setText(
639 QString("Lo-cut: ") + buf);
643 void MainWindow::report_disk_space(off_t free_bytes, double estimated_seconds_left)
646 if (estimated_seconds_left < 60.0) {
647 strcpy(time_str, "<font color=\"red\">Less than a minute</font>");
648 } else if (estimated_seconds_left < 1800.0) { // Less than half an hour: Xm Ys (red).
649 int s = lrintf(estimated_seconds_left);
652 snprintf(time_str, sizeof(time_str), "<font color=\"red\">%dm %ds</font>", m, s);
653 } else if (estimated_seconds_left < 3600.0) { // Less than an hour: Xm.
654 int m = lrintf(estimated_seconds_left / 60.0);
655 snprintf(time_str, sizeof(time_str), "%dm", m);
656 } else if (estimated_seconds_left < 36000.0) { // Less than ten hours: Xh Ym.
657 int m = lrintf(estimated_seconds_left / 60.0);
660 snprintf(time_str, sizeof(time_str), "%dh %dm", h, m);
661 } else { // More than ten hours: Xh.
662 int h = lrintf(estimated_seconds_left / 3600.0);
663 snprintf(time_str, sizeof(time_str), "%dh", h);
666 snprintf(buf, sizeof(buf), "Disk free: %'.0f MB (approx. %s)", free_bytes / 1048576.0, time_str);
668 std::string label = buf;
670 post_to_main_thread([this, label]{
671 disk_free_label->setText(QString::fromStdString(label));
672 ui->menuBar->setCornerWidget(disk_free_label); // Need to set this again for the sizing to get right.
676 void MainWindow::eq_knob_changed(unsigned bus_index, EQBand band, int value)
678 float gain_db = value * 0.1f;
679 global_audio_mixer->set_eq(bus_index, band, gain_db);
681 update_eq_label(bus_index, band, gain_db);
684 void MainWindow::update_eq_label(unsigned bus_index, EQBand band, float gain_db)
686 Ui::AudioExpandedView *view = audio_expanded_views[bus_index];
687 string db_string = format_db(gain_db, DB_WITH_SIGN);
690 view->treble_label->setText(QString::fromStdString("Treble: " + db_string));
693 view->mid_label->setText(QString::fromStdString("Mid: " + db_string));
696 view->bass_label->setText(QString::fromStdString("Bass: " + db_string));
703 void MainWindow::limiter_threshold_knob_changed(int value)
705 float threshold_dbfs = value * 0.1f;
706 global_audio_mixer->set_limiter_threshold_dbfs(threshold_dbfs);
707 ui->limiter_threshold_db_display->setText(
708 QString::fromStdString(format_db(threshold_dbfs, DB_WITH_SIGN)));
709 ui->limiter_threshold_db_display_2->setText(
710 QString::fromStdString(format_db(threshold_dbfs, DB_WITH_SIGN)));
713 void MainWindow::compressor_threshold_knob_changed(unsigned bus_index, int value)
715 float threshold_dbfs = value * 0.1f;
716 global_audio_mixer->set_compressor_threshold_dbfs(bus_index, threshold_dbfs);
718 QString label(QString::fromStdString(format_db(threshold_dbfs, DB_WITH_SIGN)));
719 if (bus_index == 0) {
720 ui->compressor_threshold_db_display->setText(label);
722 if (bus_index < audio_expanded_views.size()) {
723 audio_expanded_views[bus_index]->compressor_threshold_db_display->setText(label);
727 void MainWindow::mini_fader_changed(int bus, double volume_db)
729 QString label(QString::fromStdString(format_db(volume_db, DB_WITH_SIGN)));
730 audio_miniviews[bus]->fader_label->setText(label);
731 audio_expanded_views[bus]->fader_label->setText(label);
733 global_audio_mixer->set_fader_volume(bus, volume_db);
736 void MainWindow::reset_meters_button_clicked()
738 global_audio_mixer->reset_meters();
739 ui->peak_display->setText(QString::fromStdString(format_db(-HUGE_VAL, DB_WITH_SIGN | DB_BARE)));
740 ui->peak_display->setStyleSheet("");
743 void MainWindow::audio_level_callback(float level_lufs, float peak_db, vector<AudioMixer::BusLevel> bus_levels,
744 float global_level_lufs,
745 float range_low_lufs, float range_high_lufs,
746 float final_makeup_gain_db,
749 steady_clock::time_point now = steady_clock::now();
751 // The meters are somewhat inefficient to update. Only update them
752 // every 100 ms or so (we get updates every 5–20 ms). Note that this
753 // means that the digital peak meters are ever so slightly too low
754 // (each update won't be a faithful representation of the highest peak
755 // since the previous update, since there are frames we won't draw),
756 // but the _peak_ of the peak meters will be correct (it's tracked in
757 // AudioMixer, not here), and that's much more important.
758 double last_update_age = duration<double>(now - last_audio_level_callback).count();
759 if (last_update_age < 0.100) {
762 last_audio_level_callback = now;
764 post_to_main_thread([=]() {
765 ui->vu_meter->set_level(level_lufs);
766 for (unsigned bus_index = 0; bus_index < bus_levels.size(); ++bus_index) {
767 if (bus_index < audio_miniviews.size()) {
768 const AudioMixer::BusLevel &level = bus_levels[bus_index];
769 Ui::AudioMiniView *miniview = audio_miniviews[bus_index];
770 miniview->peak_meter->set_level(
771 level.current_level_dbfs[0], level.current_level_dbfs[1]);
772 miniview->peak_meter->set_peak(
773 level.peak_level_dbfs[0], level.peak_level_dbfs[1]);
774 set_peak_label(miniview->peak_display_label, level.historic_peak_dbfs);
776 Ui::AudioExpandedView *view = audio_expanded_views[bus_index];
777 view->peak_meter->set_level(
778 level.current_level_dbfs[0], level.current_level_dbfs[1]);
779 view->peak_meter->set_peak(
780 level.peak_level_dbfs[0], level.peak_level_dbfs[1]);
781 view->reduction_meter->set_level(level.compressor_attenuation_db);
782 view->gainstaging_knob->blockSignals(true);
783 view->gainstaging_knob->setValue(lrintf(level.gain_staging_db * 10.0f));
784 view->gainstaging_knob->blockSignals(false);
785 view->gainstaging_db_display->setText(
787 QString::fromStdString(format_db(level.gain_staging_db, DB_WITH_SIGN)));
788 set_peak_label(view->peak_display_label, level.historic_peak_dbfs);
790 midi_mapper.set_has_peaked(bus_index, level.historic_peak_dbfs >= -0.1f);
793 ui->lra_meter->set_levels(global_level_lufs, range_low_lufs, range_high_lufs);
794 ui->correlation_meter->set_correlation(correlation);
796 ui->peak_display->setText(QString::fromStdString(format_db(peak_db, DB_BARE)));
797 set_peak_label(ui->peak_display, peak_db);
799 // NOTE: Will be invisible when using multitrack audio.
800 ui->gainstaging_knob->blockSignals(true);
801 ui->gainstaging_knob->setValue(lrintf(bus_levels[0].gain_staging_db * 10.0f));
802 ui->gainstaging_knob->blockSignals(false);
803 ui->gainstaging_db_display->setText(
804 QString::fromStdString(format_db(bus_levels[0].gain_staging_db, DB_WITH_SIGN)));
806 ui->makeup_gain_knob->blockSignals(true);
807 ui->makeup_gain_knob->setValue(lrintf(final_makeup_gain_db * 10.0f));
808 ui->makeup_gain_knob->blockSignals(false);
809 ui->makeup_gain_db_display->setText(
810 QString::fromStdString(format_db(final_makeup_gain_db, DB_WITH_SIGN)));
811 ui->makeup_gain_db_display_2->setText(
812 QString::fromStdString(format_db(final_makeup_gain_db, DB_WITH_SIGN)));
814 // Peak labels could have changed.
815 midi_mapper.refresh_lights();
819 void MainWindow::relayout()
821 int height = ui->vertical_layout->geometry().height();
823 double remaining_height = height;
825 // Allocate the height; the most important part is to keep the main displays
826 // at 16:9 if at all possible.
827 double me_width = ui->me_preview->width();
828 double me_height = me_width * 9.0 / 16.0 + ui->label_preview->height() + ui->preview_vertical_layout->spacing();
830 // TODO: Scale the widths when we need to do this.
831 if (me_height / double(height) > 0.8) {
832 me_height = height * 0.8;
834 remaining_height -= me_height + ui->vertical_layout->spacing();
836 // Space between the M/E displays and the audio strip.
837 remaining_height -= ui->vertical_layout->spacing();
839 // The label above the audio strip.
840 double compact_label_height = ui->compact_label->minimumHeight() +
841 ui->compact_audio_layout->spacing();
842 remaining_height -= compact_label_height;
844 // The previews will be constrained by the remaining height, and the width.
845 double preview_label_height = previews[0]->title_bar->geometry().height() +
846 previews[0]->main_vertical_layout->spacing();
847 int preview_total_width = ui->preview_displays->geometry().width() - (previews.size() - 1) * ui->preview_displays->spacing();
848 double preview_height = min(remaining_height - preview_label_height, (preview_total_width / double(previews.size())) * 9.0 / 16.0);
849 remaining_height -= preview_height + preview_label_height + ui->vertical_layout->spacing();
851 ui->vertical_layout->setStretch(0, lrintf(me_height));
852 ui->vertical_layout->setStretch(1,
853 lrintf(compact_label_height) +
854 lrintf(remaining_height) +
855 lrintf(preview_height + preview_label_height)); // Audio strip and previews together.
857 ui->compact_audio_layout->setStretch(0, lrintf(compact_label_height));
858 ui->compact_audio_layout->setStretch(1, lrintf(remaining_height)); // Audio strip.
859 ui->compact_audio_layout->setStretch(2, lrintf(preview_height + preview_label_height));
861 // Set the widths for the previews.
862 double preview_width = preview_height * 16.0 / 9.0;
863 for (unsigned i = 0; i < previews.size(); ++i) {
864 ui->preview_displays->setStretch(i, lrintf(preview_width));
867 // The preview horizontal spacer.
868 double remaining_preview_width = preview_total_width - previews.size() * preview_width;
869 ui->preview_displays->setStretch(previews.size(), lrintf(remaining_preview_width));
872 void MainWindow::set_locut(float value)
874 set_relative_value(ui->locut_cutoff_knob, value);
877 void MainWindow::set_limiter_threshold(float value)
879 set_relative_value(ui->limiter_threshold_knob, value);
882 void MainWindow::set_makeup_gain(float value)
884 set_relative_value(ui->makeup_gain_knob, value);
887 void MainWindow::set_treble(unsigned bus_idx, float value)
889 set_relative_value_if_exists(bus_idx, &Ui::AudioExpandedView::treble_knob, value);
892 void MainWindow::set_mid(unsigned bus_idx, float value)
894 set_relative_value_if_exists(bus_idx, &Ui::AudioExpandedView::mid_knob, value);
897 void MainWindow::set_bass(unsigned bus_idx, float value)
899 set_relative_value_if_exists(bus_idx, &Ui::AudioExpandedView::bass_knob, value);
902 void MainWindow::set_gain(unsigned bus_idx, float value)
904 set_relative_value_if_exists(bus_idx, &Ui::AudioExpandedView::gainstaging_knob, value);
907 void MainWindow::set_compressor_threshold(unsigned bus_idx, float value)
909 set_relative_value_if_exists(bus_idx, &Ui::AudioExpandedView::compressor_threshold_knob, value);
912 void MainWindow::set_fader(unsigned bus_idx, float value)
914 set_relative_value_if_exists(bus_idx, &Ui::AudioExpandedView::fader, value);
917 void MainWindow::toggle_locut(unsigned bus_idx)
919 click_button_if_exists(bus_idx, &Ui::AudioExpandedView::locut_enabled);
922 void MainWindow::toggle_auto_gain_staging(unsigned bus_idx)
924 click_button_if_exists(bus_idx, &Ui::AudioExpandedView::gainstaging_auto_checkbox);
927 void MainWindow::toggle_compressor(unsigned bus_idx)
929 click_button_if_exists(bus_idx, &Ui::AudioExpandedView::compressor_enabled);
932 void MainWindow::clear_peak(unsigned bus_idx)
934 post_to_main_thread([=]{
935 if (global_audio_mixer->get_mapping_mode() == AudioMixer::MappingMode::MULTICHANNEL) {
936 global_audio_mixer->reset_peak(bus_idx);
937 midi_mapper.set_has_peaked(bus_idx, false);
938 midi_mapper.refresh_lights();
943 void MainWindow::clear_all_highlights()
945 post_to_main_thread([this]{
946 highlight_locut(false);
947 highlight_limiter_threshold(false);
948 highlight_makeup_gain(false);
949 highlight_toggle_limiter(false);
950 highlight_toggle_auto_makeup_gain(false);
951 for (unsigned bus_idx = 0; bus_idx < audio_expanded_views.size(); ++bus_idx) {
952 highlight_treble(bus_idx, false);
953 highlight_mid(bus_idx, false);
954 highlight_bass(bus_idx, false);
955 highlight_gain(bus_idx, false);
956 highlight_compressor_threshold(bus_idx, false);
957 highlight_fader(bus_idx, false);
958 highlight_toggle_locut(bus_idx, false);
959 highlight_toggle_auto_gain_staging(bus_idx, false);
960 highlight_toggle_compressor(bus_idx, false);
965 void MainWindow::toggle_limiter()
967 if (global_audio_mixer->get_mapping_mode() == AudioMixer::MappingMode::MULTICHANNEL) {
968 ui->limiter_enabled->click();
972 void MainWindow::toggle_auto_makeup_gain()
974 if (global_audio_mixer->get_mapping_mode() == AudioMixer::MappingMode::MULTICHANNEL) {
975 ui->makeup_gain_auto_checkbox->click();
979 void MainWindow::highlight_locut(bool highlight)
981 post_to_main_thread([this, highlight]{
982 highlight_control(ui->locut_cutoff_knob, highlight);
983 highlight_control(ui->locut_cutoff_knob_2, highlight);
987 void MainWindow::highlight_limiter_threshold(bool highlight)
989 post_to_main_thread([this, highlight]{
990 highlight_control(ui->limiter_threshold_knob, highlight);
991 highlight_control(ui->limiter_threshold_knob_2, highlight);
995 void MainWindow::highlight_makeup_gain(bool highlight)
997 post_to_main_thread([this, highlight]{
998 highlight_control(ui->makeup_gain_knob, highlight);
999 highlight_control(ui->makeup_gain_knob_2, highlight);
1003 void MainWindow::highlight_treble(unsigned bus_idx, bool highlight)
1005 highlight_control_if_exists(bus_idx, &Ui::AudioExpandedView::treble_knob, highlight);
1008 void MainWindow::highlight_mid(unsigned bus_idx, bool highlight)
1010 highlight_control_if_exists(bus_idx, &Ui::AudioExpandedView::mid_knob, highlight);
1013 void MainWindow::highlight_bass(unsigned bus_idx, bool highlight)
1015 highlight_control_if_exists(bus_idx, &Ui::AudioExpandedView::bass_knob, highlight);
1018 void MainWindow::highlight_gain(unsigned bus_idx, bool highlight)
1020 highlight_control_if_exists(bus_idx, &Ui::AudioExpandedView::gainstaging_knob, highlight);
1023 void MainWindow::highlight_compressor_threshold(unsigned bus_idx, bool highlight)
1025 highlight_control_if_exists(bus_idx, &Ui::AudioExpandedView::compressor_threshold_knob, highlight);
1028 void MainWindow::highlight_fader(unsigned bus_idx, bool highlight)
1030 highlight_control_if_exists(bus_idx, &Ui::AudioExpandedView::fader, highlight);
1033 void MainWindow::highlight_toggle_locut(unsigned bus_idx, bool highlight)
1035 highlight_control_if_exists(bus_idx, &Ui::AudioExpandedView::locut_enabled, highlight);
1038 void MainWindow::highlight_toggle_auto_gain_staging(unsigned bus_idx, bool highlight)
1040 highlight_control_if_exists(bus_idx, &Ui::AudioExpandedView::gainstaging_auto_checkbox, highlight);
1043 void MainWindow::highlight_toggle_compressor(unsigned bus_idx, bool highlight)
1045 highlight_control_if_exists(bus_idx, &Ui::AudioExpandedView::compressor_enabled, highlight);
1048 void MainWindow::highlight_toggle_limiter(bool highlight)
1050 post_to_main_thread([this, highlight]{
1051 highlight_control(ui->limiter_enabled, highlight);
1052 highlight_control(ui->limiter_enabled_2, highlight);
1056 void MainWindow::highlight_toggle_auto_makeup_gain(bool highlight)
1058 post_to_main_thread([this, highlight]{
1059 highlight_control(ui->makeup_gain_auto_checkbox, highlight);
1060 highlight_control(ui->makeup_gain_auto_checkbox_2, highlight);
1065 void MainWindow::set_relative_value(T *control, float value)
1067 post_to_main_thread([control, value]{
1068 control->setValue(lrintf(control->minimum() + value * (control->maximum() - control->minimum())));
1073 void MainWindow::set_relative_value_if_exists(unsigned bus_idx, T *(Ui_AudioExpandedView::*control), float value)
1075 if (global_audio_mixer != nullptr &&
1076 global_audio_mixer->get_mapping_mode() == AudioMixer::MappingMode::MULTICHANNEL &&
1077 bus_idx < audio_expanded_views.size()) {
1078 set_relative_value(audio_expanded_views[bus_idx]->*control, value);
1083 void MainWindow::click_button_if_exists(unsigned bus_idx, T *(Ui_AudioExpandedView::*control))
1085 post_to_main_thread([this, bus_idx, control]{
1086 if (global_audio_mixer != nullptr &&
1087 global_audio_mixer->get_mapping_mode() == AudioMixer::MappingMode::MULTICHANNEL &&
1088 bus_idx < audio_expanded_views.size()) {
1089 (audio_expanded_views[bus_idx]->*control)->click();
1095 void MainWindow::highlight_control(T *control, bool highlight)
1097 if (control == nullptr) {
1100 if (global_audio_mixer == nullptr ||
1101 global_audio_mixer->get_mapping_mode() != AudioMixer::MappingMode::MULTICHANNEL) {
1105 control->setStyleSheet("background: rgb(0,255,0,80)");
1107 control->setStyleSheet("");
1112 void MainWindow::highlight_control_if_exists(unsigned bus_idx, T *(Ui_AudioExpandedView::*control), bool highlight)
1114 post_to_main_thread([this, bus_idx, control, highlight]{
1115 if (bus_idx < audio_expanded_views.size()) {
1116 highlight_control(audio_expanded_views[bus_idx]->*control, highlight);
1121 void MainWindow::set_transition_names(vector<string> transition_names)
1123 if (transition_names.size() < 1 || transition_names[0].empty()) {
1124 transition_btn1->setText(QString(""));
1126 transition_btn1->setText(QString::fromStdString(transition_names[0] + " (J)"));
1127 ui->transition_btn1->setShortcut(QKeySequence("J"));
1129 if (transition_names.size() < 2 || transition_names[1].empty()) {
1130 transition_btn2->setText(QString(""));
1132 transition_btn2->setText(QString::fromStdString(transition_names[1] + " (K)"));
1133 ui->transition_btn2->setShortcut(QKeySequence("K"));
1135 if (transition_names.size() < 3 || transition_names[2].empty()) {
1136 transition_btn3->setText(QString(""));
1138 transition_btn3->setText(QString::fromStdString(transition_names[2] + " (L)"));
1139 ui->transition_btn3->setShortcut(QKeySequence("L"));
1143 void MainWindow::update_channel_name(Mixer::Output output, const string &name)
1145 if (output >= Mixer::OUTPUT_INPUT0) {
1146 unsigned channel = output - Mixer::OUTPUT_INPUT0;
1147 previews[channel]->label->setText(name.c_str());
1151 void MainWindow::update_channel_color(Mixer::Output output, const string &color)
1153 if (output >= Mixer::OUTPUT_INPUT0) {
1154 unsigned channel = output - Mixer::OUTPUT_INPUT0;
1155 previews[channel]->frame->setStyleSheet(QString::fromStdString("background-color:" + color));
1159 void MainWindow::transition_clicked(int transition_number)
1161 global_mixer->transition_clicked(transition_number);
1164 void MainWindow::channel_clicked(int channel_number)
1166 if (current_wb_pick_display == channel_number) {
1167 // The picking was already done from eventFilter(), since we don't get
1168 // the mouse pointer here.
1170 global_mixer->channel_clicked(channel_number);
1174 void MainWindow::wb_button_clicked(int channel_number)
1176 current_wb_pick_display = channel_number;
1177 QApplication::setOverrideCursor(Qt::CrossCursor);
1180 bool MainWindow::eventFilter(QObject *watched, QEvent *event)
1182 if (current_wb_pick_display != -1 &&
1183 event->type() == QEvent::MouseButtonRelease &&
1184 watched->isWidgetType()) {
1185 QApplication::restoreOverrideCursor();
1186 if (watched == previews[current_wb_pick_display]->display) {
1187 const QMouseEvent *mouse_event = (QMouseEvent *)event;
1188 set_white_balance(current_wb_pick_display, mouse_event->x(), mouse_event->y());
1190 // The user clicked on something else, give up.
1191 // (The click goes through, which might not be ideal, but, yes.)
1192 current_wb_pick_display = -1;
1200 double srgb_to_linear(double x)
1205 return pow((x + 0.055) / 1.055, 2.4);
1211 void MainWindow::set_white_balance(int channel_number, int x, int y)
1213 // Set the white balance to neutral for the grab. It's probably going to
1214 // flicker a bit, but hopefully this display is not live anyway.
1215 global_mixer->set_wb(Mixer::OUTPUT_INPUT0 + channel_number, 0.5, 0.5, 0.5);
1216 previews[channel_number]->display->updateGL();
1217 QRgb reference_color = previews[channel_number]->display->grabFrameBuffer().pixel(x, y);
1219 double r = srgb_to_linear(qRed(reference_color) / 255.0);
1220 double g = srgb_to_linear(qGreen(reference_color) / 255.0);
1221 double b = srgb_to_linear(qBlue(reference_color) / 255.0);
1222 global_mixer->set_wb(Mixer::OUTPUT_INPUT0 + channel_number, r, g, b);
1223 previews[channel_number]->display->updateGL();
1226 void MainWindow::audio_state_changed()
1228 post_to_main_thread([this]{
1229 InputMapping mapping = global_audio_mixer->get_input_mapping();
1230 for (unsigned bus_index = 0; bus_index < mapping.buses.size(); ++bus_index) {
1231 const InputMapping::Bus &bus = mapping.buses[bus_index];
1233 if (bus.device.type == InputSourceType::ALSA_INPUT) {
1234 ALSAPool::Device::State state = global_audio_mixer->get_alsa_card_state(bus.device.index);
1235 if (state == ALSAPool::Device::State::STARTING) {
1237 } else if (state == ALSAPool::Device::State::DEAD) {
1242 audio_miniviews[bus_index]->bus_desc_label->setFullText(
1243 QString::fromStdString(bus.name + suffix));
1244 audio_expanded_views[bus_index]->bus_desc_label->setFullText(
1245 QString::fromStdString(bus.name + suffix));