13
0

fix region fade/env XML save - fixes #5353

In rev 12740 FadeIn/Out became stateful properties which are automatically
saved when Region:state() calls Stateful::add_properties().

AudioRegion::state() called Region:state() AND Stateful::add_properties()
which added a 2nd redundant copy to the XML.

Finally AudioRegion::state() adds custom serialization for Fades.
Furthermore this custom serialization also used names which did not
match the Property name.

git-svn-id: svn://localhost/ardour2/branches/3.0@14117 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
Robin Gareus 2013-03-03 08:26:46 +00:00
parent 4203d59bbb
commit dbe00236ff
3 changed files with 17 additions and 8 deletions

View File

@ -764,8 +764,6 @@ AudioRegion::state ()
snprintf (buf, sizeof (buf), "%u", (uint32_t) _sources.size());
node.add_property ("channels", buf);
Stateful::add_properties (node);
child = node.add_child ("Envelope");
bool default_env = false;
@ -796,7 +794,7 @@ AudioRegion::state ()
}
if (_inverse_fade_in) {
child = node.add_child (X_("InvFadeIn"));
child = node.add_child (X_("InverseFadeIn"));
child->add_child_nocopy (_inverse_fade_in->get_state ());
}
@ -809,7 +807,7 @@ AudioRegion::state ()
}
if (_inverse_fade_out) {
child = node.add_child (X_("InvFadeOut"));
child = node.add_child (X_("InverseFadeOut"));
child->add_child_nocopy (_inverse_fade_out->get_state ());
}
@ -908,12 +906,12 @@ AudioRegion::_set_state (const XMLNode& node, int version, PropertyChange& what_
}
}
} else if (child->name() == "InvFadeIn") {
} else if (child->name() == "InverseFadeIn") {
XMLNode* grandchild = child->child ("AutomationList");
if (grandchild) {
_inverse_fade_in->set_state (*grandchild, version);
}
} else if (child->name() == "InvFadeOut") {
} else if (child->name() == "InverseFadeOut") {
XMLNode* grandchild = child->child ("AutomationList");
if (grandchild) {
_inverse_fade_out->set_state (*grandchild, version);

View File

@ -1126,7 +1126,18 @@ Region::state ()
LocaleGuard lg (X_("POSIX"));
const char* fe = NULL;
add_properties (*node);
/* custom version of 'add_properties (*node);'
* skip values that have have dedicated save functions
* in AudioRegion::state()
*/
for (OwnedPropertyList::iterator i = _properties->begin(); i != _properties->end(); ++i) {
if (!strcmp(i->second->property_name(), (const char*)"Envelope")) continue;
if (!strcmp(i->second->property_name(), (const char*)"FadeIn")) continue;
if (!strcmp(i->second->property_name(), (const char*)"FadeOut")) continue;
if (!strcmp(i->second->property_name(), (const char*)"InverseFadeIn")) continue;
if (!strcmp(i->second->property_name(), (const char*)"InverseFadeOut")) continue;
i->second->get_value (*node);
}
id().print (buf, sizeof (buf));
node->add_property ("id", buf);

View File

@ -1078,7 +1078,7 @@ Session::state (bool full_state)
boost::shared_ptr<Region> r = i->second;
/* only store regions not attached to playlists */
if (r->playlist() == 0) {
child->add_child_nocopy (r->state ());
child->add_child_nocopy (r->get_state ());
}
}