treat VCA assign as a RouteGroup property.
[ardour.git] / libs / ardour / ardour / route_group.h
index 763430e1f1c1d6a607ed4ebf5b747fb8c245759e..5263aceb0f3c38f89caf48ab6eb247861fbc2901 100644 (file)
 #include <string>
 #include <stdint.h>
 
+#include "pbd/controllable.h"
 #include "pbd/signals.h"
 #include "pbd/stateful.h"
-#include "pbd/signals.h"
 
-#include "ardour/libardour_visibility.h"
+#include "ardour/control_group.h"
 #include "ardour/types.h"
 #include "ardour/session_object.h"
 
+#include "ardour/libardour_visibility.h"
+
 namespace ARDOUR {
 
 namespace Properties {
-       LIBARDOUR_API extern PBD::PropertyDescriptor<bool> relative;
+       LIBARDOUR_API extern PBD::PropertyDescriptor<bool> group_relative;
+       LIBARDOUR_API extern PBD::PropertyDescriptor<bool> group_gain;
+       LIBARDOUR_API extern PBD::PropertyDescriptor<bool> group_mute;
+       LIBARDOUR_API extern PBD::PropertyDescriptor<bool> group_solo;
+       LIBARDOUR_API extern PBD::PropertyDescriptor<bool> group_recenable;
+       LIBARDOUR_API extern PBD::PropertyDescriptor<bool> group_select;
+       LIBARDOUR_API extern PBD::PropertyDescriptor<bool> group_route_active;
+       LIBARDOUR_API extern PBD::PropertyDescriptor<bool> group_color;
+       LIBARDOUR_API extern PBD::PropertyDescriptor<bool> group_monitoring;
        LIBARDOUR_API extern PBD::PropertyDescriptor<bool> active;
-       LIBARDOUR_API extern PBD::PropertyDescriptor<bool> gain;
-       LIBARDOUR_API extern PBD::PropertyDescriptor<bool> mute;
-       LIBARDOUR_API extern PBD::PropertyDescriptor<bool> solo;
-       LIBARDOUR_API extern PBD::PropertyDescriptor<bool> recenable;
-       LIBARDOUR_API extern PBD::PropertyDescriptor<bool> select;
-       LIBARDOUR_API extern PBD::PropertyDescriptor<bool> route_active;
-       LIBARDOUR_API extern PBD::PropertyDescriptor<bool> color;
-       LIBARDOUR_API extern PBD::PropertyDescriptor<bool> monitoring;
-       /* we use this, but its declared in region.cc */
+       /* we use these declared in region.cc */
        LIBARDOUR_API extern PBD::PropertyDescriptor<bool> hidden;
 };
 
@@ -55,6 +57,13 @@ class Track;
 class AudioTrack;
 class Session;
 
+/** A group identifier for routes.
+ *
+ * RouteGroups permit to define properties which are shared
+ * among all Routes that use the given identifier.
+ *
+ * A route can at most be in one group.
+ */
 class LIBARDOUR_API RouteGroup : public SessionObject
 {
   public:
@@ -108,7 +117,7 @@ class LIBARDOUR_API RouteGroup : public SessionObject
 
        /* to use these, #include "ardour/route_group_specialized.h" */
 
-       template<class T> void apply (void (Track::*func)(T, void *), T val, void *src);
+       template<class T> void apply (void (Track::*func)(T, PBD::Controllable::GroupControlDisposition), T val, PBD::Controllable::GroupControlDisposition);
 
        /* fills at_set with all members of the group that are AudioTracks */
 
@@ -134,9 +143,14 @@ class LIBARDOUR_API RouteGroup : public SessionObject
 
        int set_state (const XMLNode&, int version);
 
-private:
+       void assign_master (boost::shared_ptr<VCA>);
+       void unassign_master (boost::shared_ptr<VCA>);
+       bool slaved () const;
+
+  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;
@@ -150,8 +164,17 @@ private:
        PBD::Property<bool> _color;
        PBD::Property<bool> _monitoring;
 
+       boost::shared_ptr<ControlGroup> _solo_group;
+       boost::shared_ptr<ControlGroup> _mute_group;
+       boost::shared_ptr<ControlGroup> _rec_enable_group;
+       boost::shared_ptr<ControlGroup> _gain_group;
+       boost::shared_ptr<ControlGroup> _monitoring_group;
+
        void remove_when_going_away (boost::weak_ptr<Route>);
        int set_state_2X (const XMLNode&, int);
+
+       void post_set (PBD::PropertyChange const &);
+       void push_to_groups ();
 };
 
 } /* namespace */