Various work on bundles. We now have a Bundle Manager dialogue, and hopefully things...
[ardour.git] / libs / ardour / ardour / bundle.h
1 /*
2     Copyright (C) 2002-2007 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_bundle_h__
21 #define __ardour_bundle_h__
22
23 #include <string>
24 #include <sigc++/signal.h>
25 #include "ardour/data_type.h"
26
27 namespace ARDOUR {
28
29 typedef std::vector<std::string> PortList;
30   
31 /**
32  *  A set of `channels', each of which is associated with 0 or more JACK ports.
33  */
34
35 class Bundle {
36   public:
37         Bundle () : _type (DataType::AUDIO) {}
38         Bundle (bool i) : _type (DataType::AUDIO), _ports_are_inputs (i) {}
39         Bundle (std::string const & n, bool i = true) : _name (n), _type (DataType::AUDIO), _ports_are_inputs (i) {}
40         virtual ~Bundle() {}
41
42         /**
43          *  @return Number of channels that this Bundle has.
44          */
45         virtual uint32_t nchannels () const = 0;
46         virtual const PortList& channel_ports (uint32_t) const = 0;
47
48         void set_name (std::string const & n) {
49                 _name = n;
50                 NameChanged ();
51         }
52         
53         std::string name () const { return _name; }
54
55         sigc::signal<void> NameChanged;
56
57         void set_type (DataType t) { _type = t; }
58         DataType type () const { return _type; }
59
60         void set_ports_are_inputs () { _ports_are_inputs = true; }
61         void set_ports_are_outputs () { _ports_are_inputs = false; }
62         bool ports_are_inputs () const { return _ports_are_inputs; }
63         bool ports_are_outputs () const { return !_ports_are_inputs; }
64
65   private:
66         std::string _name;
67         ARDOUR::DataType _type;
68         bool _ports_are_inputs;
69 };
70
71 }
72
73 #endif /* __ardour_bundle_h__ */