Ardour  9.0-rc1-54-g6eeed82fb3
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 #pragma once
25 
26 #include <list>
27 #include <set>
28 #include <string>
29 #include <stdint.h>
30 
31 #include "pbd/controllable.h"
32 #include "pbd/signals.h"
33 #include "pbd/stateful.h"
34 
35 #include "ardour/control_group.h"
36 #include "ardour/types.h"
37 #include "ardour/session_object.h"
38 
40 
41 namespace ARDOUR {
42 
43 namespace Properties {
56  /* we use these declared in region.cc */
58 };
59 
60 class Route;
61 class Track;
62 class AudioTrack;
63 class Session;
64 
72 class LIBARDOUR_API RouteGroup : public SessionObject, public std::enable_shared_from_this<RouteGroup>
73 {
74  public:
75  static void make_property_quarks();
76 
78 
79  bool is_active () const { return _active.val(); }
80  bool is_relative () const { return _relative.val(); }
81  bool is_hidden () const { return _hidden.val(); }
82  bool is_gain () const { return _gain.val(); }
83  bool is_mute () const { return _mute.val(); }
84  bool is_solo () const { return _solo.val(); }
85  bool is_recenable () const { return _recenable.val(); }
86  bool is_sursend_enable () const { return _sursend_enable.val(); }
87  bool is_select () const { return _select.val(); }
88  bool is_route_active () const { return _route_active.val(); }
89  bool is_color () const { return _color.val(); }
90  bool is_monitoring() const { return _monitoring.val(); }
91  int32_t group_master_number() const { return _group_master_number.val(); }
92  std::weak_ptr<Route> subgroup_bus() const { return _subgroup_bus; }
93 
94  bool empty() const {return routes->empty();}
95  size_t size() const { return routes->size();}
96 
99 
100  void set_active (bool yn, void *src);
101  void set_relative (bool yn, void *src);
102  void set_hidden (bool yn, void *src);
103 
104  void set_gain (bool yn);
105  void set_mute (bool yn);
106  void set_solo (bool yn);
107  void set_recenable (bool yn);
108  void set_sursend_enable (bool yn);
109  void set_select (bool yn);
110  void set_route_active (bool yn);
111  void set_color (bool yn);
112  void set_monitoring (bool yn);
113 
115 
116  int add (std::shared_ptr<Route>);
117  int remove (std::shared_ptr<Route>);
118 
119  template<typename Function> void foreach_route (Function f) { for (auto & r : *routes) {f (r); } }
120 
121  /* to use these, #include "ardour/route_group_specialized.h" */
122 
123  template<class T> void apply (void (Track::*func)(T, PBD::Controllable::GroupControlDisposition), T val, PBD::Controllable::GroupControlDisposition);
124 
125  /* fills at_set with all members of the group that are AudioTracks */
126 
127  void audio_track_group (std::set<std::shared_ptr<AudioTrack> >& at_set);
128 
129  void clear () {
130  routes->clear ();
131  changed();
132  }
133 
134  bool has_subgroup() const;
135  bool can_subgroup (bool, Placement) const;
136  void make_subgroup (bool, Placement);
138 
139  std::shared_ptr<RouteList> route_list() { return routes; }
140 
142  PBD::Signal<void(std::shared_ptr<RouteGroup>, std::weak_ptr<ARDOUR::Route> )> RouteAdded;
144  static PBD::Signal<void(std::shared_ptr<RouteGroup>, std::weak_ptr<ARDOUR::Route> )> RouteRemoved;
145 
146  XMLNode& get_state () const;
147 
148  int set_state (const XMLNode&, int version);
149 
150  void assign_master (std::shared_ptr<VCA>);
151  void unassign_master (std::shared_ptr<VCA>);
152  bool has_control_master() const;
153  bool slaved () const;
154 
155  uint32_t rgba () const { return _rgba; }
156 
158  void set_rgba (uint32_t);
159 
160  /* directly set color only, used to convert old 5.x gui-object-state
161  * to libardour color */
162  void migrate_rgba (uint32_t color) { _rgba = color; }
163 
164  protected:
165  friend class Session;
166  RouteGroup (Session& s, const std::string &n);
167 
168  private:
169  std::shared_ptr<RouteList> routes;
170  std::shared_ptr<Route> _subgroup_bus;
171  std::weak_ptr<VCA> group_master;
172 
186 
187  std::shared_ptr<ControlGroup> _solo_group;
188  std::shared_ptr<ControlGroup> _mute_group;
189  std::shared_ptr<ControlGroup> _rec_enable_group;
190  std::shared_ptr<ControlGroup> _sursend_enable_group;
191  std::shared_ptr<ControlGroup> _gain_group;
192  std::shared_ptr<ControlGroup> _monitoring_group;
193 
194  bool check_subgroup (bool, Placement, DataType&, uint32_t&) const;
195  void remove_when_going_away (std::weak_ptr<Route>);
198  int set_state_2X (const XMLNode&, int);
199 
201  void push_to_groups ();
202 
203  uint32_t _rgba;
205 };
206 
207 } /* namespace */
208 
std::shared_ptr< RouteList > routes
Definition: route_group.h:169
bool can_subgroup(bool, Placement) const
void foreach_route(Function f)
Definition: route_group.h:119
size_t size() const
Definition: route_group.h:95
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:82
void set_route_active(bool yn)
std::weak_ptr< Route > subgroup_bus() const
Definition: route_group.h:92
bool empty() const
Definition: route_group.h:94
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:91
void set_gain(bool yn)
void migrate_rgba(uint32_t color)
Definition: route_group.h:162
bool is_solo() const
Definition: route_group.h:84
int set_state_2X(const XMLNode &, int)
std::shared_ptr< ControlGroup > _rec_enable_group
Definition: route_group.h:189
bool has_subgroup() const
void set_relative(bool yn, void *src)
std::shared_ptr< ControlGroup > _mute_group
Definition: route_group.h:188
PBD::Property< bool > _mute
Definition: route_group.h:177
std::shared_ptr< ControlGroup > _sursend_enable_group
Definition: route_group.h:190
bool is_select() const
Definition: route_group.h:87
void update_surround_sends()
PBD::Property< bool > _select
Definition: route_group.h:181
bool is_route_active() const
Definition: route_group.h:88
void set_recenable(bool yn)
bool is_hidden() const
Definition: route_group.h:81
PBD::Property< bool > _sursend_enable
Definition: route_group.h:180
bool check_subgroup(bool, Placement, DataType &, uint32_t &) const
std::shared_ptr< RouteList > route_list()
Definition: route_group.h:139
XMLNode & get_state() const
PBD::Property< bool > _recenable
Definition: route_group.h:179
bool is_monitoring() const
Definition: route_group.h:90
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:174
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:86
static PBD::Signal< void(std::shared_ptr< RouteGroup >, std::weak_ptr< ARDOUR::Route >)> RouteRemoved
Definition: route_group.h:144
void remove_when_going_away(std::weak_ptr< Route >)
PBD::Property< bool > _route_active
Definition: route_group.h:182
bool is_color() const
Definition: route_group.h:89
bool enabled_property(PBD::PropertyID)
PBD::Property< bool > _color
Definition: route_group.h:183
bool slaved() const
PBD::Signal< void(std::shared_ptr< RouteGroup >, std::weak_ptr< ARDOUR::Route >)> RouteAdded
Definition: route_group.h:142
void set_color(bool yn)
gain_t get_min_factor(gain_t factor)
bool is_active() const
Definition: route_group.h:79
PBD::Property< bool > _monitoring
Definition: route_group.h:184
void unassign_master(std::shared_ptr< VCA >)
PBD::Property< int32_t > _group_master_number
Definition: route_group.h:185
PBD::Property< bool > _relative
Definition: route_group.h:173
std::shared_ptr< ControlGroup > _solo_group
Definition: route_group.h:187
bool is_mute() const
Definition: route_group.h:83
void audio_track_group(std::set< std::shared_ptr< AudioTrack > > &at_set)
PBD::Property< bool > _hidden
Definition: route_group.h:175
PBD::Property< bool > _gain
Definition: route_group.h:176
bool is_recenable() const
Definition: route_group.h:85
uint32_t rgba() const
Definition: route_group.h:155
void assign_master(std::shared_ptr< VCA >)
PBD::Property< bool > _solo
Definition: route_group.h:178
std::shared_ptr< ControlGroup > _gain_group
Definition: route_group.h:191
std::shared_ptr< Route > _subgroup_bus
Definition: route_group.h:170
std::weak_ptr< VCA > group_master
Definition: route_group.h:171
bool is_relative() const
Definition: route_group.h:80
void set_rgba(uint32_t)
int set_state(const XMLNode &, int version)
std::shared_ptr< ControlGroup > _monitoring_group
Definition: route_group.h:192
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