Files
midigrid/MidiGrid_Join.lua
Talon 542f59e0db Add note length editing for sustaining already-entered notes
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.
2026-08-14 18:27:14 +02:00

21 lines
555 B
Lua

-- 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