Files
midigrid/MidiGrid_Shorten.lua
T
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

20 lines
649 B
Lua

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