diff --git a/libs/ardour/ardour/route_group.h b/libs/ardour/ardour/route_group.h index 2f0835c0fb..5aace6dac0 100644 --- a/libs/ardour/ardour/route_group.h +++ b/libs/ardour/ardour/route_group.h @@ -47,6 +47,7 @@ namespace Properties { LIBARDOUR_API extern PBD::PropertyDescriptor group_mute; LIBARDOUR_API extern PBD::PropertyDescriptor group_solo; LIBARDOUR_API extern PBD::PropertyDescriptor group_recenable; + LIBARDOUR_API extern PBD::PropertyDescriptor group_sursend_enable; LIBARDOUR_API extern PBD::PropertyDescriptor group_select; LIBARDOUR_API extern PBD::PropertyDescriptor group_route_active; LIBARDOUR_API extern PBD::PropertyDescriptor group_color; @@ -84,6 +85,7 @@ public: bool is_mute () const { return _mute.val(); } bool is_solo () const { return _solo.val(); } bool is_recenable () const { return _recenable.val(); } + bool is_sursend_enable () const { return _sursend_enable.val(); } bool is_select () const { return _select.val(); } bool is_route_active () const { return _route_active.val(); } bool is_color () const { return _color.val(); } @@ -105,6 +107,7 @@ public: void set_mute (bool yn); void set_solo (bool yn); void set_recenable (bool yn); + void set_sursend_enable (bool yn); void set_select (bool yn); void set_route_active (bool yn); void set_color (bool yn); @@ -177,6 +180,7 @@ private: PBD::Property _mute; PBD::Property _solo; PBD::Property _recenable; + PBD::Property _sursend_enable; PBD::Property _select; PBD::Property _route_active; PBD::Property _color; @@ -186,11 +190,13 @@ private: std::shared_ptr _solo_group; std::shared_ptr _mute_group; std::shared_ptr _rec_enable_group; + std::shared_ptr _sursend_enable_group; std::shared_ptr _gain_group; std::shared_ptr _monitoring_group; bool check_subgroup (bool, Placement, DataType&, uint32_t&) const; void remove_when_going_away (std::weak_ptr); + void update_surround_sends (); void unset_subgroup_bus (); int set_state_2X (const XMLNode&, int); diff --git a/libs/ardour/route_group.cc b/libs/ardour/route_group.cc index c73cfdcc66..99e60cce73 100644 --- a/libs/ardour/route_group.cc +++ b/libs/ardour/route_group.cc @@ -37,6 +37,7 @@ #include "ardour/route.h" #include "ardour/route_group.h" #include "ardour/session.h" +#include "ardour/surround_send.h" #include "ardour/vca.h" #include "ardour/vca_manager.h" @@ -54,6 +55,7 @@ namespace ARDOUR { PropertyDescriptor group_mute; PropertyDescriptor group_solo; PropertyDescriptor group_recenable; + PropertyDescriptor group_sursend_enable; PropertyDescriptor group_select; PropertyDescriptor group_route_active; PropertyDescriptor group_color; @@ -78,6 +80,8 @@ RouteGroup::make_property_quarks () DEBUG_TRACE (DEBUG::Properties, string_compose ("quark for solo = %1\n", Properties::group_solo.property_id)); Properties::group_recenable.property_id = g_quark_from_static_string (X_("recenable")); DEBUG_TRACE (DEBUG::Properties, string_compose ("quark for recenable = %1\n", Properties::group_recenable.property_id)); + Properties::group_sursend_enable.property_id = g_quark_from_static_string (X_("sursend_enable")); + DEBUG_TRACE (DEBUG::Properties, string_compose ("quark for sursend_enable = %1\n", Properties::group_sursend_enable.property_id)); Properties::group_select.property_id = g_quark_from_static_string (X_("select")); DEBUG_TRACE (DEBUG::Properties, string_compose ("quark for select = %1\n", Properties::group_select.property_id)); Properties::group_route_active.property_id = g_quark_from_static_string (X_("route-active")); @@ -97,6 +101,7 @@ RouteGroup::make_property_quarks () , _mute (Properties::group_mute, true) \ , _solo (Properties::group_solo, true) \ , _recenable (Properties::group_recenable, true) \ + , _sursend_enable (Properties::group_sursend_enable, true) \ , _select (Properties::group_select, true) \ , _route_active (Properties::group_route_active, true) \ , _color (Properties::group_color, true) \ @@ -110,6 +115,7 @@ RouteGroup::RouteGroup (Session& s, const string &n) , _solo_group (new ControlGroup (SoloAutomation)) , _mute_group (new ControlGroup (MuteAutomation)) , _rec_enable_group (new ControlGroup (RecEnableAutomation)) + , _sursend_enable_group (new ControlGroup (BusSendEnable)) , _gain_group (new GainControlGroup ()) , _monitoring_group (new ControlGroup (MonitoringAutomation)) , _rgba (0) @@ -124,11 +130,14 @@ RouteGroup::RouteGroup (Session& s, const string &n) add_property (_mute); add_property (_solo); add_property (_recenable); + add_property (_sursend_enable); add_property (_select); add_property (_route_active); add_property (_color); add_property (_monitoring); add_property (_group_master_number); + + s.SurroundMasterAddedOrRemoved.connect_same_thread (*this, boost::bind (&RouteGroup::update_surround_sends, this)); } RouteGroup::~RouteGroup () @@ -137,6 +146,7 @@ RouteGroup::~RouteGroup () _mute_group->clear (); _gain_group->clear (); _rec_enable_group->clear (); + _sursend_enable_group->clear (); _monitoring_group->clear (); std::shared_ptr vca (group_master.lock()); @@ -184,6 +194,10 @@ RouteGroup::add (std::shared_ptr r) _monitoring_group->add_control (trk->monitoring_control()); } + if (r->surround_send ()) { + _sursend_enable_group->add_control (r->surround_send ()->send_enable_control ()); + } + r->set_route_group (this); r->DropReferences.connect_same_thread (*this, boost::bind (&RouteGroup::remove_when_going_away, this, std::weak_ptr (r))); @@ -208,6 +222,17 @@ RouteGroup::remove_when_going_away (std::weak_ptr wr) } } +void +RouteGroup::update_surround_sends () +{ + for (auto const& r : *routes) { + if (r->surround_send ()) { + _sursend_enable_group->add_control (r->surround_send ()->send_enable_control ()); + } + // Note: ctrl is removed via DropReferences + } +} + void RouteGroup::unset_subgroup_bus () { @@ -239,6 +264,9 @@ RouteGroup::remove (std::shared_ptr r) _rec_enable_group->remove_control (trk->rec_enable_control()); _monitoring_group->remove_control (trk->monitoring_control()); } + if (r->surround_send ()) { + _sursend_enable_group->remove_control (r->surround_send ()->send_enable_control ()); + } routes->erase (i); _session.set_dirty (); RouteRemoved (this, std::weak_ptr (r)); /* EMIT SIGNAL */ @@ -419,6 +447,17 @@ RouteGroup::set_recenable (bool yn) send_change (PropertyChange (Properties::group_recenable)); } +void +RouteGroup::set_sursend_enable (bool yn) +{ + if (is_sursend_enable() == yn) { + return; + } + _sursend_enable = yn; + _sursend_enable_group->set_active (yn); + send_change (PropertyChange (Properties::group_sursend_enable)); +} + void RouteGroup::set_select (bool yn) { @@ -722,13 +761,14 @@ RouteGroup::push_to_groups () _solo_group->set_active (is_solo()); _mute_group->set_active (is_mute()); _rec_enable_group->set_active (is_recenable()); + _sursend_enable_group->set_active (is_sursend_enable()); _monitoring_group->set_active (is_monitoring()); } else { _gain_group->set_active (false); _solo_group->set_active (false); _mute_group->set_active (false); - _rec_enable_group->set_active (false); + _sursend_enable_group->set_active (false); _monitoring_group->set_active (false); } }