From 0a01acc86a8d6f8ea136a614c3ff78be486e0612 Mon Sep 17 00:00:00 2001 From: Paul Davis Date: Fri, 7 Jun 2024 22:19:17 -0600 Subject: [PATCH] add optional Location::Flags argument to Locations::mark_at If specified, we will only return a mark whose flags match those passed in --- libs/ardour/ardour/location.h | 2 +- libs/ardour/location.cc | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/libs/ardour/ardour/location.h b/libs/ardour/ardour/location.h index 2f9bf841e9..7a36bfde5f 100644 --- a/libs/ardour/ardour/location.h +++ b/libs/ardour/ardour/location.h @@ -297,7 +297,7 @@ public: int set_current (Location *, bool want_lock = true); 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); diff --git a/libs/ardour/location.cc b/libs/ardour/location.cc index c7ce3cec6b..d396364ee1 100644 --- a/libs/ardour/location.cc +++ b/libs/ardour/location.cc @@ -1467,7 +1467,7 @@ Locations::first_mark_before_flagged (timepos_t const & pos, bool include_specia } 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; 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); 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()) { delta = (*i)->start().distance (pos); } else {