diff --git a/libs/surfaces/console1/c1_control.h b/libs/surfaces/console1/c1_control.h index b5972e9fe4..2629c03e92 100644 --- a/libs/surfaces/console1/c1_control.h +++ b/libs/surfaces/console1/c1_control.h @@ -57,8 +57,9 @@ class ControllerButton : public Controller ControllerType get_type () { return CONTROLLER_BUTTON; } - void set_plugin_action (std::function action) { plugin_action = action; } - void set_plugin_shift_action (std::function action) { plugin_shift_action = action; } + void set_action (std::function new_action) { action = new_action; } + void set_plugin_action (std::function new_action) { plugin_action = new_action; } + void set_plugin_shift_action (std::function new_action) { plugin_shift_action = new_action; } virtual void set_led_state (bool onoff) { @@ -122,8 +123,9 @@ class MultiStateButton : public Controller console1->write (buf, 3); } - void set_plugin_action (std::function action) { plugin_action = action; } - void set_plugin_shift_action (std::function action) { plugin_shift_action = action; } + void set_action (std::function new_action) { action = new_action; } + void set_plugin_action (std::function new_action) { plugin_action = new_action; } + void set_plugin_shift_action (std::function new_action) { plugin_shift_action = new_action; } uint32_t state_count () { return state_values.size (); } @@ -185,8 +187,9 @@ class Encoder : public Controller ControllerType get_type () { return ENCODER; } - void set_plugin_action (std::function action) { plugin_action = action; } - void set_plugin_shift_action (std::function action) { plugin_shift_action = action; } + void set_action (std::function new_action) { action = new_action; } + void set_plugin_action (std::function new_action) { plugin_action = new_action; } + void set_plugin_shift_action (std::function new_action) { plugin_shift_action = new_action; } virtual void set_value (uint32_t value) { diff --git a/libs/surfaces/console1/c1_gui.cc b/libs/surfaces/console1/c1_gui.cc index 92159b2a98..145b325bdd 100644 --- a/libs/surfaces/console1/c1_gui.cc +++ b/libs/surfaces/console1/c1_gui.cc @@ -79,6 +79,7 @@ C1GUI::C1GUI (Console1& p) : c1 (p) , table (6, 4) , swap_solo_mute_cb () + , band_q_as_send_cb () , create_plugin_stubs_btn () , ignore_active_change (false) { @@ -116,6 +117,13 @@ C1GUI::C1GUI (Console1& p) swap_solo_mute_cb.set_active (p.swap_solo_mute); swap_solo_mute_cb.signal_toggled ().connect (sigc::mem_fun (*this, &C1GUI::set_swap_solo_mute)); +#ifdef MIXBUS + // before the ssl strips, the q knobs for low- and high mids where alwas used as sends, now this can be toggled + band_q_as_send_cb.set_tooltip_text ( + _ ("If checked Ardour the Q-Factor knobs for Low and High are used as sends for Send 11 and send 12.")); + band_q_as_send_cb.set_active (p.band_q_as_send); + band_q_as_send_cb.signal_toggled ().connect (sigc::mem_fun (*this, &C1GUI::set_band_q_as_send)); +#endif // create_plugin_stubs (_ ("Create Plugin Mapping Stubs")); create_plugin_stubs_btn.set_tooltip_text (_ ("If checked a mapping stub is created for every unknown plugin.")); create_plugin_stubs_btn.set_active (p.create_mapping_stubs); @@ -142,6 +150,15 @@ C1GUI::C1GUI (Console1& p) table.attach (swap_solo_mute_cb, 1, 2, row, row + 1); row++; +#ifdef MIXBUS + l = manage (new Gtk::Label); + l->set_markup (string_compose ("%1", _ ("Use Mid-Q Buttons as send 11/12:"))); + l->set_alignment (1.0, 0.5); + table.attach (*l, 0, 1, row, row + 1, AttachOptions (FILL | EXPAND), AttachOptions (0)); + table.attach (band_q_as_send_cb, 1, 2, row, row + 1); + row++; +#endif + l = manage (new Gtk::Label); l->set_markup (string_compose ("%1", _ ("Create Plugin Mapping Stubs:"))); l->set_alignment (1.0, 0.5); @@ -177,6 +194,16 @@ C1GUI::set_swap_solo_mute () c1.swap_solo_mute = !c1.swap_solo_mute; } +void +C1GUI::set_band_q_as_send () +{ + c1.band_q_as_send = !c1.band_q_as_send; + if(!c1.in_use()) { + return; + } + c1.EQBandQBindingChange(); +} + void C1GUI::set_create_mapping_stubs () { diff --git a/libs/surfaces/console1/c1_gui.h b/libs/surfaces/console1/c1_gui.h index fecd965a9e..e5408f82c1 100644 --- a/libs/surfaces/console1/c1_gui.h +++ b/libs/surfaces/console1/c1_gui.h @@ -57,6 +57,7 @@ private: Gtk::ComboBox output_combo; Gtk::Image image; Gtk::CheckButton swap_solo_mute_cb; + Gtk::CheckButton band_q_as_send_cb; Gtk::CheckButton create_plugin_stubs_btn; void update_port_combos (); @@ -80,8 +81,8 @@ private: void active_port_changed (Gtk::ComboBox*,bool for_input); void set_swap_solo_mute (); - void set_create_mapping_stubs (); - + void set_band_q_as_send(); + void set_create_mapping_stubs(); }; } diff --git a/libs/surfaces/console1/c1_operations.cc b/libs/surfaces/console1/c1_operations.cc index 6080cc3262..7f1f3341e3 100644 --- a/libs/surfaces/console1/c1_operations.cc +++ b/libs/surfaces/console1/c1_operations.cc @@ -406,6 +406,17 @@ Console1::eq_gain (const uint32_t band, uint32_t value) session->set_control (control, gain, PBD::Controllable::UseGroup); } +void +Console1::eq_band_q (const uint32_t band, uint32_t value) +{ + if (!_current_stripable || !_current_stripable->mapped_control (EQ_BandQ, band)) { + return; + } + std::shared_ptr control = _current_stripable->mapped_control (EQ_BandQ, band); + double freq = midi_to_control (control, value); + session->set_control (control, freq, PBD::Controllable::UseGroup); +} + // The Mixbus-Sends are in the EQ section // Without Shift: // LowMid Shape is Send 11 @@ -909,6 +920,42 @@ Console1::map_eq () } } +void +Console1::map_eq_mode (){ +#ifdef MIXBUS + DEBUG_TRACE (DEBUG::Console1, "Enter map_eq_mode()\n"); + if (!_current_stripable) { + return; + } + std::shared_ptr rt = std::dynamic_pointer_cast( _current_stripable ); + if (!rt) { + return; + } + EQ_MODE current_eq_mode = EQ_MODE (rt->eq_mode_control() ? rt->eq_mode_control()->get_value() : -1); + DEBUG_TRACE (DEBUG::Console1, string_compose ("map_eq_mode() - mode: %1\n", current_eq_mode)); + if (current_eq_mode != strip_eq_mode) { + strip_eq_mode = current_eq_mode; + EQBandQBindingChange(); + } +#endif +} + +void +Console1::map_eq_band_q (const uint32_t band) +{ + DEBUG_TRACE (DEBUG::Console1, string_compose( "map_eq_band_q band: %1 \n", band)); + if (shift_state || switch_eq_q_dials) { + DEBUG_TRACE (DEBUG::Console1, "Exit map_eq_band_q 1\n"); + return; + } + ControllerID controllerID = eq_q_controller_for_band (band); + if (map_encoder (controllerID)) { + std::shared_ptr control = _current_stripable->mapped_control (EQ_BandQ, band); + map_encoder (controllerID, control); + } +} + + void Console1::map_eq_freq (const uint32_t band) { @@ -1000,8 +1047,11 @@ Console1::map_mb_send_level (const uint32_t n) // Theese two sends are available in non-shift state if (n_offset > 9 && shift_state) { return; - } else if (n_offset < 10 && !shift_state) // while the rest needs the shift state - { + } + else if (n_offset < 10 && !shift_state) { // while the rest needs the shift state + return; + } + else if(!shift_state && !switch_eq_q_dials) { return; } ControllerID controllerID = get_send_controllerid (n_offset); @@ -1036,7 +1086,7 @@ Console1::map_comp_mode () double value = _current_stripable->mapped_control (Comp_Mode) ? _current_stripable->mapped_control (Comp_Mode)->get_value () : false; - DEBUG_TRACE (DEBUG::Console1, string_compose ("****value from comp-type %1\n", value)); + DEBUG_TRACE (DEBUG::Console1, string_compose ("value from comp-type %1\n", value)); get_mbutton (ControllerID::ORDER)->set_led_state (value); } catch (ControlNotFoundException const&) { DEBUG_TRACE (DEBUG::Console1, "Button not found\n"); @@ -1103,6 +1153,33 @@ Console1::map_comp_emph () } } +void Console1::eqBandQChangeMapping() +{ + DEBUG_TRACE(DEBUG::Console1, string_compose("eqBandQChangeMapping(): band_q_as_send = %1, strip_eq_mode = %2\n", band_q_as_send, strip_eq_mode)); + Encoder* lme = get_encoder (LOW_MID_SHAPE); + Encoder* hme = get_encoder (HIGH_MID_SHAPE); + switch_eq_q_dials = band_q_as_send || (strip_eq_mode == EQM_HARRISON ); + + if (!lme || !hme) { + DEBUG_TRACE (DEBUG::Console1, "eqBandQChangeMapping: Controller not found \n"); + return; + } + + if (switch_eq_q_dials) { + DEBUG_TRACE (DEBUG::Console1, "eqBandQChangeMapping() set harrison or send mode\n"); + lme->set_action(std::function (std::bind (&Console1::mb_send_level, this, 10, _1))); + hme->set_action(std::function (std::bind (&Console1::mb_send_level, this, 11, _1))); + map_mb_send_level (10); + map_mb_send_level (11); + } else { + DEBUG_TRACE (DEBUG::Console1, "eqBandQChangeMapping() set ssl q mode\n"); + lme->set_action(std::function (std::bind (&Console1::eq_band_q, this, 1, _1))); + hme->set_action(std::function (std::bind (&Console1::eq_band_q, this, 2, _1))); + map_eq_band_q (1); + map_eq_band_q (2); + } +} + bool Console1::map_encoder (ControllerID controllerID) { diff --git a/libs/surfaces/console1/console1.cc b/libs/surfaces/console1/console1.cc index 84336229be..a0807fe0e0 100644 --- a/libs/surfaces/console1/console1.cc +++ b/libs/surfaces/console1/console1.cc @@ -120,8 +120,9 @@ Console1::get_state () const { XMLNode& node = MIDISurface::get_state (); node.set_property ("swap-solo-mute", swap_solo_mute); - node.set_property ("create-mapping-stubs", create_mapping_stubs); - return node; + node.set_property ("band-q-as-send", band_q_as_send); + node.set_property ("create-mapping-stubs", create_mapping_stubs); + return node; } int @@ -131,8 +132,13 @@ Console1::set_state (const XMLNode& node, int version) std::string tmp; node.get_property ("swap-solo-mute", tmp); swap_solo_mute = (tmp == "1"); - node.get_property ("create-mapping-stubs", tmp); - create_mapping_stubs = (tmp == "1"); + if (node.property("band-q-as-send")) + node.get_property("band-q-as-send", tmp); + else + tmp = "1"; + band_q_as_send = (tmp == "1"); + node.get_property("create-mapping-stubs", tmp); + create_mapping_stubs = (tmp == "1"); return 0; } @@ -250,9 +256,10 @@ Console1::connect_internal_signals () DEBUG_TRACE (DEBUG::Console1, "connect_internal_signals\n"); BankChange.connect (console1_connections, MISSING_INVALIDATOR, std::bind (&Console1::map_bank, this), this); ShiftChange.connect (console1_connections, MISSING_INVALIDATOR, std::bind (&Console1::map_shift, this, _1), this); - PluginStateChange.connect ( - console1_connections, MISSING_INVALIDATOR, std::bind (&Console1::map_plugin_state, this, _1), this); - GotoView.connect ( + EQBandQBindingChange.connect (console1_connections, MISSING_INVALIDATOR, std::bind(&Console1::eqBandQChangeMapping, this), this); + PluginStateChange.connect( + console1_connections, MISSING_INVALIDATOR, std::bind(&Console1::map_plugin_state, this, _1), this); + GotoView.connect ( console1_connections, MISSING_INVALIDATOR, [] (uint32_t val) { DEBUG_TRACE (DEBUG::Console1, string_compose ("GotooView: %1\n", val)); }, @@ -261,6 +268,7 @@ Console1::connect_internal_signals () console1_connections, MISSING_INVALIDATOR, [] () { DEBUG_TRACE (DEBUG::Console1, "VerticalZoomIn\n"); }, this); VerticalZoomOutSelected.connect ( console1_connections, MISSING_INVALIDATOR, [] () { DEBUG_TRACE (DEBUG::Console1, "VerticalZoomOut\n"); }, this); + } void @@ -367,14 +375,27 @@ Console1::setup_controls () std::function (std::bind (&Console1::eq_gain, this, i, _1)), std::function (std::bind (&Console1::mb_send_level, this, i + 4, _1))); } - new Encoder (this, - ControllerID::LOW_MID_SHAPE, - std::function (std::bind (&Console1::mb_send_level, this, 10, _1)), - std::function (std::bind (&Console1::mb_send_level, this, 8, _1))); - new Encoder (this, - ControllerID::HIGH_MID_SHAPE, - std::function (std::bind (&Console1::mb_send_level, this, 11, _1)), - std::function (std::bind (&Console1::mb_send_level, this, 9, _1))); + + + if (band_q_as_send) { + new Encoder (this, + ControllerID::LOW_MID_SHAPE, + std::function (std::bind (&Console1::mb_send_level, this, 10, _1)), + std::function (std::bind (&Console1::mb_send_level, this, 8, _1))); + new Encoder (this, + ControllerID::HIGH_MID_SHAPE, + std::function (std::bind (&Console1::mb_send_level, this, 11, _1)), + std::function (std::bind (&Console1::mb_send_level, this, 9, _1))); + } else { + new Encoder (this, + ControllerID::LOW_MID_SHAPE, + std::function (std::bind (&Console1::eq_band_q, this, 1, _1)), + std::function (std::bind (&Console1::mb_send_level, this, 8, _1))); + new Encoder (this, + ControllerID::HIGH_MID_SHAPE, + std::function (std::bind (&Console1::eq_band_q, this, 2, _1)), + std::function (std::bind (&Console1::mb_send_level, this, 9, _1))); + } new ControllerButton (this, ControllerID::LOW_SHAPE, @@ -493,6 +514,13 @@ Console1::notify_solo_active_changed (bool state) } } +void +Console1::band_q_usage_changed( ) +{ + Encoder *e = get_encoder (ControllerID (EQ_BandQ) ); + DEBUG_TRACE (DEBUG::Console1, string_compose ("notify_parameter_changed: %1\n", e->id())); +} + void Console1::notify_parameter_changed (std::string s) { @@ -697,7 +725,19 @@ Console1::set_current_stripable (std::shared_ptr r) _current_stripable->mapped_control (EQ_Enable)->Changed.connect ( stripable_connections, MISSING_INVALIDATOR, std::bind (&Console1::map_eq, this), this); } - +#ifdef MIXBUS + std::shared_ptr rt = std::dynamic_pointer_cast( _current_stripable ); + if (rt) + { + DEBUG_TRACE(DEBUG::Console1, "Cast to Route ok \n"); + if( rt->eq_mode_control() ) + { + DEBUG_TRACE(DEBUG::Console1, "Control EQ_Mode available \n"); + rt->eq_mode_control()->Changed.connect( + stripable_connections, MISSING_INVALIDATOR, std::bind(&Console1::map_eq_mode, this), this); + } + } +#endif for (uint32_t i = 0; i < _current_stripable->eq_band_cnt (); ++i) { if (_current_stripable->mapped_control (EQ_BandFreq, i)) { _current_stripable->mapped_control (EQ_BandFreq, i)->Changed.connect ( @@ -709,6 +749,16 @@ Console1::set_current_stripable (std::shared_ptr r) } } + if (_current_stripable->mapped_control (EQ_BandQ, 1) && !band_q_as_send ) { + _current_stripable->mapped_control (EQ_BandQ, 1)->Changed.connect ( + stripable_connections, MISSING_INVALIDATOR, std::bind (&Console1::map_eq_band_q, this, 1), this); + } + + if (_current_stripable->mapped_control (EQ_BandQ, 2) && !band_q_as_send) { + _current_stripable->mapped_control (EQ_BandQ, 2)->Changed.connect ( + stripable_connections, MISSING_INVALIDATOR, std::bind (&Console1::map_eq_band_q, this, 2), this); + } + if (_current_stripable->mapped_control (EQ_BandShape, 0)) { _current_stripable->mapped_control (EQ_BandShape, 0)->Changed.connect ( stripable_connections, MISSING_INVALIDATOR, std::bind (&Console1::map_eq_low_shape, this), this); @@ -726,7 +776,7 @@ Console1::set_current_stripable (std::shared_ptr r) } // Mixbus Sends - for (uint32_t i = 0; i < 12; ++i) { + for (uint32_t i = 0; i < (band_q_as_send ? 12 : 10); ++i) { if (_current_stripable->send_level_controllable (i)) { _current_stripable->send_level_controllable (i)->Changed.connect ( stripable_connections, @@ -836,9 +886,13 @@ Console1::map_stripable_state () // EQ Section map_eq (); - for (uint32_t i = 0; i < _current_stripable->eq_band_cnt (); ++i) { + map_eq_mode(); + for (uint32_t i = 0; i < _current_stripable->eq_band_cnt(); ++i) { map_eq_freq (i); map_eq_gain (i); + if( (!switch_eq_q_dials) && i > 0 && i < 3 ) { + map_eq_band_q (i); + } } map_eq_low_shape (); map_eq_high_shape (); diff --git a/libs/surfaces/console1/console1.h b/libs/surfaces/console1/console1.h index ed0d93d998..fd51a23d89 100644 --- a/libs/surfaces/console1/console1.h +++ b/libs/surfaces/console1/console1.h @@ -114,7 +114,13 @@ public: int set_state (const XMLNode&, int version) override; bool swap_solo_mute; + bool band_q_as_send = true; bool create_mapping_stubs; + bool switch_eq_q_dials = true; + + bool in_use(){ + return _in_use; + } PBD::Signal ConnectionChange; @@ -126,6 +132,7 @@ public: PBD::Signal BankChange; PBD::Signal ShiftChange; PBD::Signal PluginStateChange; + PBD::Signal EQBandQBindingChange; enum ControllerID { @@ -204,6 +211,13 @@ public: }; + enum EQ_MODE + { + EQM_UNDEFINED = -1, + EQM_HARRISON = 0, + EQM_SSL = 1 + }; + using ControllerMap = std::map; ControllerMap controllerMap{ { "CONTROLLER_NONE", ControllerID::CONTROLLER_NONE }, @@ -290,8 +304,13 @@ private: // Shift button bool shift_state = false; + + // Plugin state bool in_plugin_state = false; + // Selected EQ + EQ_MODE strip_eq_mode = EQM_UNDEFINED; + bool rolling = false; uint32_t current_bank = 0; uint32_t current_strippable_index = 0; @@ -420,6 +439,7 @@ private: void map_stripable_state (); void notify_parameter_changed (std::string) override; + void band_q_usage_changed (); /* operations (defined in c1_operations.cc) */ @@ -457,8 +477,9 @@ private: // EQ section void eq (const uint32_t); - void eq_freq (const uint32_t band, uint32_t value); - void eq_gain (const uint32_t band, uint32_t value); + void eq_freq (const uint32_t band, uint32_t value); + void eq_gain (const uint32_t band, uint32_t value); + void eq_band_q (const uint32_t band, uint32_t value); void eq_high_shape (const uint32_t value); void eq_low_shape (const uint32_t value); @@ -502,6 +523,27 @@ private: return eq_gain_id; } + ControllerID eq_q_controller_for_band (const uint32_t band) + { + if( band_q_as_send ) + return ControllerID::CONTROLLER_NONE; + ControllerID eq_gain_id = ControllerID::CONTROLLER_NONE; + switch (band) + { + case 0: + break; + case 1: + eq_gain_id = ControllerID::LOW_MID_SHAPE; + break; + case 2: + eq_gain_id = ControllerID::HIGH_MID_SHAPE; + break; + case 3: + break; + } + return eq_gain_id; + } + // Mixbus sends void mb_send_level (const uint32_t n, const uint32_t value); @@ -551,8 +593,10 @@ private: // EQ section void map_eq (); - void map_eq_freq (const uint32_t band); + void map_eq_mode (); + void map_eq_freq(const uint32_t band); void map_eq_gain (const uint32_t band); + void map_eq_band_q (const uint32_t band); void map_eq_low_shape (); void map_eq_high_shape (); @@ -608,7 +652,9 @@ private: bool map_select_plugin (const int32_t plugin_index); - using PluginMappingMap = std::map; + void eqBandQChangeMapping(); + + using PluginMappingMap = std::map; PluginMappingMap pluginMappingMap; }; }