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 <sigc++/signal.h>
28 #include "pbd/stateful.h"
29 #include "ardour/types.h"
38 class RouteGroup : public PBD::Stateful, public sigc::trackable {
55 RouteGroup (Session& s, const std::string &n, Flag f = Flag(0), Property p = Property(0));
57 const std::string& name() { return _name; }
58 void set_name (std::string str);
60 bool is_active () const { return _flags & Active; }
61 bool is_relative () const { return _flags & Relative; }
62 bool is_hidden () const { return _flags & Hidden; }
63 bool empty() const {return routes.empty();}
65 gain_t get_max_factor(gain_t factor);
66 gain_t get_min_factor(gain_t factor);
68 int size() { return routes.size();}
70 void set_active (bool yn, void *src);
71 void set_relative (bool yn, void *src);
72 void set_hidden (bool yn, void *src);
74 bool property (Property p) const {
75 return ((_properties & p) == p);
78 bool active_property (Property p) const {
79 return is_active() && property (p);
82 void set_property (Property p, bool v) {
83 _properties = (Property) (_properties & ~p);
85 _properties = (Property) (_properties | p);
93 void apply (void (Route::*func)(void *), void *src) {
94 for (std::list<Route *>::iterator i = routes.begin(); i != routes.end(); i++) {
99 template<class T> void apply (void (Route::*func)(T, void *), T val, void *src) {
100 for (std::list<Route *>::iterator i = routes.begin(); i != routes.end(); i++) {
101 ((*i)->*func)(val, src);
105 template<class T> void foreach_route (T *obj, void (T::*func)(Route&)) {
106 for (std::list<Route *>::iterator i = routes.begin(); i != routes.end(); i++) {
111 /* to use these, #include "ardour/route_group_specialized.h" */
113 template<class T> void apply (void (Track::*func)(T, void *), T val, void *src);
115 /* fills at_set with all members of the group that are AudioTracks */
117 void audio_track_group (std::set<AudioTrack*>& at_set);
124 void make_subgroup ();
125 void destroy_subgroup ();
127 const std::list<Route*>& route_list() { return routes; }
129 sigc::signal<void> changed;
130 sigc::signal<void,void*> FlagsChanged;
132 XMLNode& get_state ();
134 int set_state (const XMLNode&, int version);
138 std::list<Route *> routes;
139 boost::shared_ptr<Route> subgroup_bus;
142 Property _properties;
144 void remove_when_going_away (Route*);
145 int set_state_2X (const XMLNode&, int);
150 #endif /* __ardour_route_group_h__ */