|
|
|
08-14-2015, 08:45 PM
|
#1
|
Human being with feelings
Join Date: Oct 2013
Location: Moscow, Russia
Posts: 3,956
|
How to add fx to track via ReaScript?
Hi.
I did some experiments with track chunks, but still didn`t get it.
When I insert a plugin, state chunk returns this:
PHP Code:
<VST "VST: ReaTune (Cockos)" reatune.dll 0 "" 1919251566 bnRlcu5e7f4EAAAAAQAAAAAAAAACAAAAAAAAAAQAAAAAAAAACAAAAAAAAAACAAAAAQAAAAAAAAACAAAAAAAAAGgAAAABAAAAAAAQAAAAAAAAAAAAHgAAALgBAAAAAAAA /w8AAPoAAAAyAAAAMgAAAAAAAAAAAAAAAAAAAAAAgEIAAEBBAAAAAAAAIEIBAAAAAQAAAAAACAABAAAAAAAAAAAAAAAAAAAAeQIAAMABAAAAAAAAAAAQAAAA >
Questions:
1. Is there any way to get dll file name from reaper internal name?
2. Where to get or how to convert something to this beatiful data?
Last edited by mpl; 08-14-2015 at 10:09 PM.
|
|
|
08-14-2015, 11:19 PM
|
#2
|
Human being with feelings
Join Date: Nov 2013
Location: IKEA
Posts: 2,751
|
Hey! Maby not what you are asking for but just in case, and maby you find anything useful in it.
Track FX selector (spk77)
https://stash.reaper.fm/v/21543/Track...20selector.zip
__________________
_Ohh.))::_Linux_::((.Xoxo_
|
|
|
08-14-2015, 11:28 PM
|
#3
|
Human being with feelings
Join Date: Dec 2009
Location: Oblivion
Posts: 10,248
|
There's already basically a script for this, but maybe you want something else? I love it because it floats the plugin if it's already on the track or inserts it if it's not. Very handy.
Code:
//by IXix (translated by Elan Hickler)
function ShowNamedPlugin(sPluginName, pTrack, create) local(iSel iPlugin) (
/*
If named plugin not found and create is True, add it to track FX chain
If track FX chain is hidden, float the plugin.
If track FX chain is open, switch focus to the plugin if it isn't selected
*/
iPlugin = TrackFX_GetByName(pTrack, sPluginName, create);
iPlugin > -1 ? (
iSel = TrackFX_GetChainVisible(pTrack);
iSel == -1 ? (
TrackFX_GetOpen(pTrack, iPlugin) ?
TrackFX_Show(pTrack, iPlugin, 2):
TrackFX_Show(pTrack, iPlugin, 3);
):
iSel == -2 ? TrackFX_Show(pTrack, iPlugin, 1):
iSel != iPlugin ? TrackFX_Show(pTrack, iPlugin, 1);
);
);
sPluginName = "SPAN";
pProject = 0;
i = 0;
loop(CountSelectedTracks(pProject),
pTrack = GetSelectedTrack(pProject, i);
ShowNamedPlugin(sPluginName, pTrack, 1);
i+=1;
);
IsTrackSelected(GetMasterTrack()) ? ShowNamedPlugin(sPluginName, GetMasterTrack(), 1);
You just change the plugin name in quotes to match whatever you might have renamed it.
|
|
|
08-15-2015, 12:50 AM
|
#4
|
Human being with feelings
Join Date: Aug 2012
Location: Finland
Posts: 2,668
|
TrackFX_GetByName has an option to insert an FX:
Code:
Lua: integer reaper.TrackFX_GetByName(MediaTrack track, string fxname, boolean instantiate)
Get the index of the first track FX insert that matches fxname. If the FX is not in the chain and instantiate is true, it will be inserted. See TrackFX_GetInstrument, TrackFX_GetEQ.
|
|
|
08-15-2015, 01:10 AM
|
#5
|
Human being with feelings
Join Date: Dec 2009
Location: Oblivion
Posts: 10,248
|
Hmm, so, that script I'm using is only one line with Lua?
|
|
|
08-15-2015, 01:11 AM
|
#6
|
Human being with feelings
Join Date: Aug 2012
Location: Finland
Posts: 2,668
|
This function would be nice:
Code:
reaper.TrackFX_Insert(MediaTrack track, string fxname, integer index)
...and maybe
Code:
reaper.TrackFX_Remove(MediaTrack track, integer index)
|
|
|
08-15-2015, 01:20 AM
|
#7
|
Human being with feelings
Join Date: Aug 2012
Location: Finland
Posts: 2,668
|
Quote:
Originally Posted by foxAsteria
Hmm, so, that script I'm using is only one line with Lua?
|
It would be about the same length in Lua
Ixix's/Elan Hickler's script does all this: - If named plugin not found and create is True, add it to track FX chain
- If track FX chain is hidden, float the plugin.
- If track FX chain is open, switch focus to the plugin if it isn't selected
|
|
|
08-15-2015, 01:21 AM
|
#8
|
Human being with feelings
Join Date: Dec 2009
Location: Oblivion
Posts: 10,248
|
Oh, ok. It also works if the Master Track is selected, but I can't recall who added that part now...
|
|
|
08-15-2015, 01:33 AM
|
#9
|
Human being with feelings
Join Date: Aug 2012
Location: Finland
Posts: 2,668
|
Quote:
Originally Posted by foxAsteria
Oh, ok. It also works if the Master Track is selected, but I can't recall who added that part now...
|
That might be me
Here's the thread:
http://forum.cockos.com/showthread.php?t=141539
(A script to float a specific plug-in GUI from a selected track)
|
|
|
08-15-2015, 01:34 AM
|
#10
|
Human being with feelings
Join Date: Dec 2009
Location: Oblivion
Posts: 10,248
|
LOL, well then thanks and thanks again. Was planning to get more into the scripting business, but you guys have already solved most of the problems I wanted to...
|
|
|
08-15-2015, 06:27 PM
|
#11
|
Human being with feelings
Join Date: Oct 2013
Location: Moscow, Russia
Posts: 3,956
|
spk77, just tested it. TrackFX_GetByName doesn`t work when there is already same name fx on track (as commented, actually).
I want to write a script, which add fx even if it exists on track. ReaConsole also doesn`t do what, so I guess we still haven`t API for direct inserting.
|
|
|
08-16-2015, 12:31 AM
|
#12
|
Human being with feelings
Join Date: Oct 2013
Location: Moscow, Russia
Posts: 3,956
|
I did some tests with trackstatechunk and only two times I somehow add plugin to track, but I don`t get how. lol
So, I guess we can`t just add lines to state chunk.
SWS Resources use .rfxchain files to get this binary data, as I understood. Also when inserting Reaper generates GUID, Float position and WAK (I have no idea what is that), but if it works in sws resorces, seems to be there is no need to care about that.
|
|
|
08-16-2015, 02:31 AM
|
#13
|
Human being with feelings
Join Date: Aug 2012
Location: Finland
Posts: 2,668
|
Quote:
Originally Posted by mpl
spk77, just tested it. TrackFX_GetByName doesn`t work when there is already same name fx on track (as commented, actually).
I want to write a script, which add fx even if it exists on track. ReaConsole also doesn`t do what, so I guess we still haven`t API for direct inserting.
|
That's right - we would need reaper.TrackFX_Insert(MediaTrack track, string fxname, integer index)
|
|
|
05-27-2020, 02:20 PM
|
#14
|
Human being with feelings
Join Date: Jan 2020
Posts: 76
|
Hi MPL,
even though its an old thread, is the topic still relevant to you? I think I can help here ;-)
|
|
|
05-27-2020, 10:20 PM
|
#15
|
Human being with feelings
Join Date: Oct 2013
Location: Moscow, Russia
Posts: 3,956
|
No, I know TrackFx_AddbyName with instantiate value solves my issue (GetByname was deprecated). TrackFX_Remove also added to an API so it solves spk77 feature request too.
|
|
|
05-30-2020, 06:19 AM
|
#16
|
Human being with feelings
Join Date: Jan 2020
Posts: 76
|
Ok, thanks for the info. stumbled upon your thread while looking for information on the track state chunk.
Currently I can parse, convert and change it. Also loading works for some plugins but its kind of unstable. But I am using Python to do all this
|
|
|
07-19-2022, 11:31 AM
|
#17
|
Human being with feelings
Join Date: Apr 2009
Location: Nashville
Posts: 172
|
Quote:
Originally Posted by foxAsteria
There's already basically a script for this, but maybe you want something else? I love it because it floats the plugin if it's already on the track or inserts it if it's not. Very handy.
Code:
//by IXix (translated by Elan Hickler)
function ShowNamedPlugin(sPluginName, pTrack, create) local(iSel iPlugin) (
/*
If named plugin not found and create is True, add it to track FX chain
If track FX chain is hidden, float the plugin.
If track FX chain is open, switch focus to the plugin if it isn't selected
*/
iPlugin = TrackFX_GetByName(pTrack, sPluginName, create);
iPlugin > -1 ? (
iSel = TrackFX_GetChainVisible(pTrack);
iSel == -1 ? (
TrackFX_GetOpen(pTrack, iPlugin) ?
TrackFX_Show(pTrack, iPlugin, 2):
TrackFX_Show(pTrack, iPlugin, 3);
):
iSel == -2 ? TrackFX_Show(pTrack, iPlugin, 1):
iSel != iPlugin ? TrackFX_Show(pTrack, iPlugin, 1);
);
);
sPluginName = "SPAN";
pProject = 0;
i = 0;
loop(CountSelectedTracks(pProject),
pTrack = GetSelectedTrack(pProject, i);
ShowNamedPlugin(sPluginName, pTrack, 1);
i+=1;
);
IsTrackSelected(GetMasterTrack()) ? ShowNamedPlugin(sPluginName, GetMasterTrack(), 1);
You just change the plugin name in quotes to match whatever you might have renamed it.
|
Anyway to do this without floating newly added FX?
|
|
|
07-24-2022, 07:03 PM
|
#18
|
Human being with feelings
Join Date: Dec 2009
Location: Oblivion
Posts: 10,248
|
Quote:
Originally Posted by Rockum
Anyway to do this without floating newly added FX?
|
Yes, but I couldn't tell you how. You can try googling TrackFX_Show to see what changing the values will do.
|
|
|
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 08:31 PM.
|