Files
midigrid/MidiGrid_PlayBarOnly.lua
T
Talon fc378e733b Add play-current-bar-only
Ctrl+Alt+Space plays the cursor's bar and stops at the next bar line, so the
same bar can be fired repeatedly while nudging a note without reaching for
stop. Alt+Space keeps its play-onwards behaviour.

The stop is performed by the preview daemon rather than the action script: a
script that stayed alive waiting for the bar to end would bring back REAPER's
"already running" prompt on the next press, which is the problem the daemon
exists to avoid. Stopping transport can move the edit cursor depending on
preferences, and the edit cursor is the grid cursor, so the daemon restores it.

A short arming window covers the gap between requesting playback and the
transport reporting as playing, so the pending stop is not cancelled instantly.
2026-08-14 20:04:20 +02:00

13 lines
507 B
Lua

--[[
MIDI Grid: play only the bar the cursor is in, stopping at the bar line.
The stop is carried out by the preview daemon rather than here, because an
action script must exit immediately -- one that stayed alive waiting for the
bar to end would trigger REAPER's "already running" prompt on the next press.
]]
local dir = ({ reaper.get_action_context() })[2]:match("@?(.*[\\/])")
local G = dofile(dir .. "midigrid_lib.lua")
local bar = G.playFromBar(true)
G.say("Playing bar " .. bar .. " only")