13
0

fix recently added Location API to use timeline types

This commit is contained in:
Paul Davis 2021-03-16 16:20:42 -06:00
parent fb66695081
commit 5f0ba5b404
2 changed files with 7 additions and 7 deletions

View File

@ -195,7 +195,7 @@ public:
*
* @return New location object
*/
Location* add_range (samplepos_t start, samplepos_t end);
Location* add_range (timepos_t const & start, timepos_t const & end);
void remove (Location *);
bool clear ();
@ -237,7 +237,7 @@ public:
*
* @return Location object or nil
*/
Location* range_starts_at(samplepos_t, samplecnt_t slop = 0, bool incl = false) const;
Location* range_starts_at (timepos_t const &, timecnt_t const & slop = timecnt_t (Temporal::AudioTime), bool incl = false) const;
void find_all_between (timepos_t const & start, timepos_t const & end, LocationList&, Location::Flags);

View File

@ -982,7 +982,7 @@ Locations::add (Location *loc, bool make_current)
}
Location*
Locations::add_range(samplepos_t start, samplepos_t end)
Locations::add_range (timepos_t const & start, timepos_t const & end)
{
string name;
next_available_name(name, _("range"));
@ -1482,10 +1482,10 @@ Locations::find_all_between (timepos_t const & start, timepos_t const & end, Loc
}
Location *
Locations::range_starts_at(samplepos_t pos, samplecnt_t slop, bool incl) const
Locations::range_starts_at (timepos_t const & pos, timecnt_t const & slop, bool incl) const
{
Location *closest = 0;
sampleoffset_t mindelta = max_samplepos;
timecnt_t mindelta = timecnt_t (pos.time_domain());
Glib::Threads::RWLock::ReaderLock lm (_lock);
for (LocationList::const_iterator i = locations.begin(); i != locations.end(); ++i) {
@ -1497,9 +1497,9 @@ Locations::range_starts_at(samplepos_t pos, samplecnt_t slop, bool incl) const
continue;
}
sampleoffset_t delta = std::abs((double)(pos - (*i)->start()));
timecnt_t delta = (*i)->start().distance (pos).abs ();
if (delta == 0) {
if (delta.zero()) {
return *i;
}