ardour
route_group.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2000 Paul Davis
3 
4  This program is free software; you can redistribute it and/or modify
5  it under the terms of the GNU General Public License as published by
6  the Free Software Foundation; either version 2 of the License, or
7  (at your option) any later version.
8 
9  This program is distributed in the hope that it will be useful,
10  but WITHOUT ANY WARRANTY; without even the implied warranty of
11  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  GNU General Public License for more details.
13 
14  You should have received a copy of the GNU General Public License
15  along with this program; if not, write to the Free Software
16  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
17 
18 */
19 
20 #ifndef __ardour_route_group_h__
21 #define __ardour_route_group_h__
22 
23 #include <list>
24 #include <set>
25 #include <string>
26 #include <stdint.h>
27 
28 #include "pbd/signals.h"
29 #include "pbd/stateful.h"
30 #include "pbd/signals.h"
31 
33 #include "ardour/types.h"
34 #include "ardour/session_object.h"
35 
36 namespace ARDOUR {
37 
38 namespace Properties {
49  /* we use this, but its declared in region.cc */
51 };
52 
53 class Route;
54 class Track;
55 class AudioTrack;
56 class Session;
57 
59 {
60  public:
61  static void make_property_quarks();
62 
63  RouteGroup (Session& s, const std::string &n);
64  ~RouteGroup ();
65 
66  bool is_active () const { return _active.val(); }
67  bool is_relative () const { return _relative.val(); }
68  bool is_hidden () const { return _hidden.val(); }
69  bool is_gain () const { return _gain.val(); }
70  bool is_mute () const { return _mute.val(); }
71  bool is_solo () const { return _solo.val(); }
72  bool is_recenable () const { return _recenable.val(); }
73  bool is_select () const { return _select.val(); }
74  bool is_route_active () const { return _route_active.val(); }
75  bool is_color () const { return _color.val(); }
76  bool is_monitoring() const { return _monitoring.val(); }
77 
78  bool empty() const {return routes->empty();}
79  size_t size() const { return routes->size();}
80 
81  gain_t get_max_factor(gain_t factor);
82  gain_t get_min_factor(gain_t factor);
83 
84  void set_active (bool yn, void *src);
85  void set_relative (bool yn, void *src);
86  void set_hidden (bool yn, void *src);
87 
88  void set_gain (bool yn);
89  void set_mute (bool yn);
90  void set_solo (bool yn);
91  void set_recenable (bool yn);
92  void set_select (bool yn);
93  void set_route_active (bool yn);
94  void set_color (bool yn);
95  void set_monitoring (bool yn);
96 
97  bool enabled_property (PBD::PropertyID);
98 
99  int add (boost::shared_ptr<Route>);
100  int remove (boost::shared_ptr<Route>);
101 
102  template<typename Function>
103  void foreach_route (Function f) {
104  for (RouteList::iterator i = routes->begin(); i != routes->end(); ++i) {
105  f (i->get());
106  }
107  }
108 
109  /* to use these, #include "ardour/route_group_specialized.h" */
110 
111  template<class T> void apply (void (Track::*func)(T, void *), T val, void *src);
112 
113  /* fills at_set with all members of the group that are AudioTracks */
114 
115  void audio_track_group (std::set<boost::shared_ptr<AudioTrack> >& at_set);
116 
117  void clear () {
118  routes->clear ();
119  changed();
120  }
121 
122  bool has_subgroup() const;
123  void make_subgroup (bool, Placement);
124  void destroy_subgroup ();
125 
127 
129  PBD::Signal2<void, RouteGroup *, boost::weak_ptr<ARDOUR::Route> > RouteAdded;
131  PBD::Signal2<void, RouteGroup *, boost::weak_ptr<ARDOUR::Route> > RouteRemoved;
132 
133  XMLNode& get_state ();
134 
135  int set_state (const XMLNode&, int version);
136 
137 private:
140 
152 
153  void remove_when_going_away (boost::weak_ptr<Route>);
154  int set_state_2X (const XMLNode&, int);
155 };
156 
157 } /* namespace */
158 
159 #endif /* __ardour_route_group_h__ */
size_t size() const
Definition: route_group.h:79
PBD::Property< bool > _solo
Definition: route_group.h:146
bool is_mute() const
Definition: route_group.h:70
bool is_gain() const
Definition: route_group.h:69
LIBARDOUR_API PBD::PropertyDescriptor< bool > hidden
Definition: route_group.h:50
bool is_select() const
Definition: route_group.h:73
tuple f
Definition: signals.py:35
LIBARDOUR_API PBD::PropertyDescriptor< bool > gain
Definition: route_group.cc:44
PBD::Signal2< void, RouteGroup *, boost::weak_ptr< ARDOUR::Route > > RouteRemoved
Definition: route_group.h:131
float gain_t
Definition: types.h:58
bool is_hidden() const
Definition: route_group.h:68
PBD::Property< bool > _recenable
Definition: route_group.h:147
PBD::Property< bool > _active
Definition: route_group.h:142
GQuark PropertyID
PBD::Property< bool > _route_active
Definition: route_group.h:149
PBD::Property< bool > _hidden
Definition: route_group.h:143
boost::shared_ptr< RouteList > routes
Definition: route_group.h:138
LIBARDOUR_API PBD::PropertyDescriptor< bool > recenable
Definition: route_group.cc:47
LIBARDOUR_API PBD::PropertyDescriptor< bool > route_active
Definition: route_group.cc:49
Definition: amp.h:29
bool is_active() const
Definition: route_group.h:66
bool is_route_active() const
Definition: route_group.h:74
PBD::Property< bool > _relative
Definition: route_group.h:141
bool is_recenable() const
Definition: route_group.h:72
PBD::Property< bool > _color
Definition: route_group.h:150
boost::shared_ptr< Route > subgroup_bus
Definition: route_group.h:139
LIBARDOUR_API PBD::PropertyDescriptor< bool > mute
Definition: route_group.cc:45
LIBARDOUR_API void make_property_quarks()
PBD::Property< bool > _select
Definition: route_group.h:148
LIBARDOUR_API PBD::PropertyDescriptor< bool > active
Definition: route_group.cc:43
#define LIBARDOUR_API
bool is_monitoring() const
Definition: route_group.h:76
bool is_solo() const
Definition: route_group.h:71
PBD::Property< bool > _gain
Definition: route_group.h:144
LIBARDOUR_API PBD::PropertyDescriptor< bool > solo
Definition: route_group.cc:46
LIBARDOUR_API PBD::PropertyDescriptor< bool > relative
Definition: route_group.cc:42
Definition: xml++.h:95
boost::shared_ptr< RouteList > route_list()
Definition: route_group.h:126
bool is_color() const
Definition: route_group.h:75
bool is_relative() const
Definition: route_group.h:67
PBD::Signal2< void, RouteGroup *, boost::weak_ptr< ARDOUR::Route > > RouteAdded
Definition: route_group.h:129
LIBARDOUR_API PBD::PropertyDescriptor< bool > select
Definition: route_group.cc:48
PBD::Property< bool > _mute
Definition: route_group.h:145
Placement
Definition: types.h:375
bool empty() const
Definition: route_group.h:78
void foreach_route(Function f)
Definition: route_group.h:103
PBD::Property< bool > _monitoring
Definition: route_group.h:151
LIBARDOUR_API PBD::PropertyDescriptor< bool > color
Definition: route_group.cc:50
LIBARDOUR_API PBD::PropertyDescriptor< bool > monitoring
Definition: route_group.cc:51