diff options
author | Paul Davis <paul@linuxaudiosystems.com> | 2011-05-22 16:11:00 +0000 |
---|---|---|
committer | Paul Davis <paul@linuxaudiosystems.com> | 2011-05-22 16:11:00 +0000 |
commit | 9c733915a0bc4b5274fac749b1adc874da79a6ee (patch) | |
tree | 1db070ef198c7b7890cb98c84a37a1321c810183 /libs/ardour/session_state.cc | |
parent | d40ee9548661f88db1bc1dcda0b463220d59a8d8 (diff) |
basic uncombining (no post-facto region trimming)
git-svn-id: svn://localhost/ardour2/branches/3.0@9566 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs/ardour/session_state.cc')
-rw-r--r-- | libs/ardour/session_state.cc | 60 |
1 files changed, 60 insertions, 0 deletions
diff --git a/libs/ardour/session_state.cc b/libs/ardour/session_state.cc index 82c2d5a31c..02aee5d3ef 100644 --- a/libs/ardour/session_state.cc +++ b/libs/ardour/session_state.cc @@ -1088,6 +1088,22 @@ Session::state(bool full_state) child->add_child_nocopy (r->state ()); } } + + RegionFactory::CompoundAssociations& cassocs (RegionFactory::compound_associations()); + + if (!cassocs.empty()) { + XMLNode* ca = node->add_child (X_("CompoundAssociations")); + + for (RegionFactory::CompoundAssociations::iterator i = cassocs.begin(); i != cassocs.end(); ++i) { + char buf[64]; + XMLNode* can = new XMLNode (X_("CompoundAssociation")); + i->first->id().print (buf, sizeof (buf)); + can->add_property (X_("copy"), buf); + i->second->id().print (buf, sizeof (buf)); + can->add_property (X_("original"), buf); + ca->add_child_nocopy (*can); + } + } } if (full_state) { @@ -1318,6 +1334,12 @@ Session::set_state (const XMLNode& node, int version) goto out; } + if ((child = find_named_node (node, "CompoundAssociations")) != 0) { + if (load_compounds (*child)) { + goto out; + } + } + if ((child = find_named_node (node, "NamedSelections")) != 0) { if (load_named_selections (*child)) { goto out; @@ -1592,6 +1614,44 @@ Session::load_regions (const XMLNode& node) return 0; } +int +Session::load_compounds (const XMLNode& node) +{ + XMLNodeList calist = node.children(); + XMLNodeConstIterator caiter; + XMLProperty *caprop; + + for (caiter = calist.begin(); caiter != calist.end(); ++caiter) { + XMLNode* ca = *caiter; + ID orig_id; + ID copy_id; + + if ((caprop = ca->property (X_("original"))) == 0) { + continue; + } + orig_id = caprop->value(); + + if ((caprop = ca->property (X_("copy"))) == 0) { + continue; + } + copy_id = caprop->value(); + + boost::shared_ptr<Region> orig = RegionFactory::region_by_id (orig_id); + boost::shared_ptr<Region> copy = RegionFactory::region_by_id (copy_id); + + if (!orig || !copy) { + warning << string_compose (_("Regions in compound description not found (ID's %1 and %2): ignored"), + orig_id, copy_id) + << endmsg; + continue; + } + + RegionFactory::add_compound_association (orig, copy); + } + + return 0; +} + boost::shared_ptr<Region> Session::XMLRegionFactory (const XMLNode& node, bool full) { |