13
0

Update session extents calculation

* Expose API via Public Editor
* Skip hidden tracks in calculation
* Use a single call to query playlist extents.
  This way the playlist read-lock is needed at most once per track
  which speeds up calculation.
This commit is contained in:
Robin Gareus 2021-01-05 23:23:22 +01:00
parent 548db7a9a4
commit aecd84e7fd
Signed by: rgareus
GPG Key ID: A090BCE02CF57F04
2 changed files with 14 additions and 12 deletions

View File

@ -623,19 +623,19 @@ Editor::session_gui_extents (bool use_extra) const
boost::shared_ptr<RouteList> rl = _session->get_routes();
for (RouteList::iterator r = rl->begin(); r != rl->end(); ++r) {
boost::shared_ptr<Track> tr = boost::dynamic_pointer_cast<Track> (*r);
if (tr) {
boost::shared_ptr<Playlist> pl = tr->playlist();
if (pl && !pl->all_regions_empty()) {
pair<samplepos_t, samplepos_t> e;
e = pl->get_extent();
if (e.first < session_extent_start) {
session_extent_start = e.first;
}
if (e.second > session_extent_end) {
session_extent_end = e.second;
}
}
if (!tr) {
continue;
}
if (tr->presentation_info ().hidden ()) {
continue;
}
pair<samplepos_t, samplepos_t> e = tr->playlist()->get_extent ();
if (e.first == e.second) {
/* no regions present */
continue;
}
session_extent_start = std::min (session_extent_start, e.first);
session_extent_end = std::max (session_extent_end, e.second);
}
}

View File

@ -480,6 +480,8 @@ public:
virtual void get_pointer_position (double &, double &) const = 0;
virtual std::pair <samplepos_t, samplepos_t> session_gui_extents (bool use_extra = true) const = 0;
virtual ARDOUR::Location* find_location_from_marker (ArdourMarker*, bool&) const = 0;
virtual ArdourMarker* find_marker_from_location_id (PBD::ID const&, bool) const = 0;