--[[ MIDI Grid: loop the bar the cursor is in. Sample-accurate at the bar line, because REAPER's audio engine owns the boundary rather than a polling loop -- so the next bar's downbeat never leaks in, at any tempo. Repeats until you press Space. ]] local dir = ({ reaper.get_action_context() })[2]:match("@?(.*[\\/])") local G = dofile(dir .. "midigrid_lib.lua") local bar = G.loopBar() G.say("Looping bar " .. bar)