Old 04-13-2011, 07:21 PM   #1
d.bop
Human being with feelings
 
d.bop's Avatar
 
Join Date: Apr 2009
Location: Duluth, MN
Posts: 1,712
Default JS Global Variables - regxx Master List!

This thread was created to provide a list of JS plugins that are currently using the regxx variables for master/slave operation in REAPER. The purpose of this list is to avoid any possible collisions when using multiple plugins with global variables.

ATTN: Programmers!
Use this list to determine which regxx variables you should use in your plugins. When you upload your plugins, please add them to this list. Thanks!

ATTN: Plugin users!
Use this list to determine whether or not you will encounter any problems while using multiple master/slave JS plugins in your projects.

Thanks!


*Dear Mods...... sticky me?
*edit*
Thank you!

Last edited by d.bop; 04-13-2011 at 08:45 PM. Reason: I got stickied :)
d.bop is offline   Reply With Quote
Old 04-13-2011, 07:22 PM   #2
d.bop
Human being with feelings
 
d.bop's Avatar
 
Join Date: Apr 2009
Location: Duluth, MN
Posts: 1,712
Default

I'll start

Saturation_Master & Saturation_Slave
- Uses reg99
- Download link: https://stash.reaper.fm/v/8272/satura...ster-slave.zip

nonlinear_Master & nonlinear_Slave
- Uses reg98, reg97, and reg96
- Stash link: https://stash.reaper.fm/v/8273/nonlin...ster-slave.zip
d.bop is offline   Reply With Quote
Old 04-13-2011, 09:27 PM   #3
d.bop
Human being with feelings
 
d.bop's Avatar
 
Join Date: Apr 2009
Location: Duluth, MN
Posts: 1,712
Default

Till/Transient-driven Auto-Pan v1.0 (Master) & Till/Transient-driven Auto-Pan v1.0 (Slave)
- uses reg00, reg01, reg02, reg03, reg04, reg05, reg06, reg07, reg08, reg09
- included with REAPER

Till/Transient-driven Auto-Pan v1.1(Master) & Till/Transient-driven Auto-Pan v1.1 (Slave)
- uses reg00, reg01, reg02, reg03, reg04, reg05, reg06, reg07, reg08, reg09
- included with REAPER


There will be a conflict if both v1.0 and v1.1 are used together because they share the same regxx variables.
d.bop is offline   Reply With Quote
Old 05-21-2013, 05:40 PM   #4
Justin
Administrator
 
Justin's Avatar
 
Join Date: Jan 2005
Location: NYC
Posts: 15,716
Default

Perhaps we should make something where plugins can register named globals, i.e. _glob_* are automatically shared across all instances...
Justin is offline   Reply With Quote
Old 05-22-2013, 02:28 AM   #5
IXix
Human being with feelings
 
Join Date: Jan 2007
Location: mcr:uk
Posts: 3,887
Default

Quote:
Originally Posted by Justin View Post
Perhaps we should make something where plugins can register named globals, i.e. _glob_* are automatically shared across all instances...
That would be great!
IXix is online now   Reply With Quote
Old 05-22-2013, 03:54 AM   #6
bang
Human being with feelings
 
bang's Avatar
 
Join Date: Jul 2006
Posts: 626
Default

Quote:
Originally Posted by Justin View Post
Perhaps we should make something where plugins can register named globals, i.e. _glob_* are automatically shared across all instances...
that would be sweet! /dan
bang is offline   Reply With Quote
Old 05-23-2013, 11:27 AM   #7
beyond
Human being with feelings
 
Join Date: Jun 2007
Location: Palm Beach FL
Posts: 265
Default

Quote:
Originally Posted by Justin View Post
Perhaps we should make something where plugins can register named globals, i.e. _glob_* are automatically shared across all instances...
Any chance, these could also be delay compensated (multithreaded render ahead, etc.)?
beyond is offline   Reply With Quote
Old 05-23-2013, 01:00 PM   #8
Justin
Administrator
 
Justin's Avatar
 
Join Date: Jan 2005
Location: NYC
Posts: 15,716
Default

Quote:
Originally Posted by beyond View Post
Any chance, these could also be delay compensated (multithreaded render ahead, etc.)?
Not possible, no.


Getting back to the main topic:

In the next build (4.5rc2), you will be able to use _global.* across instances, and regXX are mapped to _global.regXX.

You can also use the namespace facility with this, so you could do:
Code:
function inc() (
  this.value += 1;
);

_global.inc(); // _global.value += 1;
_global.boo.inc(); // _global.boo.value += 1;
Justin is offline   Reply With Quote
Old 05-23-2013, 01:12 PM   #9
IXix
Human being with feelings
 
Join Date: Jan 2007
Location: mcr:uk
Posts: 3,887
Default

Quote:
Originally Posted by Justin View Post
In the next build (4.5rc2), you will be able to use _global.* across instances, and regXX are mapped to _global.regXX.

You can also use the namespace facility with this, so you could do:
Code:
function inc() (
  this.value += 1;
);

_global.inc(); // _global.value += 1;
_global.boo.inc(); // _global.boo.value += 1;
Awesome!
IXix is online now   Reply With Quote
Old 05-23-2013, 02:23 PM   #10
Tale
Human being with feelings
 
Tale's Avatar
 
Join Date: Jul 2008
Location: The Netherlands
Posts: 3,645
Default

Quote:
Originally Posted by Justin View Post
In the next build (4.5rc2), you will be able to use _global.* across instances, and regXX are mapped to _global.regXX.

You can also use the namespace facility with this, so you could do:
Code:
function inc() (
  this.value += 1;
);

_global.inc(); // _global.value += 1;
_global.boo.inc(); // _global.boo.value += 1;
Hmm, interesting... Cool, thanks.
Tale is offline   Reply With Quote
Old 05-23-2013, 07:44 PM   #11
beyond
Human being with feelings
 
Join Date: Jun 2007
Location: Palm Beach FL
Posts: 265
Default

Quote:
Originally Posted by Justin View Post
Not possible, no.
:-) Come on Justin, You are one of the best programmers in the world! Of course it is possible for you. Features like globally linked, runtime compiling Jesusonic is what makes Reaper superior to the rest. There would need to be time stamped, properly synchronized delay buffers. Weather it is easy or a priority right now is another question.

I am almost done on a realtime chord and scale recognition system that sends from a master track the transpose, scale, the chord and dynamics to the many children transforming midi patterns that follow. Using synced global variables would be much more ideal than duplicating and changing master connected children tracks. But I understand fixing the basic like the solo mute issues of midi tracks are a priority right now.
beyond is offline   Reply With Quote
Old 05-24-2013, 08:48 AM   #12
Justin
Administrator
 
Justin's Avatar
 
Join Date: Jan 2005
Location: NYC
Posts: 15,716
Default

Quote:
Originally Posted by beyond View Post
:-) Come on Justin, You are one of the best programmers in the world! Of course it is possible for you. Features like globally linked, runtime compiling Jesusonic is what makes Reaper superior to the rest. There would need to be time stamped, properly synchronized delay buffers. Weather it is easy or a priority right now is another question.

I am almost done on a realtime chord and scale recognition system that sends from a master track the transpose, scale, the chord and dynamics to the many children transforming midi patterns that follow. Using synced global variables would be much more ideal than duplicating and changing master connected children tracks. But I understand fixing the basic like the solo mute issues of midi tracks are a priority right now.
You could disable anticipative FX rendering, and don't use PDC, and hope for the best (or probably code something that would adapt to the PDC)... but having "synced global variables" probably would end up defying causality logic in many cases.
Justin is offline   Reply With Quote
Old 05-24-2013, 10:03 AM   #13
beyond
Human being with feelings
 
Join Date: Jun 2007
Location: Palm Beach FL
Posts: 265
Default

Quote:
Originally Posted by Justin View Post
You could disable anticipative FX rendering, and don't use PDC, and hope for the best (or probably code something that would adapt to the PDC)... but having "synced global variables" probably would end up defying causality logic in many cases.
Well, a track with a JS writing to a global variable is like giving that track a "Send" classification to tracks with JS's reading that global variable. In which case, these groups of dependant tracks all have to be synced and rendered as a bundle and all be capable of rendering ahead, or none at all.

So perhaps than, there needs not be time-stamped buffers (which would work in send situations serving both the future (render ahead) and the present, but would cause causality ambiguities in replies from the present JS's to the future, but 2 way communication is rarely used in JS communication).

Instead this design would check for virtual send connection treatment between JS's that write, and JS's that read detected global variables.

What are your thoughts, just for the puzzle of it...

My older design was working with disabled anticipative FX rendering on tracks that needed to hear the master (for special virtual instruments like piano and electric guitar sympathetically resonating and feeding back to themselves and to the drums, vocals and everything else around them). A simple transpose was also passed to all using globals, but unless all tracks using it were anticipative disabled, you could not change the transpose in the middle of a song musically in sync. This was not needed for most songs.

The new design is using MIDI controller messages sent to children receiving all their musical guidance from the master. If the master is on live input, they all get their chord and scale updates real time, otherwise they are free to happily render ahead.

There were some challenges solved, such as MIDI messages quantized and time-stamped on the same buffer offset coming in an unpredictable order, causing pattern notes to slice and dice to zero length as they updated from some of the chords unpredictably late. These were cleaned by keeping time-stamped note buffers in JS! Your amazing new updates to JS with functions was essential!
beyond is offline   Reply With Quote
Old 08-01-2013, 06:35 AM   #14
James HE
Human being with feelings
 
James HE's Avatar
 
Join Date: Mar 2007
Location: I'm in a barn
Posts: 4,467
Default

I have been using gmem[] for linking between effects. Is there any advantage in using regxx instead?

gmem[], because there are over 1 million slots, it's easier to avoid collisions. With the gmem VCA plugins I'm working on (slowly but surely) I need about 800 slots .

does regxx work across tabs like gmem[]? If not, that can be an advantage, in that you could choose one over the other if you did not want inter - tab communication.

I suppose I'll just test it when I get a chance.
James HE is offline   Reply With Quote
Old 08-24-2013, 06:37 PM   #15
James HE
Human being with feelings
 
James HE's Avatar
 
Join Date: Mar 2007
Location: I'm in a barn
Posts: 4,467
Default

I'm noticing that _global.variables stick around in the editor monitor after the effect is deleted. Is there a way to clear them from the list?
James HE is offline   Reply With Quote
Old 10-16-2013, 11:15 PM   #16
Kite
Human being with feelings
 
Join Date: Apr 2010
Location: Portland OR
Posts: 217
Default

Quote:
Originally Posted by James HE View Post
I have been using gmem[] for linking between effects. Is there any advantage in using regxx instead?
It appears that ReaJS doesn't support gmem, but does support regXX. So using regXX lets your effect run in other DAWs.
Kite is offline   Reply With Quote
Old 11-20-2013, 06:57 AM   #17
James HE
Human being with feelings
 
James HE's Avatar
 
Join Date: Mar 2007
Location: I'm in a barn
Posts: 4,467
Default

Collisions are now easy to avoid with _globals, but listing the _globals I've used here.

"ID", for example, is probably not a good label here, as it is too general. but I got here first, so don't use ID...

for VCA's
_global.ID
_global.slaveset
_global.resetoffset

for hardware router
_global.hardwaresel
_global.outonelev
_global.outtwolev
_global.outrestlev

(future) recording setup delay
_global.isp
James HE is offline   Reply With Quote
Old 11-20-2013, 01:48 PM   #18
IXix
Human being with feelings
 
Join Date: Jan 2007
Location: mcr:uk
Posts: 3,887
Default

Quote:
Originally Posted by James HE View Post
Collisions are now easy to avoid with _globals, but listing the _globals I've used here.

"ID", for example, is probably not a good label here, as it is too general. but I got here first, so don't use ID...

for VCA's
_global.ID
_global.slaveset
_global.resetoffset

for hardware router
_global.hardwaresel
_global.outonelev
_global.outtwolev
_global.outrestlev

(future) recording setup delay
_global.isp
I'd use _global.pluginName.varName. That way there's no chance of collision.
IXix is online now   Reply With Quote
Old 11-20-2013, 03:06 PM   #19
SaulT
Human being with feelings
 
Join Date: Oct 2013
Location: Seattle, WA
Posts: 876
Default

Proper namespacing FTW!

Would this include functions as well, or just variables?
SaulT is offline   Reply With Quote
Old 11-21-2013, 02:54 AM   #20
IXix
Human being with feelings
 
Join Date: Jan 2007
Location: mcr:uk
Posts: 3,887
Default

Quote:
Originally Posted by SaulT View Post
Proper namespacing FTW!

Would this include functions as well, or just variables?
Functions aren't global but careful naming is a good idea if you're designing or using an import file. I think function names can belong to namespaces now, so myLib.myFunc() might be a good pattern to use for that kind of thing.
IXix is online now   Reply With Quote
Old 07-02-2014, 02:06 PM   #21
Kite
Human being with feelings
 
Join Date: Apr 2010
Location: Portland OR
Posts: 217
Default

Getting back to the original topic...

My JSFX alt-tuner uses regXX in blocks of 5. It defaults to reg0-reg4, but you can set it to any block of 5. Register block 1 = reg0-reg4, block 2 = reg5-reg9, etc.
I don't use _global because I want my JSFX to work in other DAWs besides Reaper, so I keep everything ReaJS-compatible.
__________________
alt-tuner: a microtonal midi plug-in: www.TallKite.com/alt-tuner.html
The Kite Guitar, a playable 41-ET guitar: www.KiteGuitar.com

Last edited by Kite; 07-02-2014 at 02:14 PM.
Kite is offline   Reply With Quote
Old 12-05-2014, 12:21 PM   #22
Rubberfrog
Human being with feelings
 
Join Date: Jun 2009
Location: vancouver
Posts: 6
Default Is it possible...

Is it possible to pass globals from eel to JSFX, (maybe OSCii-bot, and WALTER(?is eel?)). I realize that that they are probably implementations of eel inside different programs, and if so that pretty well would sum up why not. but It would open up (I'm gonna call it routing )routing.

for instance say you want some way to make a dockable gui (stuck in JSFX) of dynamic midi sliders or controls(OSCII-bot,JSFX) to control Reascript sytle stuff(eel) and send the data back to the Gui.

or +walter... use osciibot or jsfx to take in my controls and pass them to an eel script actively updating variables in walter.
Rubberfrog is offline   Reply With Quote
Old 02-26-2015, 05:03 AM   #23
heda
Human being with feelings
 
heda's Avatar
 
Join Date: Jun 2012
Location: Spain
Posts: 7,215
Default

could someone put some example code of how to use _global in EEL? Where are _global variables documented?
heda is offline   Reply With Quote
Old 05-11-2020, 08:52 AM   #24
rdhoore108
Human being with feelings
 
rdhoore108's Avatar
 
Join Date: Mar 2018
Location: Belgium
Posts: 41
Default

Quote:
Originally Posted by Justin View Post
Not possible, no.

In the next build (4.5rc2), you will be able to use _global.* across instances, and regXX are mapped to _global.regXX.

[/code]
What is the mechanism behind the sharing of a global variable? Are they shared once per block, or even less often? If one sets a value, what is the maximum delay before other filters will see that value? (Would be good to add that info to the JS programming doc.)
rdhoore108 is offline   Reply With Quote
Old 05-12-2020, 05:34 AM   #25
mschnell
Human being with feelings
 
mschnell's Avatar
 
Join Date: Jun 2013
Location: Krefeld, Germany
Posts: 14,636
Default

As the global variables are shared between tracks (and the Reaper "Control" / GUI ) and all of these might use their own OS threads, and each thread does it's work as fast as it can, disregarding any synchronization between the tracks unless its necessary (at mixing points), the "musical" (i.e. sample / block number at final audio result) time at which the globals are seen from the various possible sources is completely undefined in a render (or recording) process.

That is why it's not recommended to route any audio via globals.

For "live" / realtime applications, this is a lot better, as here you need to provide enough CPU power for all processes to be done appropriately timely, and hence there will be enough synchronicity for the globals as well.

-Michael
mschnell is offline   Reply With Quote
Old 05-26-2023, 12:47 PM   #26
papagirafe
Human being with feelings
 
papagirafe's Avatar
 
Join Date: Aug 2020
Location: Brasil
Posts: 673
Default

First post in this thread, I hope it's the right one for this.
I would like to reserve a range of _globals for a video preset library I'm about to release:

_global.girafx.[my lib vars]

any future update would follow this naming convention.
papagirafe is offline   Reply With Quote
Old 05-31-2023, 10:29 AM   #27
bwsd
Human being with feelings
 
Join Date: May 2011
Location: KZ ALA
Posts: 110
Default

I would like to reserve a range of _globals for a any other variable I'm about to release:

_global.BW.[my lib vars]
_global.BW_[my lib vars]
bwsd is offline   Reply With Quote
Old 06-01-2023, 11:22 PM   #28
mschnell
Human being with feelings
 
mschnell's Avatar
 
Join Date: Jun 2013
Location: Krefeld, Germany
Posts: 14,636
Default

IMHO it would be more secure/appropriate to use at least four "speaking" letters (e.g. followed by an underscore) for reserved globals.
(AFAIU this is not case sensitive.)
-Michael
mschnell 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:27 AM.


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