summaryrefslogtreecommitdiff
path: root/libs/ardour/session_state.cc
diff options
context:
space:
mode:
authorPaul Davis <paul@linuxaudiosystems.com>2011-05-26 12:24:04 +0000
committerPaul Davis <paul@linuxaudiosystems.com>2011-05-26 12:24:04 +0000
commitf38db9a4e350de376308d89059ba123a16719f1a (patch)
tree911e0a02baee2cf412ea675d8267e0a449f25603 /libs/ardour/session_state.cc
parentaf02cbcafa96e7d88f1d06923ac00440be4d049b (diff)
move session file storage of nested sources from playlist into region, and reload them within Session::XMLRegionFactory, just before we create the region that uses the nested source
git-svn-id: svn://localhost/ardour2/branches/3.0@9595 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs/ardour/session_state.cc')
-rw-r--r--libs/ardour/session_state.cc29
1 files changed, 29 insertions, 0 deletions
diff --git a/libs/ardour/session_state.cc b/libs/ardour/session_state.cc
index 3af2288b66..3c2496eba5 100644
--- a/libs/ardour/session_state.cc
+++ b/libs/ardour/session_state.cc
@@ -1653,6 +1653,26 @@ Session::load_compounds (const XMLNode& node)
return 0;
}
+void
+Session::load_nested_sources (const XMLNode& node)
+{
+ XMLNodeList nlist;
+ XMLNodeConstIterator niter;
+
+ nlist = node.children();
+
+ for (niter = nlist.begin(); niter != nlist.end(); ++niter) {
+ if ((*niter)->name() == "Source") {
+ try {
+ SourceFactory::create (*this, **niter, true);
+ }
+ catch (failed_constructor& err) {
+ error << string_compose (_("Cannot reconstruct nested source for region %1"), name()) << endmsg;
+ }
+ }
+ }
+}
+
boost::shared_ptr<Region>
Session::XMLRegionFactory (const XMLNode& node, bool full)
{
@@ -1660,6 +1680,15 @@ Session::XMLRegionFactory (const XMLNode& node, bool full)
try {
+ const XMLNodeList& nlist = node.children();
+
+ for (XMLNodeConstIterator niter = nlist.begin(); niter != nlist.end(); ++niter) {
+ XMLNode *child = (*niter);
+ if (child->name() == "NestedSource") {
+ load_nested_sources (*child);
+ }
+ }
+
if (!type || type->value() == "audio") {
return boost::shared_ptr<Region>(XMLAudioRegionFactory (node, full));
} else if (type->value() == "midi") {