Files
midigrid/MidiGrid_Up.lua
T

18 lines
598 B
Lua
Raw Normal View History

-- MIDI Grid: pitch up one scale degree (pass-through when grid mode is off)
local dir = ({ reaper.get_action_context() })[2]:match("@?(.*[\\/])")
local G = dofile(dir .. "midigrid_lib.lua")
if not G.isActive() then G.passThrough("_OSARA_HIGHERNOTEINCHORD") return end
local hwnd, take, err = G.editor()
if not take then G.say(err) return end
local p = G.scaleStep(G.getPitch(hwnd), 1)
if not p then G.say("top") return end
G.setPitch(hwnd, p)
local ppqA, ppqB = G.cellPPQ(take)
local on = G.noteInCell(take, p, ppqA, ppqB) ~= nil
G.say(G.noteName(p) .. (on and ", on" or ""))
G.preview({ p })