]> git.sesse.net Git - nageru/commitdiff
Add the two final missing MIDI mappings, namely buttons for toggling limiter and...
authorSteinar H. Gunderson <sgunderson@bigfoot.com>
Mon, 17 Oct 2016 22:54:01 +0000 (00:54 +0200)
committerSteinar H. Gunderson <sgunderson@bigfoot.com>
Tue, 25 Oct 2016 16:48:14 +0000 (18:48 +0200)
mainwindow.cpp
mainwindow.h
midi_mapper.cpp
midi_mapper.h
midi_mapping.proto
midi_mapping_dialog.cpp
midi_mapping_dialog.h

index d1826bc2238ff0227cae02dd61a73a9e07a6c7a8..79221e162e8cb89c6317407a55fc83594b0df29e 100644 (file)
@@ -919,6 +919,8 @@ void MainWindow::clear_all_highlights()
                highlight_locut(false);
                highlight_limiter_threshold(false);
                highlight_makeup_gain(false);
+               highlight_toggle_limiter(false);
+               highlight_toggle_auto_makeup_gain(false);
                for (unsigned bus_idx = 0; bus_idx < audio_expanded_views.size(); ++bus_idx) {
                        highlight_treble(bus_idx, false);
                        highlight_mid(bus_idx, false);
@@ -933,6 +935,20 @@ void MainWindow::clear_all_highlights()
        });
 }
 
+void MainWindow::toggle_limiter()
+{
+       if (global_audio_mixer->get_mapping_mode() == AudioMixer::MappingMode::MULTICHANNEL) {
+               ui->limiter_enabled->click();
+       }
+}
+
+void MainWindow::toggle_auto_makeup_gain()
+{
+       if (global_audio_mixer->get_mapping_mode() == AudioMixer::MappingMode::MULTICHANNEL) {
+               ui->makeup_gain_auto_checkbox->click();
+       }
+}
+
 void MainWindow::highlight_locut(bool highlight)
 {
        post_to_main_thread([this, highlight]{
@@ -1002,6 +1018,22 @@ void MainWindow::highlight_toggle_compressor(unsigned bus_idx, bool highlight)
        highlight_control_if_exists(bus_idx, &Ui::AudioExpandedView::compressor_enabled, highlight);
 }
 
+void MainWindow::highlight_toggle_limiter(bool highlight)
+{
+       post_to_main_thread([this, highlight]{
+               highlight_control(ui->limiter_enabled, highlight);
+               highlight_control(ui->limiter_enabled_2, highlight);
+       });
+}
+
+void MainWindow::highlight_toggle_auto_makeup_gain(bool highlight)
+{
+       post_to_main_thread([this, highlight]{
+               highlight_control(ui->makeup_gain_auto_checkbox, highlight);
+               highlight_control(ui->makeup_gain_auto_checkbox_2, highlight);
+       });
+}
+
 template<class T>
 void MainWindow::set_relative_value(T *control, float value)
 {
index 0d3906d091b34347b6f6bcc47164bf09e5c5ce89..f0729a6a122ad64bac62e334f93f10ba880cc8e8 100644 (file)
@@ -79,6 +79,8 @@ public slots:
        void toggle_auto_gain_staging(unsigned bus_idx) override;
        void toggle_compressor(unsigned bus_idx) override;
        void clear_peak(unsigned bus_idx) override;
+       void toggle_limiter() override;
+       void toggle_auto_makeup_gain() override;
 
        void clear_all_highlights() override;
 
@@ -97,6 +99,8 @@ public slots:
        void highlight_toggle_auto_gain_staging(unsigned bus_idx, bool highlight) override;
        void highlight_toggle_compressor(unsigned bus_idx, bool highlight) override;
        void highlight_clear_peak(unsigned bus_idx, bool highlight) override {}  // We don't mark this currently.
+       void highlight_toggle_limiter(bool highlight) override;
+       void highlight_toggle_auto_makeup_gain(bool highlight) override;
 
        // Raw receivers are not used.
        void controller_changed(unsigned controller) override {}
index b93f48205d24e23492b215e90dc53196eaac6a42..220e176b7f6bc0895822420c288b2fbe99364e27 100644 (file)
@@ -300,6 +300,10 @@ void MIDIMapper::handle_event(snd_seq_t *seq, snd_seq_event_t *event)
                        bind(&ControllerReceiver::toggle_compressor, receiver, _1));
                match_button(note, MIDIMappingBusProto::kClearPeakFieldNumber, MIDIMappingProto::kClearPeakBankFieldNumber,
                        bind(&ControllerReceiver::clear_peak, receiver, _1));
+               match_button(note, MIDIMappingBusProto::kToggleLimiterFieldNumber, MIDIMappingProto::kToggleLimiterBankFieldNumber,
+                       bind(&ControllerReceiver::toggle_limiter, receiver));
+               match_button(note, MIDIMappingBusProto::kToggleAutoMakeupGainFieldNumber, MIDIMappingProto::kToggleAutoMakeupGainBankFieldNumber,
+                       bind(&ControllerReceiver::toggle_auto_makeup_gain, receiver));
        }
        case SND_SEQ_EVENT_PORT_START:
                subscribe_to_port(seq, event->data.addr);
@@ -414,6 +418,8 @@ void MIDIMapper::update_highlights()
        bool highlight_locut = false;
        bool highlight_limiter_threshold = false;
        bool highlight_makeup_gain = false;
+       bool highlight_toggle_limiter = false;
+       bool highlight_toggle_auto_makeup_gain = false;
        for (size_t bus_idx = 0; bus_idx < size_t(mapping_proto->bus_mapping_size()); ++bus_idx) {
                if (has_active_controller(
                        bus_idx, MIDIMappingBusProto::kLocutFieldNumber, MIDIMappingProto::kLocutBankFieldNumber)) {
@@ -427,10 +433,20 @@ void MIDIMapper::update_highlights()
                        bus_idx, MIDIMappingBusProto::kMakeupGainFieldNumber, MIDIMappingProto::kMakeupGainBankFieldNumber)) {
                        highlight_makeup_gain = true;
                }
+               if (has_active_controller(
+                       bus_idx, MIDIMappingBusProto::kToggleLimiterFieldNumber, MIDIMappingProto::kToggleLimiterBankFieldNumber)) {
+                       highlight_toggle_limiter = true;
+               }
+               if (has_active_controller(
+                       bus_idx, MIDIMappingBusProto::kToggleAutoMakeupGainFieldNumber, MIDIMappingProto::kToggleAutoMakeupGainBankFieldNumber)) {
+                       highlight_toggle_auto_makeup_gain = true;
+               }
        }
        receiver->highlight_locut(highlight_locut);
        receiver->highlight_limiter_threshold(highlight_limiter_threshold);
        receiver->highlight_makeup_gain(highlight_makeup_gain);
+       receiver->highlight_toggle_limiter(highlight_toggle_limiter);
+       receiver->highlight_toggle_auto_makeup_gain(highlight_toggle_auto_makeup_gain);
 
        // Per-bus controllers.
        for (size_t bus_idx = 0; bus_idx < size_t(mapping_proto->bus_mapping_size()); ++bus_idx) {
index 0a6694bd6a6ca0bcf85b78033acb53a68ffc27b2..49c98cc31676d142d8d01b314556fe3e033965f7 100644 (file)
@@ -39,6 +39,8 @@ public:
        virtual void toggle_auto_gain_staging(unsigned bus_idx) = 0;
        virtual void toggle_compressor(unsigned bus_idx) = 0;
        virtual void clear_peak(unsigned bus_idx) = 0;
+       virtual void toggle_limiter() = 0;
+       virtual void toggle_auto_makeup_gain() = 0;
 
        // Signals to highlight controls to mark them to the user
        // as MIDI-controllable (or not).
@@ -59,6 +61,8 @@ public:
        virtual void highlight_toggle_auto_gain_staging(unsigned bus_idx, bool highlight) = 0;
        virtual void highlight_toggle_compressor(unsigned bus_idx, bool highlight) = 0;
        virtual void highlight_clear_peak(unsigned bus_idx, bool highlight) = 0;
+       virtual void highlight_toggle_limiter(bool highlight) = 0;
+       virtual void highlight_toggle_auto_makeup_gain(bool highlight) = 0;
 
        // Raw events; used for the editor dialog only.
        virtual void controller_changed(unsigned controller) = 0;
index 4647a85873c0a1d552ecbfed81f84e121df672f8..5809ffe02bfb1cc95f5405931beab4bd961a42dd 100644 (file)
@@ -45,15 +45,17 @@ message MIDIMappingBusProto {
        optional MIDIButtonProto select_bank_3 = 16;
        optional MIDIButtonProto select_bank_4 = 17;
        optional MIDIButtonProto select_bank_5 = 18;
+       optional MIDIButtonProto toggle_limiter = 19;
+       optional MIDIButtonProto toggle_auto_makeup_gain = 20;
 
        // These are also global (they belong to the master bus), and unlike
        // the bank change commands, one would usually have only one of each,
        // but there's no reason to limit them to one each, and the editor UI
        // becomes simpler if they are the treated the same way as the bank
        // commands.
-       optional MIDIControllerProto locut = 19;
-       optional MIDIControllerProto limiter_threshold = 20;
-       optional MIDIControllerProto makeup_gain = 21;
+       optional MIDIControllerProto locut = 21;
+       optional MIDIControllerProto limiter_threshold = 22;
+       optional MIDIControllerProto makeup_gain = 23;
 }
 
 // The top-level protobuf, containing all the bus mappings, as well as
@@ -87,5 +89,9 @@ message MIDIMappingProto {
        optional int32 limiter_threshold_bank = 13;
        optional int32 makeup_gain_bank = 14;
 
-       repeated MIDIMappingBusProto bus_mapping = 15;
+       // Global buttons.
+       optional int32 toggle_limiter_bank = 15;
+       optional int32 toggle_auto_makeup_gain_bank = 16;
+
+       repeated MIDIMappingBusProto bus_mapping = 17;
 }
index 28b4fd97e694904f0da6fef0265086b6ce8c6dd0..2c84567d1015c8ff39341cfa5c82b2855f2b2a26 100644 (file)
@@ -49,7 +49,9 @@ vector<MIDIMappingDialog::Control> global_buttons = {
        { "Select bank 2",            MIDIMappingBusProto::kSelectBank2FieldNumber, 0 },
        { "Select bank 3",            MIDIMappingBusProto::kSelectBank3FieldNumber, 0 },
        { "Select bank 4",            MIDIMappingBusProto::kSelectBank4FieldNumber, 0 },
-       { "Select bank 5",            MIDIMappingBusProto::kSelectBank5FieldNumber, 0 }
+       { "Select bank 5",            MIDIMappingBusProto::kSelectBank5FieldNumber, 0 },
+       { "Toggle limiter",           MIDIMappingBusProto::kToggleLimiterFieldNumber, MIDIMappingProto::kToggleLimiterBankFieldNumber },
+       { "Toggle auto makeup gain",  MIDIMappingBusProto::kToggleAutoMakeupGainFieldNumber, MIDIMappingProto::kToggleAutoMakeupGainBankFieldNumber }
 };
 
 namespace {
index 91cd14580fe5b949e4b8a2bb2339f4f9fca65e8c..6a895ba081455911cb4578e7acdc96d159bb7461 100644 (file)
@@ -55,6 +55,8 @@ public:
        void toggle_auto_gain_staging(unsigned bus_idx) override {}
        void toggle_compressor(unsigned bus_idx) override {}
        void clear_peak(unsigned bus_idx) override {}
+       void toggle_limiter() override {}
+       void toggle_auto_makeup_gain() override {}
 
        void clear_all_highlights() override {}
 
@@ -73,6 +75,8 @@ public:
        void highlight_toggle_auto_gain_staging(unsigned bus_idx, bool highlight) override {}
        void highlight_toggle_compressor(unsigned bus_idx, bool highlight) override {}
        void highlight_clear_peak(unsigned bus_idx, bool highlight) override {}
+       void highlight_toggle_limiter(bool highlight) override {}
+       void highlight_toggle_auto_makeup_gain(bool highlight) override {}
 
        // Raw events; used for the editor dialog only.
        void controller_changed(unsigned controller) override;