13
0

add optional Location::Flags argument to Locations::mark_at

If specified, we will only return a mark whose flags match those passed in
This commit is contained in:
Paul Davis 2024-06-07 22:19:17 -06:00
parent 8a145c3bc1
commit 0a01acc86a
2 changed files with 3 additions and 3 deletions

View File

@ -297,7 +297,7 @@ public:
int set_current (Location *, bool want_lock = true); int set_current (Location *, bool want_lock = true);
Location *current () const { return current_location; } Location *current () const { return current_location; }
Location* mark_at (timepos_t const &, timecnt_t const & slop = timecnt_t::zero (Temporal::AudioTime)) const; Location* mark_at (timepos_t const &, timecnt_t const & slop = timecnt_t::zero (Temporal::AudioTime), Location::Flags flags = Location::Flags (0)) const;
void set_clock_origin (Location*, void *src); void set_clock_origin (Location*, void *src);

View File

@ -1467,7 +1467,7 @@ Locations::first_mark_before_flagged (timepos_t const & pos, bool include_specia
} }
Location* Location*
Locations::mark_at (timepos_t const & pos, timecnt_t const & slop) const Locations::mark_at (timepos_t const & pos, timecnt_t const & slop, Location::Flags flags) const
{ {
Location* closest = 0; Location* closest = 0;
timecnt_t mindelta = timecnt_t::max (pos.time_domain()); timecnt_t mindelta = timecnt_t::max (pos.time_domain());
@ -1480,7 +1480,7 @@ Locations::mark_at (timepos_t const & pos, timecnt_t const & slop) const
Glib::Threads::RWLock::ReaderLock lm (_lock); Glib::Threads::RWLock::ReaderLock lm (_lock);
for (LocationList::const_iterator i = locations.begin(); i != locations.end(); ++i) { for (LocationList::const_iterator i = locations.begin(); i != locations.end(); ++i) {
if ((*i)->is_mark()) { if ((*i)->is_mark() && (flags && ((*i)->flags() == flags))) {
if (pos > (*i)->start()) { if (pos > (*i)->start()) {
delta = (*i)->start().distance (pos); delta = (*i)->start().distance (pos);
} else { } else {