+ mixer->get_audio_mixer()->set_audio_level_callback(bind(&MainWindow::audio_level_callback, this, _1, _2, _3, _4, _5, _6, _7, _8));
+
+ struct sigaction act;
+ memset(&act, 0, sizeof(act));
+ act.sa_handler = schedule_cut_signal;
+ act.sa_flags = SA_RESTART;
+ sigaction(SIGHUP, &act, nullptr);
+
+ // Mostly for debugging. Don't override SIGINT, that's so evil if
+ // shutdown isn't instant.
+ memset(&act, 0, sizeof(act));
+ act.sa_handler = quit_signal;
+ act.sa_flags = SA_RESTART;
+ sigaction(SIGUSR1, &act, nullptr);
+}
+
+void MainWindow::setup_audio_miniview()
+{
+ // Remove any existing channels.
+ for (QLayoutItem *item; (item = ui->faders->takeAt(0)) != nullptr; ) {
+ delete item->widget();
+ delete item;
+ }
+ audio_miniviews.clear();
+
+ // Set up brand new ones from the input mapping.
+ InputMapping mapping = global_mixer->get_audio_mixer()->get_input_mapping();
+ audio_miniviews.resize(mapping.buses.size());
+ for (unsigned bus_index = 0; bus_index < mapping.buses.size(); ++bus_index) {
+ QWidget *channel = new QWidget(this);
+ Ui::AudioMiniView *ui_audio_miniview = new Ui::AudioMiniView;
+ ui_audio_miniview->setupUi(channel);
+ ui_audio_miniview->bus_desc_label->setFullText(
+ QString::fromStdString(mapping.buses[bus_index].name));
+ audio_miniviews[bus_index] = ui_audio_miniview;
+ // TODO: Set the fader position.
+ ui->faders->addWidget(channel);
+
+ connect(ui_audio_miniview->fader, &NonLinearFader::dbValueChanged,
+ bind(&MainWindow::mini_fader_changed, this, bus_index, _1));
+ }
+}
+
+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);
+
+ ui_audio_expanded_view->locut_enabled->setChecked(global_mixer->get_audio_mixer()->get_locut_enabled(bus_index));
+ connect(ui_audio_expanded_view->locut_enabled, &QCheckBox::stateChanged, [this, bus_index](int state){
+ global_mixer->get_audio_mixer()->set_locut_enabled(bus_index, state == Qt::Checked);
+ });
+
+ ui_audio_expanded_view->gainstaging_knob->setValue(global_mixer->get_audio_mixer()->get_gain_staging_db(bus_index));
+ ui_audio_expanded_view->gainstaging_auto_checkbox->setChecked(global_mixer->get_audio_mixer()->get_gain_staging_auto(bus_index));
+ ui_audio_expanded_view->compressor_enabled->setChecked(global_mixer->get_audio_mixer()->get_compressor_enabled(bus_index));
+
+ connect(ui_audio_expanded_view->gainstaging_knob, &QAbstractSlider::valueChanged, bind(&MainWindow::gain_staging_knob_changed, this, bus_index, _1));
+ connect(ui_audio_expanded_view->gainstaging_auto_checkbox, &QCheckBox::stateChanged, [this, bus_index](int state){
+ global_mixer->get_audio_mixer()->set_gain_staging_auto(bus_index, state == Qt::Checked);
+ });
+
+ connect(ui_audio_expanded_view->compressor_threshold_knob, &QDial::valueChanged, bind(&MainWindow::compressor_threshold_knob_changed, this, bus_index, _1));
+ connect(ui_audio_expanded_view->compressor_enabled, &QCheckBox::stateChanged, [this, bus_index](int state){
+ global_mixer->get_audio_mixer()->set_compressor_enabled(bus_index, state == Qt::Checked);
+ });
+
+ slave_fader(audio_miniviews[bus_index]->fader, ui_audio_expanded_view->fader);
+
+ // Set up the compression attenuation meter.
+ VUMeter *reduction_meter = ui_audio_expanded_view->reduction_meter;
+ reduction_meter->set_min_level(0.0f);
+ reduction_meter->set_max_level(10.0f);
+ reduction_meter->set_ref_level(0.0f);
+ reduction_meter->set_flip(true);
+ }