Old 06-20-2021, 06:53 AM   #1
Phazma
Human being with feelings
 
Join Date: Jun 2019
Posts: 2,875
Default JSFX - Code to bypass plugins on render?

I have several JSFX meters and analyzers embedded on my master mixer which help me see what is going on while taking no extra screen real estate.

However to reduce CPU consumption and render as fast as possible I always have to bypass them before render and un-bypass them after render. I wish this could happen automatically.

I am wondering if it is possible to modify these plugins by adding some lines of code that tell them to not be processed when rendering (perhaps by detecting if non-realtime playback is happening)?

If this is not possible I might create some kind of FR to meet the needs but have to see what is most sensible (either add API to jsfx to allow this, or flag plugin instances to not be processed on render, or option to bypass master FX chain on render, or allow embedding MonitorFX on master which I have already requested but is probably to complicated, or something else that has as many benefits as possible in addition to solving my inconvenience...)
Phazma is offline   Reply With Quote
Old 06-20-2021, 07:09 AM   #2
Meo-Ada Mespotine
Human being with feelings
 
Meo-Ada Mespotine's Avatar
 
Join Date: May 2017
Location: Leipzig
Posts: 6,628
Default

Inside the JSFX or via ReaScript? The latter would allow bypassing them before and unbypassing them after rendering.
__________________
Use you/she/her.Ultraschall-Api Lua Api4Reaper - Donate, if you wish

On vacation for the time being...
Meo-Ada Mespotine is offline   Reply With Quote
Old 06-20-2021, 07:18 AM   #3
Phazma
Human being with feelings
 
Join Date: Jun 2019
Posts: 2,875
Default

In any possible way that does not affect workflow or add considerable CPU strain.

I am not looking for a “render script” or custom action that renders with certain settings, I want to keep using the render dialog for setting up my renders.

But if it was possible to have for example a running script that eats little CPU and does nothing but detecting when a render is started and when it is finished and automatically switches the master FX chain off before it starts and on after it finishes it would be a possible solution.

Any other approach that meets the same goal could be valid too. For example a script that acts on plugins with a certain name rather than on the master fx chain.. whatever is the easiest solution.
Phazma is offline   Reply With Quote
Old 06-20-2021, 08:17 AM   #4
Meo-Ada Mespotine
Human being with feelings
 
Meo-Ada Mespotine's Avatar
 
Join Date: May 2017
Location: Leipzig
Posts: 6,628
Default

These functions might help.

TrackFX_GetFXName to get the names of the fx:
https://mespotin.uber.space/Ultrasch...ckFX_GetFXName

TrackFX_SetEnabled for setting enabled-state:
https://mespotin.uber.space/Ultrasch...kFX_SetEnabled

So you basically go through all of the master-fx and check, if their name is one of the ones, that you want to enable/disable using TrackFX_GetFXName.
Then you enable/disable them using TrackFX_SetEnabled.

You can get the current enabled-state of a TrackFX using TrackFX_GetEnabled:
https://mespotin.uber.space/Ultrasch...kFX_GetEnabled

So you could basically write a toggle-script for them.
If they aren't enabled -> enable them.
If they are enabled -> unenable them.

Edit:
You can get, if any project is currently rendering using

Code:
retval = reaper.EnumProjects(0x40000000)
If it returns nil, then nothing is rendering, if it returns a ReaProject, a project is currently rendering.
So you can try to react to that and toggle enabled-state of the trackfx in that case.

Though I don't know, if that could produce hiccups when disabling fx during rendering directly, so the best attempt is probably a toggle-scrip, that you could put into a toolbar.
__________________
Use you/she/her.Ultraschall-Api Lua Api4Reaper - Donate, if you wish

On vacation for the time being...

Last edited by Meo-Ada Mespotine; 06-20-2021 at 08:24 AM.
Meo-Ada Mespotine is offline   Reply With Quote
Old 06-20-2021, 08:33 AM   #5
Edgemeal
Human being with feelings
 
Edgemeal's Avatar
 
Join Date: Apr 2016
Location: ASU`ogacihC
Posts: 3,921
Default

Maybe check if the render window(s) are open and disable the master track fx?...

Code:
local bypassed = false
local rtf = "Render to file"
local que = "Queued Renders"
local fw = reaper.JS_Window_FindTop

function SetAction(action, state)
  if reaper.GetToggleCommandState(action) == 1 ~= state then
    reaper.Main_OnCommand(action, 0)
  end
end

function Main()
  if not bypassed and (fw(rtf,true) or fw(que,true)) then
    bypassed = true
    SetAction(16, 0) -- disable FX on master track
  elseif bypassed and not (fw(rtf,true) or fw(que,true)) then
    bypassed = false
    SetAction(16, 1) -- enable FX on master track 
  end
  reaper.defer(Main)
end

Main()
Edgemeal is offline   Reply With Quote
Old 06-20-2021, 09:10 AM   #6
Meo-Ada Mespotine
Human being with feelings
 
Meo-Ada Mespotine's Avatar
 
Join Date: May 2017
Location: Leipzig
Posts: 6,628
Default

Quote:
Originally Posted by Edgemeal View Post
Maybe check if the render window(s) are open and disable the master track fx?...

Code:
local bypassed = false
local rtf = "Render to file"
local que = "Queued Renders"
local fw = reaper.JS_Window_FindTop

function SetAction(action, state)
  if reaper.GetToggleCommandState(action) == 1 ~= state then
    reaper.Main_OnCommand(action, 0)
  end
end

function Main()
  if not bypassed and (fw(rtf,true) or fw(que,true)) then
    bypassed = true
    SetAction(16, 0) -- disable FX on master track
  elseif bypassed and not (fw(rtf,true) or fw(que,true)) then
    bypassed = false
    SetAction(16, 1) -- enable FX on master track 
  end
  reaper.defer(Main)
end

Main()
Hmm, this would bypass all master-fx including reverbs/compressors/eq/etc but I think, Phazma has meter-jsfx as well as other plugins on the master-fxchain, if I understood right.
__________________
Use you/she/her.Ultraschall-Api Lua Api4Reaper - Donate, if you wish

On vacation for the time being...
Meo-Ada Mespotine is offline   Reply With Quote
Old 06-20-2021, 09:25 AM   #7
Phazma
Human being with feelings
 
Join Date: Jun 2019
Posts: 2,875
Default

Quote:
Originally Posted by Edgemeal View Post
Maybe check if the render window(s) are open and disable the master track fx?...

Code:
local bypassed = false
local rtf = "Render to file"
local que = "Queued Renders"
local fw = reaper.JS_Window_FindTop

function SetAction(action, state)
  if reaper.GetToggleCommandState(action) == 1 ~= state then
    reaper.Main_OnCommand(action, 0)
  end
end

function Main()
  if not bypassed and (fw(rtf,true) or fw(que,true)) then
    bypassed = true
    SetAction(16, 0) -- disable FX on master track
  elseif bypassed and not (fw(rtf,true) or fw(que,true)) then
    bypassed = false
    SetAction(16, 1) -- enable FX on master track 
  end
  reaper.defer(Main)
end

Main()
What a clever solution, seems to work perfectly for my use case! Thanks a lot

@Meo-Ada Mespotine thank you too for your contribution! I think Edgemeal's script is the simplest solution for this issue but your info can definitely come in handy in future.
Phazma is offline   Reply With Quote
Old 06-20-2021, 09:27 AM   #8
Phazma
Human being with feelings
 
Join Date: Jun 2019
Posts: 2,875
Default

Quote:
Originally Posted by Meo-Ada Mespotine View Post
Hmm, this would bypass all master-fx including reverbs/compressors/eq/etc but I think, Phazma has meter-jsfx as well as other plugins on the master-fxchain, if I understood right.
No, actually I am trying to keep the master clean of any audio-processing effects whenever possible and rather apply them to a Folder/Bus that contains all tracks before the master.
Phazma 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 11:00 PM.


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