19 lines
521 B
Lua
19 lines
521 B
Lua
-- MIDI Grid: lower velocity of the note at the cursor, or the default
|
|||
|
|
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 what, v = G.nudgeVelocity(take, p, -G.getNum("velstep", 8))
|
||
|
|
|
||
|
|
if what == "note" then
|
||
|
|
G.say(G.noteName(p) .. " velocity " .. v)
|
||
|
|
G.preview({ p })
|
||
|
|
else
|
||
|
|
G.say("Default velocity " .. v)
|
||
|
|
end
|