diff --git a/libs/ardour/region.cc b/libs/ardour/region.cc index b548be3043..691b343b2c 100644 --- a/libs/ardour/region.cc +++ b/libs/ardour/region.cc @@ -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