Old 06-20-2021, 02:24 AM   #1
dsyrock
Human being with feelings
 
dsyrock's Avatar
 
Join Date: Sep 2018
Location: China
Posts: 565
Default How to set pin map in jsfx?


Let's say this is slider1, and when I select 3|4, it will set channel 3 and 4 on and 56, 78, 910 off, and so on. Is it possible?

Code:
slider1: 0<0,3,1{3 | 4,5 | 6,7 | 8,9 | 10}>Side Channel
Attached Images
File Type: png oP0947V07u.png (2.3 KB, 327 views)
dsyrock is offline   Reply With Quote
Old 06-20-2021, 02:30 AM   #2
mschnell
Human being with feelings
 
mschnell's Avatar
 
Join Date: Jun 2013
Location: Krefeld, Germany
Posts: 14,688
Default

in @slider something like
c0 = 2*slider1;
c1 = c0+1;

in @sample something lile
spl0 = spl[c0];spl1 = spl[c1];
-Michael

Last edited by mschnell; 06-20-2021 at 10:21 PM.
mschnell is offline   Reply With Quote
Old 06-20-2021, 07:59 AM   #3
dsyrock
Human being with feelings
 
dsyrock's Avatar
 
Join Date: Sep 2018
Location: China
Posts: 565
Default

Quote:
Originally Posted by mschnell View Post
in @slider something lile
c0 = 2*slider1;
c1 = c0+1;

in @sample something lile
spl0 = spl[c0];spl0 = spl[c1];
-Michael
Thanks for your answer. But seems like it passes the signal to the 1|2 channel.
What I want is turn on channel 3|4, or 5|6, or 7|8, and so on
Attached Images
File Type: gif CnlbxDbqB0.gif (18.4 KB, 294 views)
dsyrock is offline   Reply With Quote
Old 06-20-2021, 08:06 AM   #4
schwa
Administrator
 
schwa's Avatar
 
Join Date: Mar 2007
Location: NY
Posts: 15,750
Default

There are actually jsfx functions to do this, although I don't think they have made it to the online documentation yet. You can look at the JS Utility/channel_mapper for example usage.

Code:
        get_host_numchan(no parameters)
Get the number of track or media item take channels

        set_host_numchan(numchan)
Set the number of track or media item take channels. only valid in @gfx section

        get_pin_mapping(inout,pin,startchan,chanmask)
Get a bitfield (maximum 32 bits) representing the channel mappings for this pin

        set_pin_mapping(inout,pin,startchan,chanmask,mapping)
Set the channel mappings for this pin/startchan/chanmask. only valid in @gfx section

        get_pinmapper_flags(no parameters)
Get the pinmapper flags for this fx. !&1=pass through unmapped output channels, &1=zero out unmapped output channels

        set_pinmapper_flags(flags)
Set the pinmapper flags for this fx. see get_pinmapper_flags. only valid in @gfx section

Last edited by schwa; 06-20-2021 at 08:11 AM.
schwa is offline   Reply With Quote
Old 06-20-2021, 09:43 AM   #5
dsyrock
Human being with feelings
 
dsyrock's Avatar
 
Join Date: Sep 2018
Location: China
Posts: 565
Default

Quote:
Originally Posted by schwa View Post
There are actually jsfx functions to do this, although I don't think they have made it to the online documentation yet. You can look at the JS Utility/channel_mapper for example usage.

Code:
        get_host_numchan(no parameters)
Get the number of track or media item take channels

        set_host_numchan(numchan)
Set the number of track or media item take channels. only valid in @gfx section

        get_pin_mapping(inout,pin,startchan,chanmask)
Get a bitfield (maximum 32 bits) representing the channel mappings for this pin

        set_pin_mapping(inout,pin,startchan,chanmask,mapping)
Set the channel mappings for this pin/startchan/chanmask. only valid in @gfx section

        get_pinmapper_flags(no parameters)
Get the pinmapper flags for this fx. !&1=pass through unmapped output channels, &1=zero out unmapped output channels

        set_pinmapper_flags(flags)
Set the pinmapper flags for this fx. see get_pinmapper_flags. only valid in @gfx section
Wow, hidden api huh! Thanks, it works! I don't quite understand what chanmask means, but keeping it -1 is ok, as what Channel Mapper does.

Last edited by dsyrock; 06-20-2021 at 09:54 AM.
dsyrock is offline   Reply With Quote
Old 06-20-2021, 10:03 AM   #6
dsyrock
Human being with feelings
 
dsyrock's Avatar
 
Join Date: Sep 2018
Location: China
Posts: 565
Default

Quote:
Originally Posted by schwa View Post
Code:
    
        get_pin_mapping(inout,pin,startchan,chanmask)
Get a bitfield (maximum 32 bits) representing the channel mappings for this pin

        set_pin_mapping(inout,pin,startchan,chanmask,mapping)
Set the channel mappings for this pin/startchan/chanmask. only valid in @gfx section

        get_pinmapper_flags(no parameters)
Get the pinmapper flags for this fx. !&1=pass through unmapped output channels, &1=zero out unmapped output channels

        set_pinmapper_flags(flags)
Set the pinmapper flags for this fx. see get_pinmapper_flags. only valid in @gfx section
Turns out that this four can use in @slider section too.
dsyrock is offline   Reply With Quote
Old 06-20-2021, 10:20 PM   #7
mschnell
Human being with feelings
 
mschnell's Avatar
 
Join Date: Jun 2013
Location: Krefeld, Germany
Posts: 14,688
Default

Quote:
Originally Posted by dsyrock View Post
Thanks for your answer. But...
Typo: I meant to write:
spl0 = spl[c0];spl1 = spl[c1];

[corrected above]
-Michael
mschnell is offline   Reply With Quote
Old 06-21-2021, 01:01 PM   #8
mschnell
Human being with feelings
 
mschnell's Avatar
 
Join Date: Jun 2013
Location: Krefeld, Germany
Posts: 14,688
Default

Quote:
Originally Posted by dsyrock View Post
get_host_numchan(no parameters)
And friends...
That is interseting, indeed,
-Michael
mschnell is offline   Reply With Quote
Old 07-01-2021, 07:22 PM   #9
Time Waster
Human being with feelings
 
Time Waster's Avatar
 
Join Date: Aug 2013
Location: Bowral, Australia
Posts: 1,638
Default

Is the documentation ever going to get updated? How much other secret stuff is there?
__________________
Mal, aka The Wasters of Time
Mal's JSFX: ReaRack2 Modular Synth
Time Waster is offline   Reply With Quote
Old 11-22-2021, 03:46 PM   #10
ashcat_lt
Human being with feelings
 
Join Date: Dec 2012
Posts: 7,272
Default

What are the actual arguments for
get_pin_mapping(inout,pin,startchan,chanmask)
???
How many are required and what kinds of values should they have?


I want to make decisions based on which output pins are actually mapped. Basically, each one will be doing its own calculation, but I'd rather not run the ones that aren't actually being used.


Edit - Well, I figured out what I actually need for this specifically. inout should be 0 for input pins and 1 for output pins. pin seems to be the channel number (starting on 0), like the x in spl(x). Leaving the rest as 0 seems to work fine. If it returns not 0, I do what I do. Still interested to know about the rest, though!

Edit again - But it only seems to go up to 32. In order to get past that, we have to increment startchan. (???)

Last edited by ashcat_lt; 11-22-2021 at 05:06 PM.
ashcat_lt 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 05:34 PM.


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