From a27a88f9f2bcbdb0f0005364fb93cca53f0f7749 Mon Sep 17 00:00:00 2001 From: Damien Zammit Date: Sat, 8 Apr 2023 18:35:26 +1000 Subject: [PATCH] import_pt: Update session range to largest audio extents imported Tested before and after on a small audio-only PT8 session; session range gets set to [0 to max] extent with this change. --- libs/ardour/import_pt.cc | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/libs/ardour/import_pt.cc b/libs/ardour/import_pt.cc index 74e49f498c..cb27c7de2d 100644 --- a/libs/ardour/import_pt.cc +++ b/libs/ardour/import_pt.cc @@ -277,6 +277,7 @@ Session::import_pt_rest (PTFFormat& ptf) vector to_import; string fullpath; uint32_t srate = sample_rate (); + timepos_t latest = timepos_t (0); vector ptfregpair; @@ -386,10 +387,18 @@ Session::import_pt_rest (PTFFormat& ptf) playlist->clear_changes (); playlist->add_region (copy, timepos_t (a->reg.startpos)); //add_command (new StatefulDiffCommand (playlist)); + + /* Collect latest end of all regions */ + timepos_t end_of_region = timepos_t (a->reg.startpos + a->reg.length); + if (latest < end_of_region) { + latest = end_of_region; + } } } } + maybe_update_session_range (timepos_t (0), latest); + /* Playlist::thaw() all tracks */ for (pl = playlists.begin(); pl != playlists.end(); ++pl) { (*pl).playlist->thaw ();