Files

19 lines
556 B
Lua
Raw Permalink Normal View History

-- MIDI Grid: toggle a note at the cursor cell (pass-through when off)
local dir = ({ reaper.get_action_context() })[2]:match("@?(.*[\\/])")
local G = dofile(dir .. "midigrid_lib.lua")
if not G.isActive() then G.passThrough(40004) return end -- Edit: Event properties
local hwnd, take, err = G.editor()
if not take then G.say(err) return end
local p = G.getPitch(hwnd)
local state, detail = G.toggleCell(take, p)
if state == "on" then
G.say(G.noteName(p) .. " on, " .. detail)
G.preview({ p })
else
G.say(G.noteName(p) .. " off, " .. detail)
end