From a857a0af4d0c859462f04cb06e0d212ad66adf1e Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Fri, 14 Jul 2023 23:48:05 +0200 Subject: [PATCH] Update Luabindings for new TempoMap API --- libs/ardour/luabindings.cc | 4 ++-- libs/temporal/temporal/tempo.h | 6 +++++- share/scripts/s_tempo_map.lua | 2 +- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/libs/ardour/luabindings.cc b/libs/ardour/luabindings.cc index f710f058e8..2f49b9cc1a 100644 --- a/libs/ardour/luabindings.cc +++ b/libs/ardour/luabindings.cc @@ -809,7 +809,7 @@ LuaBindings::common (lua_State* L) .addFunction ("time", &Temporal::TempoMapPoint::time) .endClass () - .beginStdList ("TempoMapPoints") + .beginStdVector ("TempoMapPoints") .endClass () .beginWSPtrClass ("TempoMap") @@ -859,7 +859,7 @@ LuaBindings::common (lua_State* L) .addFunction ("convert_duration", &Temporal::TempoMap::convert_duration) .addFunction ("bbt_walk", &Temporal::TempoMap::bbt_walk) #ifdef WITH_SUPERCLOCK_BINDINGS - .addRefFunction ("get_grid", &Temporal::TempoMap::get_grid) + .addRefFunction ("grid", &Temporal::TempoMap::grid) #endif .addFunction ("quarters_per_minute_at", &Temporal::TempoMap::quarters_per_minute_at) diff --git a/libs/temporal/temporal/tempo.h b/libs/temporal/temporal/tempo.h index 2603e66970..24a466f20e 100644 --- a/libs/temporal/temporal/tempo.h +++ b/libs/temporal/temporal/tempo.h @@ -940,7 +940,11 @@ class /*LIBTEMPORAL_API*/ TempoMap : public PBD::StatefulDestructible Meters const & meters() const { return _meters; } MusicTimes const & bartimes() const { return _bartimes; } - 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 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 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_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 { diff --git a/share/scripts/s_tempo_map.lua b/share/scripts/s_tempo_map.lua index 5d46136dcd..f41b634895 100644 --- a/share/scripts/s_tempo_map.lua +++ b/share/scripts/s_tempo_map.lua @@ -30,7 +30,7 @@ function factory () return function () -- get grid -- currently only available in debug-builds -- Temporal.superclock_ticks_per_second = 282240000 tm = Temporal.TempoMap.read () - local grid = tm:get_grid (Temporal.TempoMapPoints(), 0, Temporal.superclock_ticks_per_second (), 0, 1) + local grid = tm:grid (Temporal.TempoMapPoints(), 0, Temporal.superclock_ticks_per_second (), 0, 1) for t in grid[1]:iter () do -- each t is-a TempoMapPoint local metric = t:to_tempometric ()