How do I separate numeric parameters in jit.gen?
I have a "pak 0. 0. 0. 0. 0. 0." followed by "prepend myname" that goes into a jit.gen. Inside jit.gen I recall this using standard "param myname". The problem is that I should use something like unpack to divide the 6 numeric parameters and give them to different objects in jit.gen. Inside jit.gen there is no unpack function. How can I do it? I'd like to use only 1 param made of 6 params instead of giving 6 differents params so maybe there is less pressure on cpu...?
To add to my previous message: I’m avoiding sending the data through the standard inlet because otherwise the number of layers in the jit.gen matrix would increase to 6, and that would negatively impact the computational load; after all, I’m not working with a 6-layer matrix. So I’d like to pass the vector as numerical data. But instead of sending 6 separate parameters, I’d like to send just one, which can then be split up inside jit.gen.
You can use `swiz` to get a given component of a parameter. Since you want a 6D parameter, swizing with x/y/z/w or a/r/g/b won't be enough, you'll want to use numerical values instead. So either [swiz N] using objects or swiz(my_param, N) in codebox, N being the index of the value you want to get from the param, starting at 0.
Here is a very dumb example for illustration.
That's great, thanks! I've always used and seen patches use swiz to split data coming from the jit.gen inlet, but never from the param, so I thought it didn't work with the param.
However there is something strange here. Only codebox seems to work properly to me.
.........Patch?
Maybe i'm a bit confused. Why this patch isn't working
Yes, it seems to work. The result is the sum of the 6 parameters, which is passed as the output to each cell in the matrix; therefore, each cell does not display the value of each of the 6 parameters.
Yes, in gen (also gen~, jit.gen, jit.gl.pix, etc.), all cords going into the same inlet are summed.
If you want each cell to display the value of one component of the 6D parameter, you can do exactly what I did in my patch above: swiz the component depending on which cell is being processed.
Remainder that a jit.gen patch runs individually for each cell, hence this kind of logic, where [cell] gives you the coordinates of the cell being processed.