i have this code for adding, in this case, readelay, to an active take:
Code:
function main() -- local (i, j, item, take, track)
reaper.Undo_BeginBlock() -- Begining of the undo block. Leave it at the top of your main function.
local NameFX = "ReaDelay (Cockos)"
local ItemSel = reaper.CountSelectedMediaItems( 0 ) -- set variable for number of selected items in current project ( 0 )
if not ItemSel then no_undo() return end -- exit if no items selected
for i = 0, ItemSel - 1 do -- loop through selected items
ItemCurr = reaper.GetSelectedMediaItem( 0, i ) -- set variable for current item
TakeCurr = reaper.GetActiveTake( ItemCurr ) -- set variable for active take
local fxID = reaper.TakeFX_AddByName( TakeCurr, NameFX, 0 )
if fxID <0 then
fxID = reaper.TakeFX_AddByName( TakeCurr, NameFX, 1 )
reaper.TakeFX_Show( TakeCurr, 0, 0 ) -- keeps the fx window hidden
end
end
reaper.Undo_EndBlock("Add ReaDelay by name to selected items", -1) -- End of the undo block. Leave it at the bottom of your main function.
end
reaper.PreventUIRefresh(1) -- Prevent UI refreshing. Uncomment it only if the script works.
main() -- Execute your main function
reaper.UpdateArrange() -- Update the arrangement
reaper.PreventUIRefresh(-1) -- Restore UI Refresh. Uncomment it only if the script works.
i have copies of this script for several often used reafx. if i run them in succession, each new fx is added to the end of the chain. i believe there's a way with track fx to assign whether the fx is added at the start or end of the chain. how would this code be modded to make, in this case readelay, insert at the start of the chain?
thanks,
babag