13
0

temporal: rename ::get_grid_with_iterator()

Because I like polymorphism
This commit is contained in:
Paul Davis 2023-07-15 11:23:45 -06:00
parent b2a57108c3
commit ea2d2b4760
3 changed files with 7 additions and 8 deletions

View File

@ -125,7 +125,7 @@ Session::click (samplepos_t cycle_start, samplecnt_t nframes)
_click_points.clear (); _click_points.clear ();
assert (_click_points.capacity() > 0); 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()) { if (_click_points.empty()) {
start += move; 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 /* 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 * 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); _click_points.reserve (16);
} }

View File

@ -2549,7 +2549,7 @@ TempoMap::get_grid (TempoMapPoints& ret, superclock_t rstart, superclock_t end,
} }
void 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)); 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));

View File

@ -647,7 +647,7 @@ typedef boost::intrusive::list<MeterPoint, boost::intrusive::base_hook<meter_hoo
typedef boost::intrusive::list<MusicTimePoint, boost::intrusive::base_hook<bartime_hook>> MusicTimes; typedef boost::intrusive::list<MusicTimePoint, boost::intrusive::base_hook<bartime_hook>> MusicTimes;
typedef boost::intrusive::list<Point, boost::intrusive::base_hook<point_hook>> Points; typedef boost::intrusive::list<Point, boost::intrusive::base_hook<point_hook>> 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 class LIBTEMPORAL_API GridIterator
{ {
@ -713,7 +713,7 @@ class LIBTEMPORAL_API GridIterator
/* bar modulus and beat division used by GridIterator. These must match /* 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. 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 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 { 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); 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 { struct EmptyTempoMapException : public std::exception {
virtual const char* what() const throw() { return "TempoMap is empty"; } virtual const char* what() const throw() { return "TempoMap is empty"; }
}; };