switch MIDI Clock slave code to use DEBUG_TRACE; don't make it require start/stop...
[ardour2.git] / libs / ardour / export_channel_configuration.cc
blobcc68356d824c8e7419c7b1a018b44c03e9224ab0
1 /*
2 Copyright (C) 2008 Paul Davis
3 Author: Sakari Bergen
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.
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.
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.
21 #include "ardour/export_channel_configuration.h"
23 #include "ardour/export_handler.h"
24 #include "ardour/export_filename.h"
25 #include "ardour/export_timespan.h"
27 #include "ardour/audio_port.h"
28 #include "ardour/export_failed.h"
29 #include "ardour/midi_port.h"
30 #include "ardour/session.h"
31 #include "ardour/audioengine.h"
33 #include "pbd/convert.h"
34 #include "pbd/pthread_utils.h"
36 using namespace PBD;
38 namespace ARDOUR
41 /* ExportChannelConfiguration */
43 ExportChannelConfiguration::ExportChannelConfiguration (Session & session) :
44 session (session),
45 split (false)
50 XMLNode &
51 ExportChannelConfiguration::get_state ()
53 XMLNode * root = new XMLNode ("ExportChannelConfiguration");
54 XMLNode * channel;
56 root->add_property ("split", get_split() ? "true" : "false");
57 root->add_property ("channels", to_string (get_n_chans(), std::dec));
59 uint32_t i = 1;
60 for (ExportChannelConfiguration::ChannelList::const_iterator c_it = channels.begin(); c_it != channels.end(); ++c_it) {
61 channel = root->add_child ("Channel");
62 if (!channel) { continue; }
64 channel->add_property ("number", to_string (i, std::dec));
65 (*c_it)->get_state (channel);
67 ++i;
70 return *root;
73 int
74 ExportChannelConfiguration::set_state (const XMLNode & root)
76 XMLProperty const * prop;
78 if ((prop = root.property ("split"))) {
79 set_split (!prop->value().compare ("true"));
82 XMLNodeList channels = root.children ("Channel");
83 for (XMLNodeList::iterator it = channels.begin(); it != channels.end(); ++it) {
84 ExportChannelPtr channel (new PortExportChannel ());
85 channel->set_state (*it, session);
86 register_channel (channel);
89 return 0;
92 bool
93 ExportChannelConfiguration::all_channels_have_ports () const
95 for (ChannelList::const_iterator it = channels.begin(); it != channels.end(); ++it) {
96 if ((*it)->empty ()) { return false; }
99 return true;
102 } // namespace ARDOUR