From ea2d2b476018009dd2203e263bec0132801756eb Mon Sep 17 00:00:00 2001 From: Paul Davis Date: Sat, 15 Jul 2023 11:23:45 -0600 Subject: [PATCH] temporal: rename ::get_grid_with_iterator() Because I like polymorphism --- libs/ardour/session_click.cc | 4 ++-- libs/temporal/tempo.cc | 2 +- libs/temporal/temporal/tempo.h | 9 ++++----- 3 files changed, 7 insertions(+), 8 deletions(-) diff --git a/libs/ardour/session_click.cc b/libs/ardour/session_click.cc index bf90e1576e..089c3e61b8 100644 --- a/libs/ardour/session_click.cc +++ b/libs/ardour/session_click.cc @@ -125,7 +125,7 @@ Session::click (samplepos_t cycle_start, samplecnt_t nframes) _click_points.clear (); assert (_click_points.capacity() > 0); - TempoMap::use()->get_grid_with_iterator (_click_iterator, _click_points, samples_to_superclock (start, sample_rate()), samples_to_superclock (end, sample_rate())); + TempoMap::use()->get_grid (_click_iterator, _click_points, samples_to_superclock (start, sample_rate()), samples_to_superclock (end, sample_rate())); if (_click_points.empty()) { start += move; @@ -314,7 +314,7 @@ Session::setup_click_sounds (Sample** data, Sample const * default_data, samplec /* Overwhelmingly likely that we will have zero or 1 click grid point * per cycle. So this is really overkill. If it is too low, it just - * causes RT memory allocation inside TempoMap::get_grid_with_iterator(). + * causes RT memory allocation inside TempoMap::get_grid(). */ _click_points.reserve (16); } diff --git a/libs/temporal/tempo.cc b/libs/temporal/tempo.cc index cfc96d5ad9..b75b928bf1 100644 --- a/libs/temporal/tempo.cc +++ b/libs/temporal/tempo.cc @@ -2549,7 +2549,7 @@ TempoMap::get_grid (TempoMapPoints& ret, superclock_t rstart, superclock_t end, } void -TempoMap::get_grid_with_iterator (GridIterator& iter, TempoMapPoints& ret, superclock_t rstart, superclock_t end, uint32_t bar_mod, uint32_t beat_div) const +TempoMap::get_grid (GridIterator& iter, TempoMapPoints& ret, superclock_t rstart, superclock_t end, uint32_t bar_mod, uint32_t beat_div) const { DEBUG_TRACE (DEBUG::Grid, string_compose (">>> GRID-I START %1 .. %2 (barmod = %3) iter valid ? %4 iter for %5\n", rstart, end, bar_mod, iter.valid_for (*this, rstart, bar_mod, beat_div), iter.end)); diff --git a/libs/temporal/temporal/tempo.h b/libs/temporal/temporal/tempo.h index 94b5cc47b4..2f894c1a16 100644 --- a/libs/temporal/temporal/tempo.h +++ b/libs/temporal/temporal/tempo.h @@ -647,7 +647,7 @@ typedef boost::intrusive::list> MusicTimes; typedef boost::intrusive::list> Points; -/* An object used to retain "position" across calls to get_grid_with_iterator() +/* An object used to retain "position" across calls to get_grid() */ class LIBTEMPORAL_API GridIterator { @@ -713,7 +713,7 @@ class LIBTEMPORAL_API GridIterator /* bar modulus and beat division used by GridIterator. These must match - the current call to ::get_grid_with_iterator() for the iterator to + the current call to ::get_grid() for the iterator to be valid. */ @@ -997,14 +997,13 @@ class /*LIBTEMPORAL_API*/ TempoMap : public PBD::StatefulDestructible LIBTEMPORAL_API Points::const_iterator get_grid (TempoMapPoints & points, superclock_t start, superclock_t end, uint32_t bar_mod = 0, uint32_t beat_div = 1) const; + LIBTEMPORAL_API void get_grid (GridIterator& iter, TempoMapPoints& ret, superclock_t rstart, superclock_t end, uint32_t bar_mod = 0, uint32_t beat_div = 1) const; + /* This version exists for Lua bindings, to avoid having to wrap Points::iterator etc. */ LIBTEMPORAL_API void grid (TempoMapPoints& points, superclock_t start, superclock_t end, uint32_t bar_mod = 0, uint32_t beat_div = 1) const { get_grid (points, start, end, bar_mod, beat_div); } - - LIBTEMPORAL_API void get_grid_with_iterator (GridIterator& iter, TempoMapPoints& ret, superclock_t rstart, superclock_t end, uint32_t bar_mod = 0, uint32_t beat_div = 1) const; - struct EmptyTempoMapException : public std::exception { virtual const char* what() const throw() { return "TempoMap is empty"; } };