|
|
|
11-30-2020, 01:09 PM
|
#1
|
Human being with feelings
Join Date: Sep 2020
Posts: 149
|
Delete cc values under note by script
It seems like I must run the same script multiple times to clear the time selection of cc values. This seem to happen with multiple scripts. Is this a known problem?
|
|
|
12-01-2020, 06:45 PM
|
#2
|
Human being with feelings
Join Date: Sep 2020
Posts: 149
|
Nevermind , this script takes care of it
Code:
cclane=3
hwnd = reaper.MIDIEditor_GetActive()
--command_id=41735 -- select all CC under selected notes
--reaper.MIDIEditor_OnCommand(hwnd, command_id)
function del(cclane,tt)
take = reaper.MIDIEditor_GetTake(hwnd)
local i = reaper.MIDI_EnumSelCC(take, -1)
local t=0
while i~=-1 do
_, _, _, ppqpos, chanmsg, chan, msg2, msg3 = reaper.MIDI_GetCC( take, i )
if chanmsg==0xB0 then
if msg2==cclane then
t=t+1
local ok=false
while ok~=true do
ok=reaper.MIDI_DeleteCC(take,i)
end
end
end
i = reaper.MIDI_EnumSelCC(take, i)
end
if t~=0 then return del(cclane,tt+1)
else return tt end
end
del(cclane,1)
|
|
|
12-01-2020, 06:53 PM
|
#3
|
Human being with feelings
Join Date: Sep 2020
Posts: 149
|
its best to enable the option "CC selection follows note selection" for selecting cc values.
|
|
|
12-01-2020, 07:04 PM
|
#4
|
Human being with feelings
Join Date: May 2017
Location: Leipzig
Posts: 6,628
|
One wild guess: have you tried deleting cc backwards? With the last one deleted first and the first one deleted last?
Cause it looks like the common problem people have, who try to delete MediaItems and after script-run, there are still items left, who should've been deleted.
Usually the solution (when wanting to delete item 5 through 10) is to delete the items in the order: 10, 9, 8, 7, 6, 5, NOT 5, 6, 7, 8, 9, 10.
Have no clue about cc so maybe, what I was trying to suggest is way off of the actual problem
|
|
|
12-02-2020, 05:54 AM
|
#5
|
Human being with feelings
Join Date: Sep 2020
Posts: 149
|
This is as far as i got.
I collected the id's of the cc values beloning to lane 3, and did a reverse for loop.
It ends up deleting values outside the selection (scary)
It doesnt look like I can just perform an action on a cc value by index.
Code:
--delete backwards
function msg(s)
return reaper.ShowConsoleMsg(s .."\n")
end
hwnd=reaper.MIDIEditor_GetActive()
take=reaper.MIDIEditor_GetTake(hwnd)
cclane=3
--command_id=41735 -- select all CC under selected notes
--reaper.MIDIEditor_OnCommand(hwnd, command_id)
function del(cclane,tt)
take = reaper.MIDIEditor_GetTake(hwnd)
local i = reaper.MIDI_EnumSelCC(take, -1)
local t=0
local b={}
while i~=-1 do
_, _, _, ppqpos, chanmsg, chan, msg2, msg3 = reaper.MIDI_GetCC( take, i )
if chanmsg==0xB0 then
if msg2==cclane then
t=t+1
b[t]=i
end
msg("idx = "..i.. " cclane = "..msg2)
end
i = reaper.MIDI_EnumSelCC(take, i)
end
msg("List all indexes with cclane "..cclane)
local lastone=0
for i, v in ipairs(b) do
msg("i = "..i.." v = "..v)
lastone=i
end
msg("lastone = "..lastone)
msg("In reversed order")
reaper.MIDI_Sort( take)
for i=#b ,1,-1 do
msg("i = "..i.." v = "..b[i])
end
msg("Delete Backwards")
for i=#b ,1,-1 do
local ok=false
while ok~=true do
ok=reaper.MIDI_DeleteCC(take,i)
end
end
--ok=reaper.MIDI_DeleteCC(take,lastone)
end
del(3,1)
|
|
|
Thread Tools |
|
Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT -7. The time now is 02:00 AM.
|