I just thought I could share a simple script I figured out recently. It is actually a simple trick but it took me a while to figure out how to do it since the API has no controls for the Take Fx Chains. The following code adds a fx that you can specify by name on the eel to the selected takes and opens the FX chain in the end for tweaking.
(the code needs SWS extension to work)
Add Reacomp to the selected takes
Code:
Undo_BeginBlock();
ntracks = CountSelectedTracks(0);
while (i < ntracks)
(
track[i] = GetSelectedTrack(0,i);
i += 1;
);
Main_OnCommand(NamedCommandLookup("_SWS_CREATETRK1"), 0);
temptrack = GetSelectedTrack(0,0);
TrackFX_GetByName(temptrack, "ReaComp (Cockos)",1);
Main_OnCommand(NamedCommandLookup("_S&M_COPYFXCHAIN5"), 0);
Main_OnCommand(NamedCommandLookup("_S&M_COPYFXCHAIN8"), 0);
Main_OnCommand(40005, 0);
Main_OnCommand(40638, 0);
i = 0;
while (i < ntracks)
(
SetTrackSelected(track[i],1);
i += 1;
);
Undo_EndBlock("Add ReaComp to selected takes",-1);
To change the FX to be added to the take all you have to do is substitute the name of the FX in bold in the code.
Let me know if you find any glitches or exceptions, hope it's of some use to someone.
Edit: New version that adds the fx to the selected tracks or items depending on focus
Add Reacomp to selected tracks/takes (depending on focus)
Code:
//Write name of fx to be added below:
fxname = "ReaComp (Cockos)";
/////////////
Undo_BeginBlock();
focus = GetCursorContext();
nitems = CountSelectedMediaItems(0);
focus != 2 ? (
focus == 1 && nitems != 0 ? (
ntracks = CountSelectedTracks(0);
while (i < ntracks)
(
track[i] = GetSelectedTrack(0,i);
i += 1;
);
Main_OnCommand(NamedCommandLookup("_SWS_CREATETRK1"), 0);
temptrack = GetSelectedTrack(0,0);
TrackFX_GetByName(temptrack,fxname,1);
Main_OnCommand(NamedCommandLookup("_S&M_COPYFXCHAIN5"), 0);
Main_OnCommand(NamedCommandLookup("_S&M_COPYFXCHAIN8"), 0);
Main_OnCommand(40005, 0);
Main_OnCommand(40638, 0);
i = 0;
while (i < ntracks)
(
SetTrackSelected(track[i],1);
i += 1;
);
):(
focus == 0 || nitems == 0 ? (
ntracks = CountSelectedTracks(0);
while (i < ntracks)
(
TrackFX_GetByName(GetSelectedTrack(0,i),fxname,1);
i += 1;
);
);
);
);
Undo_EndBlock("Add TrueVerb Stereo to selected tracks or takes",-1);