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
This commit is contained in:
parent
af02cbcafa
commit
f38db9a4e3
|
@ -1091,6 +1091,8 @@ Editor::sensitize_the_right_region_actions ()
|
|||
|
||||
if (have_compound_regions) {
|
||||
_region_actions->get_action("uncombine-regions")->set_sensitive (true);
|
||||
} else {
|
||||
_region_actions->get_action("uncombine-regions")->set_sensitive (false);
|
||||
}
|
||||
|
||||
if (have_audio) {
|
||||
|
|
|
@ -379,7 +379,6 @@ public:
|
|||
void timestamp_layer_op (boost::shared_ptr<Region>);
|
||||
|
||||
void _split_region (boost::shared_ptr<Region>, framepos_t position);
|
||||
void load_nested_sources (const XMLNode& node);
|
||||
|
||||
typedef std::pair<boost::shared_ptr<Region>, boost::shared_ptr<Region> > TwoRegions;
|
||||
virtual void copy_dependents (const std::vector<TwoRegions>&, boost::shared_ptr<Playlist>) { }
|
||||
|
|
|
@ -1500,6 +1500,7 @@ class Session : public PBD::StatefulDestructible, public PBD::ScopedConnectionLi
|
|||
framepos_t compute_stop_limit () const;
|
||||
|
||||
boost::shared_ptr<Speakers> _speakers;
|
||||
void load_nested_sources (const XMLNode& node);
|
||||
};
|
||||
|
||||
} // namespace ARDOUR
|
||||
|
|
|
@ -2191,26 +2191,6 @@ Playlist::update (const RegionListProperty::ChangeRecord& change)
|
|||
thaw ();
|
||||
}
|
||||
|
||||
void
|
||||
Playlist::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 (_session, **niter, true);
|
||||
}
|
||||
catch (failed_constructor& err) {
|
||||
error << string_compose (_("Cannot reconstruct nested source for playlist %1"), name()) << endmsg;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int
|
||||
Playlist::set_state (const XMLNode& node, int version)
|
||||
{
|
||||
|
@ -2256,19 +2236,6 @@ Playlist::set_state (const XMLNode& node, int version)
|
|||
|
||||
nlist = node.children();
|
||||
|
||||
/* find the "Nested" node, if any, and recreate the PlaylistSources
|
||||
listed there
|
||||
*/
|
||||
|
||||
for (niter = nlist.begin(); niter != nlist.end(); ++niter) {
|
||||
child = *niter;
|
||||
|
||||
if (child->name() == "Nested") {
|
||||
load_nested_sources (*child);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
for (niter = nlist.begin(); niter != nlist.end(); ++niter) {
|
||||
|
||||
child = *niter;
|
||||
|
@ -2354,35 +2321,10 @@ Playlist::state (bool full_state)
|
|||
|
||||
if (full_state) {
|
||||
RegionLock rlock (this, false);
|
||||
XMLNode* nested_node = 0;
|
||||
|
||||
snprintf (buf, sizeof (buf), "%u", _combine_ops);
|
||||
node->add_property ("combine-ops", buf);
|
||||
|
||||
for (RegionList::iterator i = regions.begin(); i != regions.end(); ++i) {
|
||||
if ((*i)->max_source_level() > 0) {
|
||||
|
||||
if (!nested_node) {
|
||||
nested_node = new XMLNode (X_("Nested"));
|
||||
}
|
||||
|
||||
/* region is compound - get its playlist and
|
||||
store that before we list the region that
|
||||
needs it ...
|
||||
*/
|
||||
|
||||
const SourceList& sl ((*i)->sources());
|
||||
|
||||
for (SourceList::const_iterator s = sl.begin(); s != sl.end(); ++s) {
|
||||
nested_node->add_child_nocopy ((*s)->get_state ());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (nested_node) {
|
||||
node->add_child_nocopy (*nested_node);
|
||||
}
|
||||
|
||||
for (RegionList::iterator i = regions.begin(); i != regions.end(); ++i) {
|
||||
node->add_child_nocopy ((*i)->get_state());
|
||||
}
|
||||
|
|
|
@ -37,6 +37,7 @@
|
|||
#include "ardour/region_factory.h"
|
||||
#include "ardour/session.h"
|
||||
#include "ardour/source.h"
|
||||
#include "ardour/source_factory.h"
|
||||
#include "ardour/tempo.h"
|
||||
#include "ardour/utils.h"
|
||||
|
||||
|
@ -1206,6 +1207,24 @@ Region::state ()
|
|||
node->add_property (buf2, buf);
|
||||
}
|
||||
|
||||
if (max_source_level() > 0) {
|
||||
|
||||
XMLNode* nested_node = new XMLNode (X_("NestedSource"));
|
||||
|
||||
/* region is compound - get its playlist and
|
||||
store that before we list the region that
|
||||
needs it ...
|
||||
*/
|
||||
|
||||
for (SourceList::const_iterator s = _sources.begin(); s != _sources.end(); ++s) {
|
||||
nested_node->add_child_nocopy ((*s)->get_state ());
|
||||
}
|
||||
|
||||
if (nested_node) {
|
||||
node->add_child_nocopy (*nested_node);
|
||||
}
|
||||
}
|
||||
|
||||
if (_extra_xml) {
|
||||
node->add_child_copy (*_extra_xml);
|
||||
}
|
||||
|
@ -1230,6 +1249,17 @@ int
|
|||
Region::_set_state (const XMLNode& node, int /*version*/, PropertyChange& what_changed, bool send)
|
||||
{
|
||||
const XMLProperty* prop;
|
||||
const XMLNodeList& nlist = node.children();
|
||||
|
||||
for (XMLNodeConstIterator niter = nlist.begin(); niter != nlist.end(); ++niter) {
|
||||
|
||||
XMLNode *child = (*niter);
|
||||
|
||||
if (child->name () == "Extra") {
|
||||
delete _extra_xml;
|
||||
_extra_xml = new XMLNode (*child);
|
||||
}
|
||||
}
|
||||
|
||||
what_changed = set_values (node);
|
||||
|
||||
|
@ -1262,21 +1292,6 @@ Region::_set_state (const XMLNode& node, int /*version*/, PropertyChange& what_c
|
|||
_shift = 1.0f;
|
||||
}
|
||||
|
||||
const XMLNodeList& nlist = node.children();
|
||||
|
||||
for (XMLNodeConstIterator niter = nlist.begin(); niter != nlist.end(); ++niter) {
|
||||
|
||||
XMLNode *child;
|
||||
|
||||
child = (*niter);
|
||||
|
||||
if (child->name () == "Extra") {
|
||||
delete _extra_xml;
|
||||
_extra_xml = new XMLNode (*child);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (send) {
|
||||
send_change (what_changed);
|
||||
}
|
||||
|
|
|
@ -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") {
|
||||
|
|
Loading…
Reference in New Issue