18 lines
653 B
Lua
18 lines
653 B
Lua
-- MIDI Grid: lengthen 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(40446) return end -- Edit: Lengthen 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, absorbed = G.resizeNote(take, p, 1)
|
||
|
|
if not cells then G.say("No note here") return end
|
||
|
|
|
||
|
|
local msg = G.noteName(p) .. ", " .. cells .. (cells == 1 and " cell" or " cells")
|
||
|
|
if absorbed > 0 then msg = msg .. ", joined " .. absorbed end
|
||
|
|
G.say(msg)
|
||
|
|
G.preview({ p })
|