Ardour  8.12
route_group.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2000-2016 Paul Davis <paul@linuxaudiosystems.com>
3  * Copyright (C) 2005-2006 Taybin Rutkin <taybin@taybin.com>
4  * Copyright (C) 2006-2011 David Robillard <d@drobilla.net>
5  * Copyright (C) 2009-2011 Carl Hetherington <carl@carlh.net>
6  * Copyright (C) 2016-2017 Robin Gareus <robin@gareus.org>
7  * Copyright (C) 2018 Len Ovens <len@ovenwerks.net>
8  *
9  * This program is free software; you can redistribute it and/or modify
10  * it under the terms of the GNU General Public License as published by
11  * the Free Software Foundation; either version 2 of the License, or
12  * (at your option) any later version.
13  *
14  * This program is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17  * GNU General Public License for more details.
18  *
19  * You should have received a copy of the GNU General Public License along
20  * with this program; if not, write to the Free Software Foundation, Inc.,
21  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
22  */
23 
24 #ifndef __ardour_route_group_h__
25 #define __ardour_route_group_h__
26 
27 #include <list>
28 #include <set>
29 #include <string>
30 #include <stdint.h>
31 
32 #include "pbd/controllable.h"
33 #include "pbd/signals.h"
34 #include "pbd/stateful.h"
35 
36 #include "ardour/control_group.h"
37 #include "ardour/types.h"
38 #include "ardour/session_object.h"
39 
41 
42 namespace ARDOUR {
43 
44 namespace Properties {
57  /* we use these declared in region.cc */
59 };
60 
61 class Route;
62 class Track;
63 class AudioTrack;
64 class Session;
65 
74 {
75 public:
76  static void make_property_quarks();
77 
78  RouteGroup (Session& s, const std::string &n);
80 
81  bool is_active () const { return _active.val(); }
82  bool is_relative () const { return _relative.val(); }
83  bool is_hidden () const { return _hidden.val(); }
84  bool is_gain () const { return _gain.val(); }
85  bool is_mute () const { return _mute.val(); }
86  bool is_solo () const { return _solo.val(); }
87  bool is_recenable () const { return _recenable.val(); }
88  bool is_sursend_enable () const { return _sursend_enable.val(); }
89  bool is_select () const { return _select.val(); }
90  bool is_route_active () const { return _route_active.val(); }
91  bool is_color () const { return _color.val(); }
92  bool is_monitoring() const { return _monitoring.val(); }
93  int32_t group_master_number() const { return _group_master_number.val(); }
94  std::weak_ptr<Route> subgroup_bus() const { return _subgroup_bus; }
95 
96  bool empty() const {return routes->empty();}
97  size_t size() const { return routes->size();}
98 
101 
102  void set_active (bool yn, void *src);
103  void set_relative (bool yn, void *src);
104  void set_hidden (bool yn, void *src);
105 
106  void set_gain (bool yn);
107  void set_mute (bool yn);
108  void set_solo (bool yn);
109  void set_recenable (bool yn);
110  void set_sursend_enable (bool yn);
111  void set_select (bool yn);
112  void set_route_active (bool yn);
113  void set_color (bool yn);
114  void set_monitoring (bool yn);
115 
117 
118  int add (std::shared_ptr<Route>);
119  int remove (std::shared_ptr<Route>);
120 
121  template<typename Function>
123  for (RouteList::iterator i = routes->begin(); i != routes->end(); ++i) {
124  f (i->get());
125  }
126  }
127 
128  /* to use these, #include "ardour/route_group_specialized.h" */
129 
130  template<class T> void apply (void (Track::*func)(T, PBD::Controllable::GroupControlDisposition), T val, PBD::Controllable::GroupControlDisposition);
131 
132  /* fills at_set with all members of the group that are AudioTracks */
133 
134  void audio_track_group (std::set<std::shared_ptr<AudioTrack> >& at_set);
135 
136  void clear () {
137  routes->clear ();
138  changed();
139  }
140 
141  bool has_subgroup() const;
142  bool can_subgroup (bool, Placement) const;
143  void make_subgroup (bool, Placement);
145 
146  std::shared_ptr<RouteList> route_list() { return routes; }
147 
149  PBD::Signal2<void, RouteGroup *, std::weak_ptr<ARDOUR::Route> > RouteAdded;
151  PBD::Signal2<void, RouteGroup *, std::weak_ptr<ARDOUR::Route> > RouteRemoved;
152 
153  XMLNode& get_state () const;
154 
155  int set_state (const XMLNode&, int version);
156 
157  void assign_master (std::shared_ptr<VCA>);
158  void unassign_master (std::shared_ptr<VCA>);
159  bool has_control_master() const;
160  bool slaved () const;
161 
162  uint32_t rgba () const { return _rgba; }
163 
165  void set_rgba (uint32_t);
166 
167  /* directly set color only, used to convert old 5.x gui-object-state
168  * to libardour color */
169  void migrate_rgba (uint32_t color) { _rgba = color; }
170 
171 private:
172  std::shared_ptr<RouteList> routes;
173  std::shared_ptr<Route> _subgroup_bus;
174  std::weak_ptr<VCA> group_master;
175 
189 
190  std::shared_ptr<ControlGroup> _solo_group;
191  std::shared_ptr<ControlGroup> _mute_group;
192  std::shared_ptr<ControlGroup> _rec_enable_group;
193  std::shared_ptr<ControlGroup> _sursend_enable_group;
194  std::shared_ptr<ControlGroup> _gain_group;
195  std::shared_ptr<ControlGroup> _monitoring_group;
196 
197  bool check_subgroup (bool, Placement, DataType&, uint32_t&) const;
198  void remove_when_going_away (std::weak_ptr<Route>);
201  int set_state_2X (const XMLNode&, int);
202 
204  void push_to_groups ();
205 
206  uint32_t _rgba;
208 };
209 
210 } /* namespace */
211 
212 #endif /* __ardour_route_group_h__ */
std::shared_ptr< RouteList > routes
Definition: route_group.h:172
bool can_subgroup(bool, Placement) const
void foreach_route(Function f)
Definition: route_group.h:122
size_t size() const
Definition: route_group.h:97
void set_solo(bool yn)
RouteGroup(Session &s, const std::string &n)
void set_select(bool yn)
bool is_gain() const
Definition: route_group.h:84
void set_route_active(bool yn)
std::weak_ptr< Route > subgroup_bus() const
Definition: route_group.h:94
bool empty() const
Definition: route_group.h:96
void set_active(bool yn, void *src)
void set_sursend_enable(bool yn)
void set_hidden(bool yn, void *src)
int32_t group_master_number() const
Definition: route_group.h:93
void set_gain(bool yn)
void migrate_rgba(uint32_t color)
Definition: route_group.h:169
bool is_solo() const
Definition: route_group.h:86
int set_state_2X(const XMLNode &, int)
std::shared_ptr< ControlGroup > _rec_enable_group
Definition: route_group.h:192
bool has_subgroup() const
void set_relative(bool yn, void *src)
std::shared_ptr< ControlGroup > _mute_group
Definition: route_group.h:191
PBD::Property< bool > _mute
Definition: route_group.h:180
std::shared_ptr< ControlGroup > _sursend_enable_group
Definition: route_group.h:193
bool is_select() const
Definition: route_group.h:89
void update_surround_sends()
PBD::Property< bool > _select
Definition: route_group.h:184
bool is_route_active() const
Definition: route_group.h:90
void set_recenable(bool yn)
bool is_hidden() const
Definition: route_group.h:83
PBD::Property< bool > _sursend_enable
Definition: route_group.h:183
bool check_subgroup(bool, Placement, DataType &, uint32_t &) const
std::shared_ptr< RouteList > route_list()
Definition: route_group.h:146
XMLNode & get_state() const
PBD::Property< bool > _recenable
Definition: route_group.h:182
bool is_monitoring() const
Definition: route_group.h:92
gain_t get_max_factor(gain_t factor)
int add(std::shared_ptr< Route >)
bool has_control_master() const
PBD::Property< bool > _active
Definition: route_group.h:177
int remove(std::shared_ptr< Route >)
void set_mute(bool yn)
void post_set(PBD::PropertyChange const &)
void make_subgroup(bool, Placement)
static void make_property_quarks()
bool is_sursend_enable() const
Definition: route_group.h:88
PBD::Signal2< void, RouteGroup *, std::weak_ptr< ARDOUR::Route > > RouteAdded
Definition: route_group.h:149
PBD::Signal2< void, RouteGroup *, std::weak_ptr< ARDOUR::Route > > RouteRemoved
Definition: route_group.h:151
void remove_when_going_away(std::weak_ptr< Route >)
PBD::Property< bool > _route_active
Definition: route_group.h:185
bool is_color() const
Definition: route_group.h:91
bool enabled_property(PBD::PropertyID)
PBD::Property< bool > _color
Definition: route_group.h:186
bool slaved() const
void set_color(bool yn)
gain_t get_min_factor(gain_t factor)
bool is_active() const
Definition: route_group.h:81
PBD::Property< bool > _monitoring
Definition: route_group.h:187
void unassign_master(std::shared_ptr< VCA >)
PBD::Property< int32_t > _group_master_number
Definition: route_group.h:188
PBD::Property< bool > _relative
Definition: route_group.h:176
std::shared_ptr< ControlGroup > _solo_group
Definition: route_group.h:190
bool is_mute() const
Definition: route_group.h:85
void audio_track_group(std::set< std::shared_ptr< AudioTrack > > &at_set)
PBD::Property< bool > _hidden
Definition: route_group.h:178
PBD::Property< bool > _gain
Definition: route_group.h:179
bool is_recenable() const
Definition: route_group.h:87
uint32_t rgba() const
Definition: route_group.h:162
void assign_master(std::shared_ptr< VCA >)
PBD::Property< bool > _solo
Definition: route_group.h:181
std::shared_ptr< ControlGroup > _gain_group
Definition: route_group.h:194
std::shared_ptr< Route > _subgroup_bus
Definition: route_group.h:173
std::weak_ptr< VCA > group_master
Definition: route_group.h:174
bool is_relative() const
Definition: route_group.h:82
void set_rgba(uint32_t)
int set_state(const XMLNode &, int version)
std::shared_ptr< ControlGroup > _monitoring_group
Definition: route_group.h:195
void set_monitoring(bool yn)
Definition: xml++.h:114
Function
Definition: gc.h:190
#define LIBARDOUR_API
PBD::PropertyDescriptor< bool > hidden
PBD::PropertyDescriptor< bool > active
PBD::PropertyDescriptor< bool > group_route_active
PBD::PropertyDescriptor< bool > group_color
PBD::PropertyDescriptor< bool > group_gain
PBD::PropertyDescriptor< uint32_t > color
PBD::PropertyDescriptor< bool > group_relative
PBD::PropertyDescriptor< bool > group_solo
PBD::PropertyDescriptor< bool > group_select
PBD::PropertyDescriptor< bool > group_mute
PBD::PropertyDescriptor< bool > group_monitoring
PBD::PropertyDescriptor< bool > group_recenable
PBD::PropertyDescriptor< bool > group_sursend_enable
PBD::PropertyDescriptor< int32_t > group_master_number
DebugBits Properties
GQuark PropertyID