Lua bindings for TempoMap::get_grid

This commit is contained in:
Robin Gareus
2023-07-11 23:01:09 +02:00
parent fd6d88583f
commit 72522dd05d
2 changed files with 34 additions and 0 deletions

View File

@@ -27,4 +27,17 @@ function factory () return function ()
Temporal.TempoMap.write_copy()
Temporal.TempoMap.abort_update()
-- 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)
for t in grid[1]:iter () do
-- each t is-a TempoMapPoint
local metric = t:to_tempometric ()
local tempo_point = metric:tempo ()
local meter_point = metric:meter()
print (t:time(), tempo_point:to_tempo():quarter_notes_per_minute(), meter_point:note_value())
end
tm = nil
end end