Hi,
I have script like the one below that I've found some time ago in these forums. It works but it iterates all MIDI items in arrange view and cleans them up all at once. How can I make it cleanup only the selected MIDI item? or is there an alternative script that I can use on per-selected-item basis?
The script is lua and as follows,
Code:
-- Remove all CCs from all tracks and all takes
num_items = reaper.CountMediaItems(0)
for i = 0, num_items-1 do
cur_item = reaper.GetMediaItem(0, i)
num_takes = reaper.CountTakes(cur_item)
for t = 0, num_takes-1 do
cur_take = reaper.GetTake(cur_item, t)
if(reaper.TakeIsMIDI(cur_take)) then
-- What is the fastest way of deleting all CCs?
-- Here are a few options:
--[[
_, _, ccevtcnt, _ = reaper.MIDI_CountEvts(cur_take)
for i = ccevtcnt-1, 0, -1 do
reaper.MIDI_DeleteCC(cur_take, i)
end
]]
--[[
repeat
_, _, ccevtcnt, _ = reaper.MIDI_CountEvts(cur_take)
if ccevtcnt > 0 then reaper.MIDI_DeleteCC(cur_take, ccevtcnt-1) end
until ccevtcnt == 0
]]
-- This option seems to be the fastest:
repeat
deleteOK = reaper.MIDI_DeleteCC(cur_take, 0)
until deleteOK == false
end -- if(reaper.TakeIsMIDI(cur_take))
end -- for t = 0, num_takes-1 do
end -- for i = 0, num_items-1 do
reaper.UpdateArrange()
reaper.Undo_OnStateChange("Remove all CCs from all tracks")
* By cleanup, I mean remove all CC/bank etc data other than plain MIDI notes.
Thank you all!