#include "mixer.h"
#include "post_to_main_thread.h"
#include "ui_audio_miniview.h"
+#include "ui_audio_expanded_view.h"
#include "ui_display.h"
#include "ui_mainwindow.h"
#include "vumeter.h"
global_mainwindow->close();
}
+void slave_knob(QDial *master, QDial *slave)
+{
+ QWidget::connect(master, &QDial::valueChanged, [slave](int value){
+ slave->blockSignals(true);
+ slave->setValue(value);
+ slave->blockSignals(false);
+ });
+ QWidget::connect(slave, &QDial::valueChanged, [master](int value){
+ master->setValue(value);
+ });
+}
+
+void slave_checkbox(QCheckBox *master, QCheckBox *slave)
+{
+ QWidget::connect(master, &QCheckBox::stateChanged, [slave](int state){
+ slave->blockSignals(true);
+ slave->setCheckState(Qt::CheckState(state));
+ slave->blockSignals(false);
+ });
+ QWidget::connect(slave, &QCheckBox::stateChanged, [master](int state){
+ master->setCheckState(Qt::CheckState(state));
+ });
+}
+
constexpr unsigned DB_NO_FLAGS = 0x0;
constexpr unsigned DB_WITH_SIGN = 0x1;
constexpr unsigned DB_BARE = 0x2;
connect(ui->me_live, &GLWidget::transition_names_updated, this, &MainWindow::set_transition_names);
qRegisterMetaType<Mixer::Output>("Mixer::Output");
+ // Hook up the prev/next buttons on the audio views.
+ connect(ui->compact_prev_page, &QAbstractButton::clicked, bind(&QStackedWidget::setCurrentIndex, ui->audio_views, 1));
+ connect(ui->compact_next_page, &QAbstractButton::clicked, bind(&QStackedWidget::setCurrentIndex, ui->audio_views, 1));
+ connect(ui->full_prev_page, &QAbstractButton::clicked, bind(&QStackedWidget::setCurrentIndex, ui->audio_views, 0));
+ connect(ui->full_next_page, &QAbstractButton::clicked, bind(&QStackedWidget::setCurrentIndex, ui->audio_views, 0));
+
last_audio_level_callback = steady_clock::now() - seconds(1);
}
}
setup_audio_miniview();
+ setup_audio_expanded_view();
+
+ slave_knob(ui->locut_cutoff_knob, ui->locut_cutoff_knob_2);
+ slave_knob(ui->limiter_threshold_knob, ui->limiter_threshold_knob_2);
+ slave_knob(ui->makeup_gain_knob, ui->makeup_gain_knob_2);
+ slave_checkbox(ui->makeup_gain_auto_checkbox, ui->makeup_gain_auto_checkbox_2);
+ slave_checkbox(ui->limiter_enabled, ui->limiter_enabled_2);
// TODO: Fetch all of the values these for completeness,
// not just the enable knobs implied by flags.
ui->limiter_enabled->setChecked(global_mixer->get_audio_mixer()->get_limiter_enabled());
ui->makeup_gain_auto_checkbox->setChecked(global_mixer->get_audio_mixer()->get_final_makeup_gain_auto());
- ui->limiter_threshold_db_display->setText(
+ QString limiter_threshold_label(
QString::fromStdString(format_db(mixer->get_audio_mixer()->get_limiter_threshold_dbfs(), DB_WITH_SIGN)));
+ ui->limiter_threshold_db_display->setText(limiter_threshold_label);
+ ui->limiter_threshold_db_display_2->setText(limiter_threshold_label);
ui->compressor_threshold_db_display->setText(
QString::fromStdString(format_db(mixer->get_audio_mixer()->get_compressor_threshold_dbfs(), DB_WITH_SIGN)));
}
}
+void MainWindow::setup_audio_expanded_view()
+{
+ // Remove any existing channels.
+ for (QLayoutItem *item; (item = ui->buses->takeAt(0)) != nullptr; ) {
+ delete item->widget();
+ delete item;
+ }
+ audio_expanded_views.clear();
+
+ // Set up brand new ones from the input mapping.
+ InputMapping mapping = global_mixer->get_audio_mixer()->get_input_mapping();
+ audio_expanded_views.resize(mapping.buses.size());
+ for (unsigned bus_index = 0; bus_index < mapping.buses.size(); ++bus_index) {
+ QWidget *channel = new QWidget(this);
+ Ui::AudioExpandedView *ui_audio_expanded_view = new Ui::AudioExpandedView;
+ ui_audio_expanded_view->setupUi(channel);
+ ui_audio_expanded_view->bus_desc_label->setFullText(
+ QString::fromStdString(mapping.buses[bus_index].name));
+ audio_expanded_views[bus_index] = ui_audio_expanded_view;
+ // TODO: Set the fader position.
+ ui->buses->addWidget(channel);
+
+ //connect(ui_audio_expanded_view->fader, &NonLinearFader::dbValueChanged,
+ // bind(&MainWindow::mini_fader_changed, this, ui_audio_expanded_view, bus_index, _1));
+ }
+}
+
void MainWindow::mixer_shutting_down()
{
ui->me_live->clean_context();
{
if (InputMappingDialog().exec() == QDialog::Accepted) {
setup_audio_miniview();
+ setup_audio_expanded_view();
}
}
char buf[256];
snprintf(buf, sizeof(buf), "%ld Hz", lrintf(cutoff_hz));
ui->locut_cutoff_display->setText(buf);
+ ui->locut_cutoff_display_2->setText(buf);
}
void MainWindow::report_disk_space(off_t free_bytes, double estimated_seconds_left)
global_mixer->get_audio_mixer()->set_limiter_threshold_dbfs(threshold_dbfs);
ui->limiter_threshold_db_display->setText(
QString::fromStdString(format_db(threshold_dbfs, DB_WITH_SIGN)));
+ ui->limiter_threshold_db_display_2->setText(
+ QString::fromStdString(format_db(threshold_dbfs, DB_WITH_SIGN)));
}
void MainWindow::compressor_threshold_knob_changed(int value)
ui->makeup_gain_knob->blockSignals(false);
ui->makeup_gain_db_display->setText(
QString::fromStdString(format_db(final_makeup_gain_db, DB_WITH_SIGN)));
+ ui->makeup_gain_db_display_2->setText(
+ QString::fromStdString(format_db(final_makeup_gain_db, DB_WITH_SIGN)));
});
}
// Space between the M/E displays and the audio strip.
remaining_height -= ui->vertical_layout->spacing();
+ // The label above the audio strip.
+ double compact_label_height = ui->compact_label->geometry().height() +
+ ui->compact_audio_layout->spacing();
+ remaining_height -= compact_label_height;
+
// The previews will be constrained by the remaining height, and the width.
double preview_label_height = previews[0]->title_bar->geometry().height() +
previews[0]->main_vertical_layout->spacing();
remaining_height -= preview_height + preview_label_height + ui->vertical_layout->spacing();
ui->vertical_layout->setStretch(0, lrintf(me_height));
- ui->vertical_layout->setStretch(1, lrintf(remaining_height)); // Audio strip.
- ui->vertical_layout->setStretch(2, lrintf(preview_height + preview_label_height));
+ ui->vertical_layout->setStretch(1,
+ lrintf(compact_label_height) +
+ lrintf(remaining_height) +
+ lrintf(preview_height + preview_label_height)); // Audio strip and previews together.
+
+ ui->compact_audio_layout->setStretch(0, lrintf(compact_label_height));
+ ui->compact_audio_layout->setStretch(1, lrintf(remaining_height)); // Audio strip.
+ ui->compact_audio_layout->setStretch(2, lrintf(preview_height + preview_label_height));
// Set the widths for the previews.
double preview_width = preview_height * 16.0 / 9.0;