OK. So this is pretty cheesy and took me an embarrassingly long time to figure out but it works.
In Lua:
Code:
is_new,filename,sectionID,cmdID,mode,resolution,value = reaper.get_action_context()
if is_new then
reaper.ShowConsoleMsg("DEBUG: \nmode: " .. mode .. "\nresolution: " .. resolution .. "\nvalue: " .. value .. "\n")
if value == 127 then
action = "Play" -- Triggering Play Action
reaper.Main_OnCommand(1007, 0)
elseif value == 0 then
action = "Stop" -- Triggering Stop Action
reaper.Main_OnCommand(1016, 0)
else
action = "Ignore" -- Ignore Everything else
end
reaper.ShowConsoleMsg(action .. "\n")
end
I have the action to run the script set to whenever a MIDI CC of 0x6D (109) is received on Channel 1 (the default button channel for my controller).
EDIT: Here's a minimal version without my testing stuff in it:
Code:
is_new,filename,sectionID,cmdID,mode,resolution,value = reaper.get_action_context()
if is_new then
if value == 127 then
reaper.Main_OnCommand(1007, 0)
elseif value == 0 then
reaper.Main_OnCommand(1016, 0)
else
end
end
BTW, I haven't written anything in Lua since my Autodesk days. Be kind.
Ken