2 Copyright (C) 2000 Paul Davis
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.
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.
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.
20 #ifndef __ardour_route_group_h__
21 #define __ardour_route_group_h__
27 #include "pbd/signals.h"
29 #include "pbd/stateful.h"
30 #include "pbd/signals.h"
32 #include "ardour/types.h"
41 class RouteGroup : public PBD::Stateful, public PBD::ScopedConnectionList {
58 RouteGroup (Session& s, const std::string &n, Flag f = Flag(0), Property p = Property(0));
61 const std::string& name() { return _name; }
62 void set_name (std::string str);
64 bool is_active () const { return _flags & Active; }
65 bool is_relative () const { return _flags & Relative; }
66 bool is_hidden () const { return _flags & Hidden; }
67 bool empty() const {return routes->empty();}
68 size_t size() const { return routes->size();}
70 gain_t get_max_factor(gain_t factor);
71 gain_t get_min_factor(gain_t factor);
73 void set_active (bool yn, void *src);
74 void set_relative (bool yn, void *src);
75 void set_hidden (bool yn, void *src);
77 bool property (Property p) const {
78 return ((_properties & p) == p);
81 bool active_property (Property p) const {
82 return is_active() && property (p);
85 void set_property (Property p, bool v) {
86 _properties = (Property) (_properties & ~p);
88 _properties = (Property) (_properties | p);
92 int add (boost::shared_ptr<Route>);
93 int remove (boost::shared_ptr<Route>);
95 void apply (void (Route::*func)(void *), void *src) {
96 for (RouteList::iterator i = routes->begin(); i != routes->end(); i++) {
97 ((*i).get()->*func)(src);
101 template<class T> void apply (void (Route::*func)(T, void *), T val, void *src) {
102 for (RouteList::iterator i = routes->begin(); i != routes->end(); i++) {
103 ((*i).get()->*func)(val, src);
107 template<class T> void foreach_route (T *obj, void (T::*func)(Route&)) {
108 for (RouteList::iterator i = routes->begin(); i != routes->end(); i++) {
113 /* to use these, #include "ardour/route_group_specialized.h" */
115 template<class T> void apply (void (Track::*func)(T, void *), T val, void *src);
117 /* fills at_set with all members of the group that are AudioTracks */
119 void audio_track_group (std::set<boost::shared_ptr<AudioTrack> >& at_set);
126 void make_subgroup ();
127 void destroy_subgroup ();
129 boost::shared_ptr<RouteList> route_list() { return routes; }
131 PBD::Signal0<void> changed;
132 PBD::Signal1<void,void*> FlagsChanged;
134 XMLNode& get_state ();
136 int set_state (const XMLNode&, int version);
140 boost::shared_ptr<RouteList> routes;
141 boost::shared_ptr<Route> subgroup_bus;
144 Property _properties;
146 void remove_when_going_away (boost::weak_ptr<Route>);
147 int set_state_2X (const XMLNode&, int);
152 #endif /* __ardour_route_group_h__ */