Old 07-01-2019, 11:00 PM   #1
barbaroja
Human being with feelings
 
barbaroja's Avatar
 
Join Date: Jul 2009
Posts: 429
Default How to float a script inserted FX window

I am using:



from reaper_python import *

tracks = [RPR_GetSelectedTrack(0, track) for track in range(RPR_CountSelectedTracks(0))]

for track in tracks:
success = RPR_TrackFX_AddByName(track, 'FabFilter Pro-Q 3', False, -1)




Any ideas on how to have the inserted FX float to adjust its parameters inmediately and not have to go inside the plugin chain? The prefereces option is no good. I hope it can be done popping the plugin chain with focus on the last plugin.

Thanks!
barbaroja is offline   Reply With Quote
Old 07-01-2019, 11:30 PM   #2
Neutronic
Human being with feelings
 
Neutronic's Avatar
 
Join Date: Sep 2013
Posts: 657
Default

You need to use the following function -

RPR_TrackFX_Show(MediaTrack track, Int index, Int showFlag)

- with showFlag either =3 to float the FX or =1 to show the FX chain window.
Neutronic is offline   Reply With Quote
Old 07-02-2019, 07:37 PM   #3
barbaroja
Human being with feelings
 
barbaroja's Avatar
 
Join Date: Jul 2009
Posts: 429
Default

Quote:
Originally Posted by Neutronic View Post
You need to use the following function -

RPR_TrackFX_Show(MediaTrack track, Int index, Int showFlag)

- with showFlag either =3 to float the FX or =1 to show the FX chain window.
Result:

from reaper_python import *

tracks = [RPR_GetSelectedTrack(0, track) for track in range(RPR_CountSelectedTracks(0))]

for track in tracks:
success = RPR_TrackFX_AddByName(track, 'Blackhole', False, -1)
success = RPR_TrackFX_Show(track, -1, 1)

I doubt it is completely correct but it works.



Thanks, sir. you're awesome.
barbaroja is offline   Reply With Quote
Old 07-03-2019, 04:02 PM   #4
Neutronic
Human being with feelings
 
Neutronic's Avatar
 
Join Date: Sep 2013
Posts: 657
Default

Glad I could help!

Though if you would still prefer the script to open FX chains with last FX focused, you need to specify FX index in the RPR_TakeFX_Show() function. Otherwise, the script will not work as expected when you have more than 1 FX in a chain.

So the final script should look something like this:
Code:
from reaper_python import *

tracks = [RPR_GetSelectedTrack(0, track) for track in range(RPR_CountSelectedTracks(0))]

for track in tracks:
  fxIDX = RPR_TrackFX_AddByName(track, 'Fabfilter pro-q 3', False, -1)
  RPR_TrackFX_Show(track, fxIDX, 1)
Notice that for the sake of clarity I changed the success variable name to fxIDX, since that is what the function returns.

On the other hand, RPR_TrackFX_Show() does not return anything, so you don't need to assign its result to a variable.
Neutronic is offline   Reply With Quote
Old 07-03-2019, 04:48 PM   #5
barbaroja
Human being with feelings
 
barbaroja's Avatar
 
Join Date: Jul 2009
Posts: 429
Default

Quote:
Originally Posted by Neutronic View Post
Glad I could help!

Though if you would still prefer the script to open FX chains with last FX focused, you need to specify FX index in the RPR_TakeFX_Show() function. Otherwise, the script will not work as expected when you have more than 1 FX in a chain.

So the final script should look something like this:
Code:
from reaper_python import *

tracks = [RPR_GetSelectedTrack(0, track) for track in range(RPR_CountSelectedTracks(0))]

for track in tracks:
  fxIDX = RPR_TrackFX_AddByName(track, 'Fabfilter pro-q 3', False, -1)
  RPR_TrackFX_Show(track, fxIDX, 1)
Notice that for the sake of clarity I changed the success variable name to fxIDX, since that is what the function returns.

On the other hand, RPR_TrackFX_Show() does not return anything, so you don't need to assign its result to a variable.
Thanks. I modified all my scripts with what you suggested. I just added fxname variable to make it easy to change in the future. There is one that is failing.

Code:
from reaper_python import *

fxname = 'Volume Adjustment'

tracks = [RPR_GetSelectedTrack(0, track) for track in range(RPR_CountSelectedTracks(0))]

for track in tracks:
  fxIDX = RPR_TrackFX_AddByName(track, fxname, False, -1)
  RPR_TrackFX_Show(track, fxIDX, 1)
Any ideas on why this may be happening?
barbaroja is offline   Reply With Quote
Old 07-03-2019, 05:08 PM   #6
Neutronic
Human being with feelings
 
Neutronic's Avatar
 
Join Date: Sep 2013
Posts: 657
Default

Try changing fxname = 'Volume Adjustment' to fxname = 'JS:Volume'. This should work.

The fail has something to do with the way the function matches JS names. (The actual plugin file is named "volume" not "volume adjustment".)
Neutronic is offline   Reply With Quote
Old 07-03-2019, 06:32 PM   #7
barbaroja
Human being with feelings
 
barbaroja's Avatar
 
Join Date: Jul 2009
Posts: 429
Default

Quote:
Originally Posted by Neutronic View Post
Try changing fxname = 'Volume Adjustment' to fxname = 'JS:Volume'. This should work.

The fail has something to do with the way the function matches JS names. (The actual plugin file is named "volume" not "volume adjustment".)
Works. What is the reason this happens? I am not able to use let's say Volume/Pan Smoother v5. Anything I should learn to be able to use them?

Edit. Found the reason with the help you provided above. It is the filename what it looks for.

Thanks again.

Last edited by barbaroja; 07-03-2019 at 07:08 PM.
barbaroja is offline   Reply With Quote
Old 07-03-2019, 07:42 PM   #8
Neutronic
Human being with feelings
 
Neutronic's Avatar
 
Join Date: Sep 2013
Posts: 657
Default

Quote:
Originally Posted by barbaroja View Post
Found the reason with the help you provided above. It is the filename what it looks for.
Yes, this is it.

One more thing I forgot to mention - if you want the name of a JS plugin to be displayed correctly in a chain then you need to feed the RPR_TrackFX_AddByName() function the full relative path of the said JS.

For example, you need to use fxname = 'Utility/volume_pan_sample_accurate_auto' for the plugin to be named Volume/Pan Smoother v5 after it's added. Otherwise, it'll be named volume_pan_sample_accurate_auto.
Neutronic is offline   Reply With Quote
Old 07-03-2019, 07:49 PM   #9
barbaroja
Human being with feelings
 
barbaroja's Avatar
 
Join Date: Jul 2009
Posts: 429
Default

Quote:
Originally Posted by Neutronic View Post
Yes, this is it.

One more thing I forgot to mention - if you want the name of a JS plugin to be displayed correctly in a chain then you need to feed the RPR_TrackFX_AddByName() function the full relative path of the said JS.

For example, you need to use fxname = 'Utility/volume_pan_sample_accurate_auto' for the plugin to be named Volume/Pan Smoother v5 after it's added. Otherwise, it'll be named volume_pan_sample_accurate_auto.
Thanks. Noted
barbaroja is offline   Reply With Quote
Old 07-09-2019, 11:12 PM   #10
barbaroja
Human being with feelings
 
barbaroja's Avatar
 
Join Date: Jul 2009
Posts: 429
Default

Quote:
Originally Posted by Neutronic View Post
Yes, this is it.

One more thing I forgot to mention - if you want the name of a JS plugin to be displayed correctly in a chain then you need to feed the RPR_TrackFX_AddByName() function the full relative path of the said JS.

For example, you need to use fxname = 'Utility/volume_pan_sample_accurate_auto' for the plugin to be named Volume/Pan Smoother v5 after it's added. Otherwise, it'll be named volume_pan_sample_accurate_auto.
Nother question. I am trying to recall a specific plugin preset. I tried:

Code:
from reaper_python import *

fxname = 'VST3:NLS Buss Stereo (Waves)'
fxpreset = 'List: Mike Master'

tracks = [RPR_GetSelectedTrack(0, track) for track in range(RPR_CountSelectedTracks(0))]

for track in tracks:
  fxIDX = RPR_TrackFX_AddByName(track, fxname, False, -1)
RPR_TrackFX_SetPreset(track, -1, fxpreset)
But it does not work. Does not recall the preset.
barbaroja is offline   Reply With Quote
Old 07-09-2019, 11:28 PM   #11
Neutronic
Human being with feelings
 
Neutronic's Avatar
 
Join Date: Sep 2013
Posts: 657
Default

I'm not currently at the computer to test it out, but if fxpreset is correct RPR_TrackFX_SetPreset(track, fxIDX, fxpreset) should work.

Setting the right FX index is important for it to work.

Also, don't forget about indenting the function just like you did it with RPR_TrackFX_AddByName().
Neutronic is offline   Reply With Quote
Old 07-09-2019, 11:39 PM   #12
barbaroja
Human being with feelings
 
barbaroja's Avatar
 
Join Date: Jul 2009
Posts: 429
Default

Quote:
Originally Posted by Neutronic View Post
I'm not currently at the computer to test it out, but if fxpreset is correct RPR_TrackFX_SetPreset(track, fxIDX, fxpreset) should work.

Setting the right FX index is important for it to work.

Also, don't forget about indenting the function just like you did it with RPR_TrackFX_AddByName().
Code:
from reaper_python import *

fxname = 'VST3:NLS Buss Stereo (Waves)'
fxpreset = 'List: Mike Master'

tracks = [RPR_GetSelectedTrack(0, track) for track in range(RPR_CountSelectedTracks(0))]

for track in tracks:
  fxIDX = RPR_TrackFX_AddByName(track, fxIDX, False, -1)
  RPR_TrackFX_SetPreset(track, -1, fxpreset)
Returns Script execution error

Traceback (most recent call last):
File "Insert_FX_Waves NLS Channel.py", line 9, in <module>
fxIDX = RPR_TrackFX_AddByName(track, fxIDX, False, -1)
NameError: name 'fxIDX' is not defined

If I change to

Code:
from reaper_python import *

fxname = 'VST3:NLS Buss Stereo (Waves)'
fxpreset = 'List: Mike Master'

tracks = [RPR_GetSelectedTrack(0, track) for track in range(RPR_CountSelectedTracks(0))]

for track in tracks:
  fxIDX = RPR_TrackFX_AddByName(track, fxname, False, -1)
  RPR_TrackFX_SetPreset(track, -1, fxpreset)
Works but does not set the right preset
barbaroja is offline   Reply With Quote
Old 07-10-2019, 12:58 AM   #13
Neutronic
Human being with feelings
 
Neutronic's Avatar
 
Join Date: Sep 2013
Posts: 657
Default

It gives the error because you used fxIDX in the wrong function.

Here is the full code to try:
Code:
from reaper_python import *

fxname = 'VST3:NLS Buss Stereo (Waves)'
fxpreset = 'List: Mike Master'

tracks = [RPR_GetSelectedTrack(0, track) for track in range(RPR_CountSelectedTracks(0))]

for track in tracks:
  fxIDX = RPR_TrackFX_AddByName(track, fxname, False, -1)
  RPR_TrackFX_SetPreset(track, fxIDX, fxpreset)
Neutronic is offline   Reply With Quote
Old 07-15-2019, 02:15 AM   #14
barbaroja
Human being with feelings
 
barbaroja's Avatar
 
Join Date: Jul 2009
Posts: 429
Default

Quote:
Originally Posted by Neutronic View Post
It gives the error because you used fxIDX in the wrong function.

Here is the full code to try:
Code:
from reaper_python import *

fxname = 'VST3:NLS Buss Stereo (Waves)'
fxpreset = 'List: Mike Master'

tracks = [RPR_GetSelectedTrack(0, track) for track in range(RPR_CountSelectedTracks(0))]

for track in tracks:
  fxIDX = RPR_TrackFX_AddByName(track, fxname, False, -1)
  RPR_TrackFX_SetPreset(track, fxIDX, fxpreset)
Thanks. Awesome!
barbaroja is offline   Reply With Quote
Old 07-21-2019, 06:39 PM   #15
Arthur McArthur
Human being with feelings
 
Arthur McArthur's Avatar
 
Join Date: Sep 2016
Location: Toronto
Posts: 744
Default

Any ideas on how to move the newly added FX to a defined X,Y coordinate? So the script adds the FX and then moves it to the location?

I've tried combining this with mpl's Move focused Track FX to screen center but that seems to affect already open track FX and not the one just added.
Arthur McArthur is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -7. The time now is 09:56 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.