summaryrefslogtreecommitdiff
path: root/libs
diff options
context:
space:
mode:
authorPaul Davis <paul@linuxaudiosystems.com>2020-02-26 22:40:23 -0700
committerPaul Davis <paul@linuxaudiosystems.com>2020-03-17 16:31:49 -0600
commit295fb3ff5a17e4540d5b28f7f1da18b680439dc7 (patch)
treee30ecd03760f40639a7fb20580448b9bb492359f /libs
parenta30ee6950dfc37b54bd1e235387fc4415cfb2fd4 (diff)
allow loading of regions derived from formerly "destructive" sources with correct length
Without this change, such regions end up with insanely large (though legal) lengths
Diffstat (limited to 'libs')
-rw-r--r--libs/ardour/region.cc16
1 files changed, 16 insertions, 0 deletions
diff --git a/libs/ardour/region.cc b/libs/ardour/region.cc
index 1803315194..fbbeaac4ca 100644
--- a/libs/ardour/region.cc
+++ b/libs/ardour/region.cc
@@ -1392,6 +1392,22 @@ Region::_set_state (const XMLNode& node, int /*version*/, PropertyChange& what_c
what_changed = set_values (node);
+ /* 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
+ * here and reset to the actual source length (using the first source
+ * as a proxy for all of them). For "previously destructive" sources,
+ * this will correspond to the full extent of the data actually written
+ * to the file (though this may include blank space if discontiguous
+ * punches/capture passes were carried out.
+ */
+
+ if (!_sources.empty()) {
+ if (_length > _sources.front()->length(_position)) {
+ _length = _sources.front()->length(_position) - _start;
+ }
+ }
+
set_id (node);
if (_position_lock_style == MusicTime) {