11-26-2020, 07:25 AM
|
#5
|
Human being with feelings
Join Date: Oct 2010
Location: Charleston, SC USA
Posts: 9,789
|
Quote:
Originally Posted by BenjyO
Here's a script that works for me. It's very crude and it's definitely not fault-proof but it does the trick. It splits the selected item at edit cursor and inserts a CC64 Off message a few pixels before the split point in the left item. It requires SWS and mpl's scripts.
I don't know (yet) if Reaper assigns different ID identifier's for custom actions and user scripts to different users. If that's the case, substitute the parameter in the reaper.NamedCommandLookup() function for the ID which shows up in your action list (MIDI Editor actions) for "mpl_Add CC64 off to channel 0 of active MIDI Editor take".
Code:
-- credits to mpl for his "mpl_Add CC64 off to channel 0 of active MIDI Editor take"
function main()
reaper.Main_OnCommand(40759, 0) -- Item: Split items at edit cursor (select right)
reaper.Main_OnCommand(40006, 0) -- Item: Remove items
reaper.Main_OnCommand(40104, 0) -- View: Move cursor left one pixel
reaper.Main_OnCommand(40104, 0) -- View: Move cursor left one pixel
reaper.Main_OnCommand(40104, 0) -- View: Move cursor left one pixel
selitem = reaper.NamedCommandLookup("_XENAKIOS_SELITEMSUNDEDCURSELTX")
reaper.Main_OnCommand(selitem, 0)
reaper.Main_OnCommand(40153, 0) -- Item: Open in built-in MIDI editor (set default behavior in preferences)
actmidieditor = reaper.MIDIEditor_GetActive()
idofpedaloff = reaper.NamedCommandLookup("_RS7d3c_d030d666f7decf53fd1dee3680ec2d970b916137") -- MIDI Editor: mpl_Add CC64 off to channel 0 of active MIDI Editor take.lua
reaper.MIDIEditor_OnCommand(actmidieditor, idofpedaloff)
reaper.MIDIEditor_OnCommand(actmidieditor, 2) -- File: Close window
reaper.Main_OnCommand(40319, 0) -- Item navigation: Move cursor right to edge of item
reaper.UpdateArrange()
end
script_title = "Script: BenjyO_Split MIDI item at edit cursor and add CC64 Off-message a few pixels before.lua"
reaper.Undo_BeginBlock()
main()
reaper.Undo_EndBlock(script_title, 0)
Hope this helps somehow.
|
Thanks so much. I can't wait to try it. How is it someone as smart as you only has 30 posts?
|
|
|