Files

20 lines
649 B
Lua
Raw Permalink Normal View History

-- MIDI Grid: shorten the note under the cursor by one grid cell
local dir = ({ reaper.get_action_context() })[2]:match("@?(.*[\\/])")
local G = dofile(dir .. "midigrid_lib.lua")
if not G.isActive() then G.passThrough(40447) return end -- Edit: Shorten notes one grid unit
local hwnd, take, err = G.editor()
if not take then G.say(err) return end
local p = G.getPitch(hwnd)
local cells, _, clamped = G.resizeNote(take, p, -1)
if not cells then G.say("No note here") return end
if clamped then
G.say(G.noteName(p) .. ", 1 cell, minimum")
else
G.say(G.noteName(p) .. ", " .. cells .. (cells == 1 and " cell" or " cells"))
end
G.preview({ p })