Add Surround Send Enable Grouping

This commit is contained in:
Robin Gareus 2024-01-28 15:00:23 +01:00
parent 2e00638761
commit 05ffd4821e
No known key found for this signature in database
GPG key ID: A090BCE02CF57F04
2 changed files with 47 additions and 1 deletions

View file

@ -47,6 +47,7 @@ namespace Properties {
LIBARDOUR_API extern PBD::PropertyDescriptor<bool> group_mute; LIBARDOUR_API extern PBD::PropertyDescriptor<bool> group_mute;
LIBARDOUR_API extern PBD::PropertyDescriptor<bool> group_solo; LIBARDOUR_API extern PBD::PropertyDescriptor<bool> group_solo;
LIBARDOUR_API extern PBD::PropertyDescriptor<bool> group_recenable; LIBARDOUR_API extern PBD::PropertyDescriptor<bool> group_recenable;
LIBARDOUR_API extern PBD::PropertyDescriptor<bool> group_sursend_enable;
LIBARDOUR_API extern PBD::PropertyDescriptor<bool> group_select; LIBARDOUR_API extern PBD::PropertyDescriptor<bool> group_select;
LIBARDOUR_API extern PBD::PropertyDescriptor<bool> group_route_active; LIBARDOUR_API extern PBD::PropertyDescriptor<bool> group_route_active;
LIBARDOUR_API extern PBD::PropertyDescriptor<bool> group_color; LIBARDOUR_API extern PBD::PropertyDescriptor<bool> group_color;
@ -84,6 +85,7 @@ public:
bool is_mute () const { return _mute.val(); } bool is_mute () const { return _mute.val(); }
bool is_solo () const { return _solo.val(); } bool is_solo () const { return _solo.val(); }
bool is_recenable () const { return _recenable.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_select () const { return _select.val(); }
bool is_route_active () const { return _route_active.val(); } bool is_route_active () const { return _route_active.val(); }
bool is_color () const { return _color.val(); } bool is_color () const { return _color.val(); }
@ -105,6 +107,7 @@ public:
void set_mute (bool yn); void set_mute (bool yn);
void set_solo (bool yn); void set_solo (bool yn);
void set_recenable (bool yn); void set_recenable (bool yn);
void set_sursend_enable (bool yn);
void set_select (bool yn); void set_select (bool yn);
void set_route_active (bool yn); void set_route_active (bool yn);
void set_color (bool yn); void set_color (bool yn);
@ -177,6 +180,7 @@ private:
PBD::Property<bool> _mute; PBD::Property<bool> _mute;
PBD::Property<bool> _solo; PBD::Property<bool> _solo;
PBD::Property<bool> _recenable; PBD::Property<bool> _recenable;
PBD::Property<bool> _sursend_enable;
PBD::Property<bool> _select; PBD::Property<bool> _select;
PBD::Property<bool> _route_active; PBD::Property<bool> _route_active;
PBD::Property<bool> _color; PBD::Property<bool> _color;
@ -186,11 +190,13 @@ private:
std::shared_ptr<ControlGroup> _solo_group; std::shared_ptr<ControlGroup> _solo_group;
std::shared_ptr<ControlGroup> _mute_group; std::shared_ptr<ControlGroup> _mute_group;
std::shared_ptr<ControlGroup> _rec_enable_group; std::shared_ptr<ControlGroup> _rec_enable_group;
std::shared_ptr<ControlGroup> _sursend_enable_group;
std::shared_ptr<ControlGroup> _gain_group; std::shared_ptr<ControlGroup> _gain_group;
std::shared_ptr<ControlGroup> _monitoring_group; std::shared_ptr<ControlGroup> _monitoring_group;
bool check_subgroup (bool, Placement, DataType&, uint32_t&) const; bool check_subgroup (bool, Placement, DataType&, uint32_t&) const;
void remove_when_going_away (std::weak_ptr<Route>); void remove_when_going_away (std::weak_ptr<Route>);
void update_surround_sends ();
void unset_subgroup_bus (); void unset_subgroup_bus ();
int set_state_2X (const XMLNode&, int); int set_state_2X (const XMLNode&, int);

View file

@ -37,6 +37,7 @@
#include "ardour/route.h" #include "ardour/route.h"
#include "ardour/route_group.h" #include "ardour/route_group.h"
#include "ardour/session.h" #include "ardour/session.h"
#include "ardour/surround_send.h"
#include "ardour/vca.h" #include "ardour/vca.h"
#include "ardour/vca_manager.h" #include "ardour/vca_manager.h"
@ -54,6 +55,7 @@ namespace ARDOUR {
PropertyDescriptor<bool> group_mute; PropertyDescriptor<bool> group_mute;
PropertyDescriptor<bool> group_solo; PropertyDescriptor<bool> group_solo;
PropertyDescriptor<bool> group_recenable; PropertyDescriptor<bool> group_recenable;
PropertyDescriptor<bool> group_sursend_enable;
PropertyDescriptor<bool> group_select; PropertyDescriptor<bool> group_select;
PropertyDescriptor<bool> group_route_active; PropertyDescriptor<bool> group_route_active;
PropertyDescriptor<bool> group_color; PropertyDescriptor<bool> 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)); 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")); 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)); 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")); 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)); 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")); 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) \ , _mute (Properties::group_mute, true) \
, _solo (Properties::group_solo, true) \ , _solo (Properties::group_solo, true) \
, _recenable (Properties::group_recenable, true) \ , _recenable (Properties::group_recenable, true) \
, _sursend_enable (Properties::group_sursend_enable, true) \
, _select (Properties::group_select, true) \ , _select (Properties::group_select, true) \
, _route_active (Properties::group_route_active, true) \ , _route_active (Properties::group_route_active, true) \
, _color (Properties::group_color, true) \ , _color (Properties::group_color, true) \
@ -110,6 +115,7 @@ RouteGroup::RouteGroup (Session& s, const string &n)
, _solo_group (new ControlGroup (SoloAutomation)) , _solo_group (new ControlGroup (SoloAutomation))
, _mute_group (new ControlGroup (MuteAutomation)) , _mute_group (new ControlGroup (MuteAutomation))
, _rec_enable_group (new ControlGroup (RecEnableAutomation)) , _rec_enable_group (new ControlGroup (RecEnableAutomation))
, _sursend_enable_group (new ControlGroup (BusSendEnable))
, _gain_group (new GainControlGroup ()) , _gain_group (new GainControlGroup ())
, _monitoring_group (new ControlGroup (MonitoringAutomation)) , _monitoring_group (new ControlGroup (MonitoringAutomation))
, _rgba (0) , _rgba (0)
@ -124,11 +130,14 @@ RouteGroup::RouteGroup (Session& s, const string &n)
add_property (_mute); add_property (_mute);
add_property (_solo); add_property (_solo);
add_property (_recenable); add_property (_recenable);
add_property (_sursend_enable);
add_property (_select); add_property (_select);
add_property (_route_active); add_property (_route_active);
add_property (_color); add_property (_color);
add_property (_monitoring); add_property (_monitoring);
add_property (_group_master_number); add_property (_group_master_number);
s.SurroundMasterAddedOrRemoved.connect_same_thread (*this, boost::bind (&RouteGroup::update_surround_sends, this));
} }
RouteGroup::~RouteGroup () RouteGroup::~RouteGroup ()
@ -137,6 +146,7 @@ RouteGroup::~RouteGroup ()
_mute_group->clear (); _mute_group->clear ();
_gain_group->clear (); _gain_group->clear ();
_rec_enable_group->clear (); _rec_enable_group->clear ();
_sursend_enable_group->clear ();
_monitoring_group->clear (); _monitoring_group->clear ();
std::shared_ptr<VCA> vca (group_master.lock()); std::shared_ptr<VCA> vca (group_master.lock());
@ -184,6 +194,10 @@ RouteGroup::add (std::shared_ptr<Route> r)
_monitoring_group->add_control (trk->monitoring_control()); _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->set_route_group (this);
r->DropReferences.connect_same_thread (*this, boost::bind (&RouteGroup::remove_when_going_away, this, std::weak_ptr<Route> (r))); r->DropReferences.connect_same_thread (*this, boost::bind (&RouteGroup::remove_when_going_away, this, std::weak_ptr<Route> (r)));
@ -208,6 +222,17 @@ RouteGroup::remove_when_going_away (std::weak_ptr<Route> 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 void
RouteGroup::unset_subgroup_bus () RouteGroup::unset_subgroup_bus ()
{ {
@ -239,6 +264,9 @@ RouteGroup::remove (std::shared_ptr<Route> r)
_rec_enable_group->remove_control (trk->rec_enable_control()); _rec_enable_group->remove_control (trk->rec_enable_control());
_monitoring_group->remove_control (trk->monitoring_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); routes->erase (i);
_session.set_dirty (); _session.set_dirty ();
RouteRemoved (this, std::weak_ptr<Route> (r)); /* EMIT SIGNAL */ RouteRemoved (this, std::weak_ptr<Route> (r)); /* EMIT SIGNAL */
@ -419,6 +447,17 @@ RouteGroup::set_recenable (bool yn)
send_change (PropertyChange (Properties::group_recenable)); 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 void
RouteGroup::set_select (bool yn) RouteGroup::set_select (bool yn)
{ {
@ -722,13 +761,14 @@ RouteGroup::push_to_groups ()
_solo_group->set_active (is_solo()); _solo_group->set_active (is_solo());
_mute_group->set_active (is_mute()); _mute_group->set_active (is_mute());
_rec_enable_group->set_active (is_recenable()); _rec_enable_group->set_active (is_recenable());
_sursend_enable_group->set_active (is_sursend_enable());
_monitoring_group->set_active (is_monitoring()); _monitoring_group->set_active (is_monitoring());
} else { } else {
_gain_group->set_active (false); _gain_group->set_active (false);
_solo_group->set_active (false); _solo_group->set_active (false);
_mute_group->set_active (false); _mute_group->set_active (false);
_rec_enable_group->set_active (false); _rec_enable_group->set_active (false);
_sursend_enable_group->set_active (false);
_monitoring_group->set_active (false); _monitoring_group->set_active (false);
} }
} }