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.
This commit is contained in:
Damien Zammit 2023-04-08 18:35:26 +10:00
parent 295dbd8e1e
commit a27a88f9f2
1 changed files with 9 additions and 0 deletions

View File

@ -277,6 +277,7 @@ Session::import_pt_rest (PTFFormat& ptf)
vector<string> to_import;
string fullpath;
uint32_t srate = sample_rate ();
timepos_t latest = timepos_t (0);
vector<struct ptflookup> 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 ();