Old 06-27-2020, 10:03 AM   #1
rdhoore108
Human being with feelings
 
rdhoore108's Avatar
 
Join Date: Mar 2018
Location: Belgium
Posts: 43
Default JSFX: current track

* Request

Kindly provide a "special variable" that gives us the number of the track on which the FX is applied

* Benefit

We can use it to index gmem

* Reason

Now we need to use a "slider" to tell the script which track the FX is on, while I'm sure you guys know better than anyone what track it's on.

* Implementation Suggestion

You might call the variable track_num or whatever you like

* Extra comments

Thank you!
rdhoore108 is offline   Reply With Quote
Old 06-27-2020, 10:24 AM   #2
Meo-Ada Mespotine
Human being with feelings
 
Meo-Ada Mespotine's Avatar
 
Join Date: May 2017
Location: Leipzig
Posts: 6,629
Default

Yes! +1000

I would add the fx-chain-index as well, so multiple same JSFX on one track could organise their GMEM-slots properly by tracknumber_FX_Slot

And maybe a guid, if something like that doesn't exist yet, which could also be helpful when communicating between JSFX, ReaScript and VideoProcessor, so I could use that guid as gmem-name. After that, shuffling around the fx wouldn't matter anymore.
__________________
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 12-19-2020, 05:40 PM   #3
tglanfield
Human being with feelings
 
Join Date: Nov 2020
Posts: 11
Default

Very useful addition. Yes please.
tglanfield is offline   Reply With Quote
Old 12-19-2020, 06:49 PM   #4
tack
Human being with feelings
 
tack's Avatar
 
Join Date: Jan 2014
Location: Ontario, Canada
Posts: 1,619
Default

The challenge with using track number for this use case is that once you insert a track or otherwise reorder them, the track-number-as-index now points to the wrong location in the gmem buffer.

FWIW, I've solved it this way:

https://github.com/jtackaberry/reati...ate.jsfx#L1463

However it does depend on a long-running Lua script to garbage collect deleted JSFX instances:

https://github.com/jtackaberry/reati...p/rfx.lua#L330

A native way to do this without the need for all this rigmarole would definitely be nice.
tack is offline   Reply With Quote
Old 01-17-2021, 05:53 PM   #5
gxray
Human being with feelings
 
Join Date: Dec 2020
Location: Miami, FL USA
Posts: 396
Default

Would be useful, +1 ran into this issue tonight
__________________
Seasoned codemonkey
Dunno a thing about making music (here to learn!)
gxray is offline   Reply With Quote
Old 01-17-2021, 11:43 PM   #6
mschnell
Human being with feelings
 
mschnell's Avatar
 
Join Date: Jun 2013
Location: Krefeld, Germany
Posts: 14,776
Default

Quote:
Originally Posted by rdhoore108 View Post
We can use it to index gmem
It will not help when two instances are on the same track.
IMHO the better way is to just count the instances in a gmem varible,
I do this in several projects.
-Michael
mschnell is offline   Reply With Quote
Old 03-26-2021, 03:27 PM   #7
rdhoore108
Human being with feelings
 
rdhoore108's Avatar
 
Join Date: Mar 2018
Location: Belgium
Posts: 43
Default

Quote:
Originally Posted by mschnell View Post
It will not help when two instances are on the same track.
IMHO the better way is to just count the instances in a gmem varible,
I do this in several projects.
-Michael
Michael, how do you make sure that the first track will write into gmem first, the second as second, etc? I found I cannot count on that to happen, the moment I hit play, I lose all control over what gets processed in what order or timing... Even when initially loading the project from disk, I can't be sure that all tracks and FX's will get initialized in a certain order.

My FX needs the exact track number (not just a unique id) to match with the send that a lua script will have created for each track. But now I just found out that in the same lua script, I can actually set the track number correctly! I'm so pleased. I could even make the slider invisible if I wanted, but I prefer to see it. If one also needs the chain index, one would just need to set fxid + 1 into a slider in the same way.

Code:
local num_tracks = reaper.CountTracks(0)
local i = 0
while (i < num_tracks) do
    local trackid = reaper.GetTrack(0,i)
    local fxid = reaper.TrackFX_AddByName(trackid, "My FX's name", false, 0) -- 0 means only query, never add
    if fxid >= 0 then
        reaper.TrackFX_SetParam(trackid, fxid, 0, i+1) -- 0 means slider1
    end
    i = i + 1
end
rdhoore108 is offline   Reply With Quote
Old 03-26-2021, 11:26 PM   #8
mschnell
Human being with feelings
 
mschnell's Avatar
 
Join Date: Jun 2013
Location: Krefeld, Germany
Posts: 14,776
Default

Yep. An automated enumeration will not take the location of the tracks in the TCP into account.
-Michael
mschnell is offline   Reply With Quote
Old 03-27-2021, 01:47 AM   #9
J Reverb
Human being with feelings
 
Join Date: Jul 2009
Posts: 1,071
Default

+1 on this
J Reverb is offline   Reply With Quote
Old 10-18-2021, 09:13 AM   #10
Infrabass
Human being with feelings
 
Join Date: Apr 2014
Posts: 398
Default

+1, also ran into this issue today.
Infrabass is offline   Reply With Quote
Old 01-16-2022, 01:56 AM   #11
rdhoore108
Human being with feelings
 
rdhoore108's Avatar
 
Join Date: Mar 2018
Location: Belgium
Posts: 43
Default

How do we draw Justin's attention to this, and how many +1 votes does he wish to see in order to add this? It will take him a few minutes only, probably it will take longer to read the posts than to actually provide such a track_num variable...

Btw, Justin, thank you immensly for taking all the effort for programming and maintaining Reaper, it really is a unique piece of audio software!!!!! But do go on a holiday once in a while, we simply cannot afford a burned out Justin.
rdhoore108 is offline   Reply With Quote
Old 07-06-2022, 04:32 AM   #12
jack461
Human being with feelings
 
jack461's Avatar
 
Join Date: Nov 2013
Location: France
Posts: 181
Default Has someone a solution ?

+17237

I do also need a solution to get the track number where a JSFX plug-in is. I have a set of tracks, each one with a JSFX "generator" G. In the FX chain, I have then some other plug-ins that alter the sounds of the generator. And after those, I have a JSFX "Panner", "P", that sends the sounds to different channels, up to 40 in some cases. I need to link the Generator on track "N" with the Panner on the same track, so I do need that these effects get the track number/identification on which they are.

The simplest way to do this is certainely to have a "track_num" variable implemented in JS. And, by the way, having the FX number in the FX chain of the current track could also help !

Another solution, for me, would be to have each "Generator" generate a unique audio signal, that would be recognized by the the "Panner". But I must admit I'd rather prefer to have a simple solution implemented in REAPER, rather than spending hours to figure an ad hoc solution, that won't really help other persons who have a similar need...

J. Jack.

(P.S. If I count correctly, whe are now at +18246 for this feature. Isn't that a good reason to implement it ?)
jack461 is offline   Reply With Quote
Old 07-06-2022, 06:36 AM   #13
rdhoore108
Human being with feelings
 
rdhoore108's Avatar
 
Join Date: Mar 2018
Location: Belgium
Posts: 43
Default

Quote:
Originally Posted by jack461 View Post
+17237

I do also need a solution to get the track number where a JSFX plug-in is. (...)
The simplest way to do this is certainely to have a "track_num" variable implemented in JS. And, by the way, having the FX number in the FX chain of the current track could also help ! (...)
As a temporary and sad workaround, my 7th post above https://forum.cockos.com/showpost.ph...97&postcount=7 explains how you could make a LUA script that you run to set all the references correctly. The only trouble is you need to remember to run the script whenever you have changed the order of things, or added tracks.

In the meantime, we keep hoping against hope that one beautiful day, track_num and fx_num will indeed get added.
rdhoore108 is offline   Reply With Quote
Old 07-06-2022, 11:33 AM   #14
mschnell
Human being with feelings
 
mschnell's Avatar
 
Join Date: Jun 2013
Location: Krefeld, Germany
Posts: 14,776
Default

Quote:
Originally Posted by jack461 View Post
And after those, I have a JSFX "Panner", "P", that sends the sounds to different channels, up to 40 in some cases. I need to link the Generator on track "N" with the Panner on the same track, so I do need that these effects get the track number/identification on which they are.
Hmm.

You are walking in two realms in Reaper at the same time.

JSFXes (and other plugins) do Audio/Midi -> Audio/Midi i.e. streams. But they can't "see" tracks or routing. Reaper scripts deal with Tracks, routing, ...
Hence (unless you want to do C++ (or similar) based plugins like ReaLearn) you would need to do an additional script (EEL, LUA or Python) to manage the setup. Same can locate your plugins (e.g. according to their ALIAS names and do the routing. There are lots of ways to have you plugins communicate with the Script: Midi, Plugin Parameters (i.e. "Automation"), GMEM (maybe only EEL), ...

-Michael

Last edited by mschnell; 07-06-2022 at 12:34 PM.
mschnell is offline   Reply With Quote
Old 07-06-2022, 01:51 PM   #15
jack461
Human being with feelings
 
jack461's Avatar
 
Join Date: Nov 2013
Location: France
Posts: 181
Default

Quote:
Originally Posted by mschnell View Post
Hmm.

You are walking in two realms in Reaper at the same time.

JSFXes (and other plugins) do Audio/Midi -> Audio/Midi i.e. streams. But they can't "see" tracks or routing. Reaper scripts deal with Tracks, routing, ...
Hence (unless you want to do C++ (or similar) based plugins like ReaLearn) you would need to do an additional script (EEL, LUA or Python) to manage the setup. Same can locate your plugins (e.g. according to their ALIAS names and do the routing. There are lots of ways to have you plugins communicate with the Script: Midi, Plugin Parameters (i.e. "Automation"), GMEM (maybe only EEL), ...

-Michael

No, not really. I don't need any additional script. I already have a correct algorithm that let "generators" declare themselves, and, by communicating via gmem, choose a unique identification. [Of course, the algorithm is run periodically, and takes in account generators that are dynamically created, deleted, muted, and doesn't care about track moved, etc.] So I don't really need here a track number. The generators could create an audio stream (in any unused channel), send on this stream their unique identification, let the "Panners" decode this identification, so that each Panner can communicate with the Generator which is on the same track, using gmem. But as I said, it takes some time to program such a solution, which costs some CPU time and bus traffic, and will probably help nobody else. It would be, for all of us, soooo much better to simply have a "track_num" variable !

J.Jack.
jack461 is offline   Reply With Quote
Old 11-23-2022, 12:24 PM   #16
rdhoore108
Human being with feelings
 
rdhoore108's Avatar
 
Join Date: Mar 2018
Location: Belgium
Posts: 43
Default

ONE DAY!!!!!!! THE DAY WILL COME !!!!!!!!!!!!!!!

ONE DAY JUSTIN WILL READ THIS AND THINK, HEY, LET'S DO THESE GUYS A FAVOR!!!!!! THEY HAVE BEEN WAITING FOR YEARS NOW !!!!!!!!!!!!!

AND IT'S SO DAMN EASY TO IMPLEMENT, WHY NOT, HE WILL SAY !!!!!!!!!!!!!!!

ONE DAY, KEEP LIGHTING YOUR CANDLES!
rdhoore108 is offline   Reply With Quote
Old 11-24-2022, 08:31 AM   #17
Justin
Administrator
 
Justin's Avatar
 
Join Date: Jan 2005
Location: NYC
Posts: 15,740
Default

will look at this in the near future
Justin is online now   Reply With Quote
Old 11-24-2022, 09:46 AM   #18
Spookye
Human being with feelings
 
Spookye's Avatar
 
Join Date: Jul 2018
Location: Torino, Italia
Posts: 747
Default

Quote:
Originally Posted by Justin View Post
will look at this in the near future
Ohh yeah. This is a good incipt to write in the next release.
__________________
Cupboard Home Studio YT
https://www.youtube.com/channel/UCm8...X1912MA260ELzg
Spookye is offline   Reply With Quote
Old 05-19-2023, 10:38 AM   #19
rdhoore108
Human being with feelings
 
rdhoore108's Avatar
 
Join Date: Mar 2018
Location: Belgium
Posts: 43
Default

Quote:
Originally Posted by Justin View Post
will look at this in the near future
I only noticed it now, but in fact this has indeed been implemented, see get_host_placement() in https://www.reaper.fm/sdk/js/advfunc.php#js_advanced

THANK YOU, JUSTIN!
rdhoore108 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 03:30 PM.


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