Ardour  9.0-pre0-582-g084a23a80d
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 
73 {
74 public:
75  static void make_property_quarks();
76 
77  RouteGroup (Session& s, const std::string &n);
79 
80  bool is_active () const { return _active.val(); }
81  bool is_relative () const { return _relative.val(); }
82  bool is_hidden () const { return _hidden.val(); }
83  bool is_gain () const { return _gain.val(); }
84  bool is_mute () const { return _mute.val(); }
85  bool is_solo () const { return _solo.val(); }
86  bool is_recenable () const { return _recenable.val(); }
87  bool is_sursend_enable () const { return _sursend_enable.val(); }
88  bool is_select () const { return _select.val(); }
89  bool is_route_active () const { return _route_active.val(); }
90  bool is_color () const { return _color.val(); }
91  bool is_monitoring() const { return _monitoring.val(); }
92  int32_t group_master_number() const { return _group_master_number.val(); }
93  std::weak_ptr<Route> subgroup_bus() const { return _subgroup_bus; }
94 
95  bool empty() const {return routes->empty();}
96  size_t size() const { return routes->size();}
97 
100 
101  void set_active (bool yn, void *src);
102  void set_relative (bool yn, void *src);
103  void set_hidden (bool yn, void *src);
104 
105  void set_gain (bool yn);
106  void set_mute (bool yn);
107  void set_solo (bool yn);
108  void set_recenable (bool yn);
109  void set_sursend_enable (bool yn);
110  void set_select (bool yn);
111  void set_route_active (bool yn);
112  void set_color (bool yn);
113  void set_monitoring (bool yn);
114 
116 
117  int add (std::shared_ptr<Route>);
118  int remove (std::shared_ptr<Route>);
119 
120  template<typename Function>
122  for (RouteList::iterator i = routes->begin(); i != routes->end(); ++i) {
123  f (i->get());
124  }
125  }
126 
127  /* to use these, #include "ardour/route_group_specialized.h" */
128 
129  template<class T> void apply (void (Track::*func)(T, PBD::Controllable::GroupControlDisposition), T val, PBD::Controllable::GroupControlDisposition);
130 
131  /* fills at_set with all members of the group that are AudioTracks */
132 
133  void audio_track_group (std::set<std::shared_ptr<AudioTrack> >& at_set);
134 
135  void clear () {
136  routes->clear ();
137  changed();
138  }
139 
140  bool has_subgroup() const;
141  bool can_subgroup (bool, Placement) const;
142  void make_subgroup (bool, Placement);
144 
145  std::shared_ptr<RouteList> route_list() { return routes; }
146 
148  PBD::Signal<void(RouteGroup *, std::weak_ptr<ARDOUR::Route> )> RouteAdded;
150  PBD::Signal<void(RouteGroup *, std::weak_ptr<ARDOUR::Route> )> RouteRemoved;
151 
152  XMLNode& get_state () const;
153 
154  int set_state (const XMLNode&, int version);
155 
156  void assign_master (std::shared_ptr<VCA>);
157  void unassign_master (std::shared_ptr<VCA>);
158  bool has_control_master() const;
159  bool slaved () const;
160 
161  uint32_t rgba () const { return _rgba; }
162 
164  void set_rgba (uint32_t);
165 
166  /* directly set color only, used to convert old 5.x gui-object-state
167  * to libardour color */
168  void migrate_rgba (uint32_t color) { _rgba = color; }
169 
170 private:
171  std::shared_ptr<RouteList> routes;
172  std::shared_ptr<Route> _subgroup_bus;
173  std::weak_ptr<VCA> group_master;
174 
188 
189  std::shared_ptr<ControlGroup> _solo_group;
190  std::shared_ptr<ControlGroup> _mute_group;
191  std::shared_ptr<ControlGroup> _rec_enable_group;
192  std::shared_ptr<ControlGroup> _sursend_enable_group;
193  std::shared_ptr<ControlGroup> _gain_group;
194  std::shared_ptr<ControlGroup> _monitoring_group;
195 
196  bool check_subgroup (bool, Placement, DataType&, uint32_t&) const;
197  void remove_when_going_away (std::weak_ptr<Route>);
200  int set_state_2X (const XMLNode&, int);
201 
203  void push_to_groups ();
204 
205  uint32_t _rgba;
207 };
208 
209 } /* namespace */
210 
std::shared_ptr< RouteList > routes
Definition: route_group.h:171
bool can_subgroup(bool, Placement) const
void foreach_route(Function f)
Definition: route_group.h:121
PBD::Signal< void(RouteGroup *, std::weak_ptr< ARDOUR::Route >)> RouteRemoved
Definition: route_group.h:150
size_t size() const
Definition: route_group.h:96
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:83
void set_route_active(bool yn)
std::weak_ptr< Route > subgroup_bus() const
Definition: route_group.h:93
bool empty() const
Definition: route_group.h:95
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:92
void set_gain(bool yn)
void migrate_rgba(uint32_t color)
Definition: route_group.h:168
bool is_solo() const
Definition: route_group.h:85
int set_state_2X(const XMLNode &, int)
std::shared_ptr< ControlGroup > _rec_enable_group
Definition: route_group.h:191
bool has_subgroup() const
void set_relative(bool yn, void *src)
std::shared_ptr< ControlGroup > _mute_group
Definition: route_group.h:190
PBD::Property< bool > _mute
Definition: route_group.h:179
std::shared_ptr< ControlGroup > _sursend_enable_group
Definition: route_group.h:192
bool is_select() const
Definition: route_group.h:88
void update_surround_sends()
PBD::Property< bool > _select
Definition: route_group.h:183
bool is_route_active() const
Definition: route_group.h:89
void set_recenable(bool yn)
bool is_hidden() const
Definition: route_group.h:82
PBD::Property< bool > _sursend_enable
Definition: route_group.h:182
bool check_subgroup(bool, Placement, DataType &, uint32_t &) const
std::shared_ptr< RouteList > route_list()
Definition: route_group.h:145
XMLNode & get_state() const
PBD::Property< bool > _recenable
Definition: route_group.h:181
bool is_monitoring() const
Definition: route_group.h:91
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:176
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:87
void remove_when_going_away(std::weak_ptr< Route >)
PBD::Property< bool > _route_active
Definition: route_group.h:184
bool is_color() const
Definition: route_group.h:90
bool enabled_property(PBD::PropertyID)
PBD::Signal< void(RouteGroup *, std::weak_ptr< ARDOUR::Route >)> RouteAdded
Definition: route_group.h:148
PBD::Property< bool > _color
Definition: route_group.h:185
bool slaved() const
void set_color(bool yn)
gain_t get_min_factor(gain_t factor)
bool is_active() const
Definition: route_group.h:80
PBD::Property< bool > _monitoring
Definition: route_group.h:186
void unassign_master(std::shared_ptr< VCA >)
PBD::Property< int32_t > _group_master_number
Definition: route_group.h:187
PBD::Property< bool > _relative
Definition: route_group.h:175
std::shared_ptr< ControlGroup > _solo_group
Definition: route_group.h:189
bool is_mute() const
Definition: route_group.h:84
void audio_track_group(std::set< std::shared_ptr< AudioTrack > > &at_set)
PBD::Property< bool > _hidden
Definition: route_group.h:177
PBD::Property< bool > _gain
Definition: route_group.h:178
bool is_recenable() const
Definition: route_group.h:86
uint32_t rgba() const
Definition: route_group.h:161
void assign_master(std::shared_ptr< VCA >)
PBD::Property< bool > _solo
Definition: route_group.h:180
std::shared_ptr< ControlGroup > _gain_group
Definition: route_group.h:193
std::shared_ptr< Route > _subgroup_bus
Definition: route_group.h:172
std::weak_ptr< VCA > group_master
Definition: route_group.h:173
bool is_relative() const
Definition: route_group.h:81
void set_rgba(uint32_t)
int set_state(const XMLNode &, int version)
std::shared_ptr< ControlGroup > _monitoring_group
Definition: route_group.h:194
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