partially revert some of the recent work on tempo to reflect new understanding of...
[ardour.git] / libs / ardour / ardour / export_channel_configuration.h
1 /*
2     Copyright (C) 2008 Paul Davis
3     Author: Sakari Bergen
4
5     This program is free software; you can redistribute it and/or modify
6     it under the terms of the GNU General Public License as published by
7     the Free Software Foundation; either version 2 of the License, or
8     (at your option) any later version.
9
10     This program is distributed in the hope that it will be useful,
11     but WITHOUT ANY WARRANTY; without even the implied warranty of
12     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13     GNU General Public License for more details.
14
15     You should have received a copy of the GNU General Public License
16     along with this program; if not, write to the Free Software
17     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
18
19 */
20
21 #ifndef __ardour_export_channel_configuration_h__
22 #define __ardour_export_channel_configuration_h__
23
24 #include <list>
25 #include <string>
26 #include <algorithm>
27
28 #include <boost/enable_shared_from_this.hpp>
29
30 #include "ardour/export_channel.h"
31 #include "ardour/export_status.h"
32 #include "ardour/ardour.h"
33
34 #include "pbd/xml++.h"
35
36 namespace ARDOUR
37 {
38
39 class ExportHandler;
40 class AudioPort;
41 class ExportChannel;
42 class ExportFormatSpecification;
43 class ExportFilename;
44 class ExportProcessor;
45 class ExportTimespan;
46 class Session;
47
48 class ExportChannelConfiguration : public boost::enable_shared_from_this<ExportChannelConfiguration>
49 {
50
51   private:
52         friend class ExportElementFactory;
53         ExportChannelConfiguration (Session & session);
54
55   public:
56         bool operator== (ExportChannelConfiguration const & other) const { return channels == other.channels; }
57         bool operator!= (ExportChannelConfiguration const & other) const { return channels != other.channels; }
58
59         XMLNode & get_state ();
60         int set_state (const XMLNode &);
61
62         typedef std::list<ExportChannelPtr> ChannelList;
63
64         ChannelList const & get_channels () const { return channels; }
65         bool all_channels_have_ports () const;
66
67         std::string name () const { return _name; }
68         void set_name (std::string name) { _name = name; }
69         void set_split (bool value) { split = value; }
70
71         bool get_split () const { return split; }
72         uint32_t get_n_chans () const { return channels.size(); }
73
74         void register_channel (ExportChannelPtr channel) { channels.push_back (channel); }
75         void register_channels (ChannelList const & new_channels) {
76                 std::copy (new_channels.begin(), new_channels.end(), std::back_inserter(channels));
77         }
78         void clear_channels () { channels.clear (); }
79
80         /** Returns a list of channel configurations that match the files created.
81           * I.e. many configurations if splitting is enabled, one if not. */
82         void configurations_for_files (std::list<boost::shared_ptr<ExportChannelConfiguration> > & configs);
83
84   private:
85
86         Session & session;
87
88         ChannelList     channels;
89         bool            split; // Split to mono files
90         std::string  _name;
91 };
92
93 } // namespace ARDOUR
94
95 #endif /* __ardour_export_channel_configuration_h__ */