treat VCA assign as a RouteGroup property.
authorPaul Davis <paul@linuxaudiosystems.com>
Fri, 8 Jul 2016 13:25:18 +0000 (09:25 -0400)
committerPaul Davis <paul@linuxaudiosystems.com>
Fri, 8 Jul 2016 13:25:18 +0000 (09:25 -0400)
Newly added routes,removed routes etc. all correctly assign or
unassign to the group's VCA.

libs/ardour/ardour/route_group.h
libs/ardour/route_group.cc

index 0fc185ea0dff8ed2cae35fd8c56be623c5b18c2d..5263aceb0f3c38f89caf48ab6eb247861fbc2901 100644 (file)
@@ -150,6 +150,7 @@ class LIBARDOUR_API RouteGroup : public SessionObject
   private:
        boost::shared_ptr<RouteList> routes;
        boost::shared_ptr<Route> subgroup_bus;
+       boost::weak_ptr<VCA> group_master;
 
        PBD::Property<bool> _relative;
        PBD::Property<bool> _active;
index 91303af07ec00f0308f706659ff6cc0b85252f6c..959342c282423bd3b516a39056efd4cd67065a73 100644 (file)
@@ -126,12 +126,18 @@ RouteGroup::~RouteGroup ()
        _rec_enable_group->clear ();
        _monitoring_group->clear ();
 
+       boost::shared_ptr<VCA> vca (group_master.lock());
+
        for (RouteList::iterator i = routes->begin(); i != routes->end();) {
                RouteList::iterator tmp = i;
                ++tmp;
 
                (*i)->set_route_group (0);
 
+               if (vca) {
+                       (*i)->unassign (vca);
+               }
+
                i = tmp;
        }
 }
@@ -164,6 +170,12 @@ RouteGroup::add (boost::shared_ptr<Route> r)
        r->set_route_group (this);
        r->DropReferences.connect_same_thread (*this, boost::bind (&RouteGroup::remove_when_going_away, this, boost::weak_ptr<Route> (r)));
 
+       boost::shared_ptr<VCA> vca (group_master.lock());
+
+       if (vca) {
+               r->assign  (vca);
+       }
+
        _session.set_dirty ();
        RouteAdded (this, boost::weak_ptr<Route> (r)); /* EMIT SIGNAL */
        return 0;
@@ -186,6 +198,13 @@ RouteGroup::remove (boost::shared_ptr<Route> r)
 
        if ((i = find (routes->begin(), routes->end(), r)) != routes->end()) {
                r->set_route_group (0);
+
+               boost::shared_ptr<VCA> vca = group_master.lock();
+
+               if (vca) {
+                       r->unassign (vca);
+               }
+
                _solo_group->remove_control (r->solo_control());
                _mute_group->remove_control (r->mute_control());
                _gain_group->remove_control (r->gain_control());
@@ -584,6 +603,8 @@ RouteGroup::assign_master (boost::shared_ptr<VCA> master)
        for (RouteList::iterator r = routes->begin(); r != routes->end(); ++r) {
                (*r)->assign (master);
        }
+
+       group_master = master;
 }
 
 void
@@ -602,6 +623,8 @@ RouteGroup::unassign_master (boost::shared_ptr<VCA> master)
        for (RouteList::iterator r = routes->begin(); r != routes->end(); ++r) {
                (*r)->unassign (master);
        }
+
+       group_master.reset ();
 }
 
 bool