extend libardour API to include possible flags when searching for prev/next mark

This commit is contained in:
Paul Davis
2024-05-28 22:07:13 -06:00
parent 7f82b918ae
commit 1f35010713
2 changed files with 41 additions and 4 deletions

View File

@@ -301,8 +301,15 @@ public:
void set_clock_origin (Location*, void *src);
timepos_t first_mark_before (timepos_t const &, bool include_special_ranges = false);
timepos_t first_mark_after (timepos_t const &, bool include_special_ranges = false);
timepos_t first_mark_before_flagged (timepos_t const &, bool include_special_ranges = false, Location::Flags whitelist = Location::Flags (0), Location::Flags blacklist = Location::Flags (0), Location::Flags equalist = Location::Flags (0));
timepos_t first_mark_after_flagged (timepos_t const &, bool include_special_ranges = false, Location::Flags whitelist = Location::Flags (0), Location::Flags blacklist = Location::Flags (0), Location::Flags equalist = Location::Flags (0));
timepos_t first_mark_after (timepos_t const & t, bool include_special_ranges = false) {
return first_mark_after_flagged (t, include_special_ranges);
}
timepos_t first_mark_before (timepos_t const & t, bool include_special_ranges = false) {
return first_mark_before_flagged (t, include_special_ranges);
}
Location* next_section (Location*, timepos_t&, timepos_t&) const;
Location* next_section_iter (Location*, timepos_t&, timepos_t&, std::vector<LocationPair>& cache) const;

View File

@@ -1417,7 +1417,7 @@ struct LocationStartLaterComparison
};
timepos_t
Locations::first_mark_before (timepos_t const & pos, bool include_special_ranges)
Locations::first_mark_before_flagged (timepos_t const & pos, bool include_special_ranges, Location::Flags whitelist, Location::Flags blacklist, Location::Flags equalist)
{
vector<LocationPair> locs;
{
@@ -1443,6 +1443,21 @@ Locations::first_mark_before (timepos_t const & pos, bool include_special_ranges
if (!include_special_ranges && ((*i).second->is_auto_loop() || (*i).second->is_auto_punch())) {
continue;
}
if (whitelist != Location::Flags (0)) {
if (!((*i).second->flags() & whitelist)) {
continue;
}
}
if (blacklist != Location::Flags (0)) {
if ((*i).second->flags() & blacklist) {
continue;
}
}
if (equalist != Location::Flags (0)) {
if (!((*i).second->flags() == equalist)) {
continue;
}
}
if ((*i).first < pos) {
return (*i).first;
}
@@ -1490,7 +1505,7 @@ Locations::mark_at (timepos_t const & pos, timecnt_t const & slop) const
}
timepos_t
Locations::first_mark_after (timepos_t const & pos, bool include_special_ranges)
Locations::first_mark_after_flagged (timepos_t const & pos, bool include_special_ranges, Location::Flags whitelist, Location::Flags blacklist, Location::Flags equalist)
{
vector<LocationPair> locs;
@@ -1517,6 +1532,21 @@ Locations::first_mark_after (timepos_t const & pos, bool include_special_ranges)
if (!include_special_ranges && ((*i).second->is_auto_loop() || (*i).second->is_auto_punch())) {
continue;
}
if (whitelist != Location::Flags (0)) {
if (!((*i).second->flags() & whitelist)) {
continue;
}
}
if (blacklist != Location::Flags (0)) {
if ((*i).second->flags() & blacklist) {
continue;
}
}
if (equalist != Location::Flags (0)) {
if (!((*i).second->flags() == equalist)) {
continue;
}
}
if ((*i).first > pos) {
return (*i).first;
}