diff options
Diffstat (limited to 'libs')
-rw-r--r-- | libs/ardour/region.cc | 6 | ||||
-rw-r--r-- | libs/ardour/session_state.cc | 23 | ||||
-rw-r--r-- | libs/ardour/source_factory.cc | 3 |
3 files changed, 26 insertions, 6 deletions
diff --git a/libs/ardour/region.cc b/libs/ardour/region.cc index 8a95f22f8d..76b7ec0ec6 100644 --- a/libs/ardour/region.cc +++ b/libs/ardour/region.cc @@ -1207,7 +1207,11 @@ Region::state () node->add_property (buf2, buf); } - if (max_source_level() > 0) { + /* Only store nested sources for the whole-file region that acts + as the parent/root of all regions using it. + */ + + if (_whole_file && max_source_level() > 0) { XMLNode* nested_node = new XMLNode (X_("NestedSource")); diff --git a/libs/ardour/session_state.cc b/libs/ardour/session_state.cc index 5d9967cc98..8022c7670c 100644 --- a/libs/ardour/session_state.cc +++ b/libs/ardour/session_state.cc @@ -1660,11 +1660,26 @@ Session::load_nested_sources (const XMLNode& node) for (niter = nlist.begin(); niter != nlist.end(); ++niter) { if ((*niter)->name() == "Source") { - try { - SourceFactory::create (*this, **niter, true); + + /* it may already exist, so don't recreate it unnecessarily + */ + + XMLProperty* prop = (*niter)->property (X_("id")); + if (!prop) { + error << _("Nested source has no ID info in session state file! (ignored)") << endmsg; + continue; } - catch (failed_constructor& err) { - error << string_compose (_("Cannot reconstruct nested source for region %1"), name()) << endmsg; + + ID source_id (prop->value()); + + if (!source_by_id (source_id)) { + + try { + SourceFactory::create (*this, **niter, true); + } + catch (failed_constructor& err) { + error << string_compose (_("Cannot reconstruct nested source for region %1"), name()) << endmsg; + } } } } diff --git a/libs/ardour/source_factory.cc b/libs/ardour/source_factory.cc index a2e93ee61b..3ea63a75ed 100644 --- a/libs/ardour/source_factory.cc +++ b/libs/ardour/source_factory.cc @@ -155,12 +155,13 @@ SourceFactory::create (Session& s, const XMLNode& node, bool defer_peaks) try { boost::shared_ptr<AudioPlaylistSource> ap (new AudioPlaylistSource (s, node)); - + if (setup_peakfile (ap, true)) { return boost::shared_ptr<Source>(); } ap->check_for_analysis_data_on_disk (); + SourceCreated (ap); return ap; |