Hold mode only governs entry, so sustaining existing notes previously meant toggling hold on and re-entering them. That works but deletes and recreates each note, silently resetting velocity to the default. L and Shift+L resize the note under the cursor by whole grid cells, editing it in place so velocity, channel and note identity survive. They are independent of hold mode, so there is no state to set up or unset. Alt+J fuses a whole run of repeated notes at one pitch in a single keystroke. Lengthening absorbs same-pitch notes it runs into, taking their tail if longer, so growing across a repeated run fuses it instead of creating overlaps. Also makes noteEndingAt/noteStartingAt public and fixes their two call sites in toggleCell, which would otherwise have been nil-call errors in hold mode.
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 })
|