Files

21 lines
555 B
Lua
Raw Permalink Normal View History

-- MIDI Grid: fuse a run of repeated notes at this pitch into one held note
local dir = ({ reaper.get_action_context() })[2]:match("@?(.*[\\/])")
local G = dofile(dir .. "midigrid_lib.lua")
if not G.isActive() then return end
local hwnd, take, err = G.editor()
if not take then G.say(err) return end
local p = G.getPitch(hwnd)
local n = G.joinRun(take, p)
if not n then
G.say("No note here")
elseif n == 0 then
G.say(G.noteName(p) .. ", nothing adjacent to join")
else
G.say(G.noteName(p) .. ", joined " .. n .. " notes")
G.preview({ p })
end