Old 05-09-2017, 12:11 AM   #1
reapercurious
Human being with feelings
 
reapercurious's Avatar
 
Join Date: Jul 2007
Posts: 1,890
Default functions, instances, private variables JSFX

I'm wondering if it would be possible to dynamically create several function instances with private variables.

example, a multichannel vu meter that detects the number of channels on a track and creates that many meters.
reapercurious is offline   Reply With Quote
Old 05-09-2017, 03:31 AM   #2
junh1024
Human being with feelings
 
Join Date: Feb 2014
Posts: 240
Default

Have u had a look @ https://stash.reaper.fm/v/5535/S%26M%...VU%20meter.zip ?
junh1024 is offline   Reply With Quote
Old 05-09-2017, 04:28 AM   #3
reapercurious
Human being with feelings
 
reapercurious's Avatar
 
Join Date: Jul 2007
Posts: 1,890
Default

that's really cool, i will give it a closer look. looking for a way to create one function with private variables that can somehow be instantiated by looping through all the used channels, to keep the code as short as possible.
reapercurious is offline   Reply With Quote
Old 05-09-2017, 05:55 AM   #4
IXix
Human being with feelings
 
Join Date: Jan 2007
Location: mcr:uk
Posts: 3,889
Default

Quote:
Originally Posted by reapercurious View Post
looking for a way to create one function with private variables that can somehow be instantiated by looping through all the used channels, to keep the code as short as possible.
AFAIK there's no way to determine how many channels are in use. Also JSFX is not dynamic, in that all code paths are determined when the script is loaded and compiled. There's no way to spawn new variables once the effect is running.

The closest you can get is to manage data in the effect memory, using it to represent objects.
IXix is offline   Reply With Quote
Old 05-09-2017, 05:59 AM   #5
James HE
Human being with feelings
 
James HE's Avatar
 
Join Date: Mar 2007
Location: I'm in a barn
Posts: 4,467
Default

Quote:
Originally Posted by IXix View Post
AFAIK there's no way to determine how many channels are in use.
actually you can

Quote:
num_ch
Context: most contexts (see comments)
Usage: read-only
Specifies the number of channels available (usually 2). Note however splXX are still available even if this count is less, their inputs/outputs are just ignored. You can change the channel count available via in_pin:/out_pin: lines.
James HE is offline   Reply With Quote
Old 05-10-2017, 01:39 AM   #6
IXix
Human being with feelings
 
Join Date: Jan 2007
Location: mcr:uk
Posts: 3,889
Default

Quote:
Originally Posted by James HE View Post
actually you can
Hmmm, I think I might have known that at some point in the past. I stand righteously corrected.

I'm pretty confident about the non-dynamic code thing I said though. It sounded very knowledgeable.
IXix 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 06:06 AM.


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