mirror of
https://github.com/Ardour/ardour.git
synced 2026-01-08 06:35:46 +01:00
Location: add API to use cached sorted location list
Every call to ::next_section() copies the location list and sorts all the regions. If the session has a significant amount of Locations and Section Marker (#9568 has 300+) sorting them each time when iterating over sections is significant.
This commit is contained in:
parent
ebc887e33d
commit
0c5bbfa62d
2 changed files with 13 additions and 2 deletions
|
|
@ -301,6 +301,7 @@ public:
|
|||
timepos_t first_mark_after (timepos_t const &, bool include_special_ranges = false);
|
||||
|
||||
Location* next_section (Location*, timepos_t&, timepos_t&) const;
|
||||
Location* next_section_iter (Location*, timepos_t&, timepos_t&, std::vector<LocationPair>& cache) const;
|
||||
Location* section_at (timepos_t const&, timepos_t&, timepos_t&) const;
|
||||
|
||||
void marks_either_side (timepos_t const &, timepos_t &, timepos_t &) const;
|
||||
|
|
|
|||
|
|
@ -1597,8 +1597,18 @@ Locations::sorted_section_locations (vector<LocationPair>& locs) const
|
|||
Location*
|
||||
Locations::next_section (Location* l, timepos_t& start, timepos_t& end) const
|
||||
{
|
||||
vector<LocationPair> locs;
|
||||
sorted_section_locations (locs);
|
||||
std::vector<Locations::LocationPair> locs;
|
||||
return next_section_iter (l, start, end, locs);
|
||||
}
|
||||
|
||||
Location*
|
||||
Locations::next_section_iter (Location* l, timepos_t& start, timepos_t& end, vector<LocationPair>& locs) const
|
||||
{
|
||||
if (!l) {
|
||||
/* build cache */
|
||||
locs.clear ();
|
||||
sorted_section_locations (locs);
|
||||
}
|
||||
|
||||
if (locs.size () < 2) {
|
||||
return NULL;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue