2 * Copyright (C) 2008-2009 Paul Davis <paul@linuxaudiosystems.com>
3 * Copyright (C) 2008-2012 Sakari Bergen <sakari.bergen@beatwaves.net>
4 * Copyright (C) 2009-2012 David Robillard <d@drobilla.net>
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License along
17 * with this program; if not, write to the Free Software Foundation, Inc.,
18 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
21 #include "ardour/export_channel_configuration.h"
23 #include "pbd/convert.h"
24 #include "pbd/enumwriter.h"
25 #include "pbd/pthread_utils.h"
32 /* ExportChannelConfiguration */
34 ExportChannelConfiguration::ExportChannelConfiguration (Session & session)
37 , region_type (RegionExportChannelFactory::None)
43 ExportChannelConfiguration::get_state ()
45 XMLNode * root = new XMLNode ("ExportChannelConfiguration");
48 root->set_property ("split", get_split());
49 root->set_property ("channels", get_n_chans());
51 switch (region_type) {
52 case RegionExportChannelFactory::None:
56 root->set_property ("region-processing", enum_2_string (region_type));
61 for (ExportChannelConfiguration::ChannelList::const_iterator c_it = channels.begin(); c_it != channels.end(); ++c_it) {
62 channel = root->add_child ("Channel");
63 if (!channel) { continue; }
65 channel->set_property ("number", i);
66 (*c_it)->get_state (channel);
75 ExportChannelConfiguration::set_state (const XMLNode & root)
78 if (root.get_property ("split", yn)) {
83 if (root.get_property ("region-processing", str)) {
84 set_region_processing_type ((RegionExportChannelFactory::Type)
85 string_2_enum (str, RegionExportChannelFactory::Type));
88 XMLNodeList channels = root.children ("Channel");
89 for (XMLNodeList::iterator it = channels.begin(); it != channels.end(); ++it) {
90 ExportChannelPtr channel (new PortExportChannel ());
91 channel->set_state (*it, session);
92 register_channel (channel);
99 ExportChannelConfiguration::all_channels_have_ports () const
101 for (ChannelList::const_iterator it = channels.begin(); it != channels.end(); ++it) {
102 if ((*it)->empty ()) { return false; }
109 ExportChannelConfiguration::configurations_for_files (std::list<boost::shared_ptr<ExportChannelConfiguration> > & configs)
114 configs.push_back (shared_from_this ());
118 for (ChannelList::const_iterator it = channels.begin (); it != channels.end (); ++it) {
119 boost::shared_ptr<ExportChannelConfiguration> config (new ExportChannelConfiguration (session));
120 config->set_name (_name);
121 config->register_channel (*it);
122 configs.push_back (config);
126 } // namespace ARDOUR