2 Copyright (C) 2002 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_bundle_h__
21 #define __ardour_bundle_h__
25 #include <sigc++/signal.h>
26 #include <glibmm/thread.h>
27 #include <pbd/stateful.h>
35 * A set of `channels', each of which is associated with 0 or more
39 class Bundle : public PBD::Stateful, public sigc::trackable {
43 * @param name Name for this Bundle.
44 * @param dy true if this Bundle is `dynamic', ie it is created on-the-fly
45 * and should not be written to the session file.
47 Bundle (string name, bool dy = false) : _name (name), _dynamic(dy) {}
50 /// A vector of JACK port names
51 typedef vector<string> PortList;
53 void set_name (string name, void *src);
56 * @return name of this Bundle.
58 string name() const { return _name; }
61 * @return true if this Bundle is marked as `dynamic', meaning
62 * that it won't be written to the session file.
64 bool dynamic() const { return _dynamic; }
67 * @return Number of channels that this Bundle has.
69 uint32_t nchannels () const { return _channels.size(); }
70 const PortList& channel_ports (int ch) const;
72 void set_nchannels (int n);
74 void add_port_to_channel (int ch, string portname);
75 void remove_port_from_channel (int ch, string portname);
78 sigc::signal<void, void*> NameChanged;
79 /// The number of channels changed
80 sigc::signal<void> ConfigurationChanged;
81 /// The ports associated with one of our channels changed
82 sigc::signal<void, int> PortsChanged;
84 bool operator==(const Bundle& other) const;
86 XMLNode& get_state (void);
87 int set_state (const XMLNode&);
90 Bundle (const XMLNode&);
93 mutable Glib::Mutex channels_lock; ///< mutex for _channels
94 vector<PortList> _channels; ///< list of JACK ports associated with each of our channels
95 string _name; ///< name
96 bool _dynamic; ///< true if `dynamic', ie not to be written to the session file
98 int set_channels (const string& str);
99 int parse_io_string (const string& str, vector<string>& ports);
103 * Bundle in which the JACK ports are inputs.
106 class InputBundle : public Bundle {
109 * InputBundle constructor.
111 * \param dy true if this Bundle is `dynamic'; ie it is created on-the-fly
112 * and should not be written to the session file.
114 InputBundle (string name, bool dy = false) : Bundle (name, dy) {}
115 InputBundle (const XMLNode&);
119 * Bundle in which the JACK ports are outputs.
122 class OutputBundle : public Bundle {
125 * OutputBundle constructor.
127 * \param dy true if this Bundle is `dynamic'; ie it is created on-the-fly
128 * and should not be written to the session file.
130 OutputBundle (string name, bool dy = false) : Bundle (name, dy) {}
131 OutputBundle (const XMLNode&);
136 #endif /* __ardour_bundle_h__ */