13
0

fix loading of regions in older session files

In session file formats earlier than 7000, region position and length
are stored in distinct XML node properties. For 7000 or later, both
position and length are part of the "length" member. Fix reloading
this by noting session file format and loading position and length
more explicitly
This commit is contained in:
Paul Davis 2022-01-27 15:36:01 -07:00
parent 7eb53828a9
commit 98ad20529b

View File

@ -1314,7 +1314,7 @@ Region::set_state (const XMLNode& node, int version)
}
int
Region::_set_state (const XMLNode& node, int /*version*/, PropertyChange& what_changed, bool send)
Region::_set_state (const XMLNode& node, int version, PropertyChange& what_changed, bool send)
{
Temporal::BBT_Time bbt_time;
@ -1322,6 +1322,20 @@ Region::_set_state (const XMLNode& node, int /*version*/, PropertyChange& what_c
what_changed = set_values (node);
if (version < 7000) {
/* Older versions saved position and length as separate XML
* node properties.
*/
samplepos_t p;
samplepos_t l;
if (node.get_property (X_("position"), p) && node.get_property (X_("length"), l)) {
_length = timecnt_t (l, timepos_t (p));
}
}
/* Regions derived from "Destructive/Tape" mode tracks in earlier
* versions will have their length set to an extremely large value
* (essentially the maximum possible length of a file). Detect this