Forums > Javascript

function jit_matrix(in), how to handle it, not documented?

March 16, 2007 | 3:51 pm

hello,

i’m working with lot’s of arrays and matrixes as datastructures in
JS. with the max message size limit, it’s nice to use jitter matrixes.
i could spill them in and allocate them like that, but JS seems so
take function jit_matrix() as an input function.
how do i deal with it this way? can i copy it to a 2D array?
i’m not doing any image processing btw

thanks

isj


March 16, 2007 | 4:00 pm

Do you have an example of what you’re trying to do? Have you looked
at the Jitter/JS examples?

wes

On 3/16/07, isjtar

wrote:
> hello,
>
> i’m working with lot’s of arrays and matrixes as datastructures in
> JS. with the max message size limit, it’s nice to use jitter matrixes.
> i could spill them in and allocate them like that, but JS seems so
> take function jit_matrix() as an input function.
> how do i deal with it this way? can i copy it to a 2D array?
> i’m not doing any image processing btw
>
> thanks
>
> isj
>


March 16, 2007 | 7:41 pm

i have an array of objects (with an array in them), like this:

var net = new Array(netsize);
for (var i = 0; i < netsize; i++){
net[i] = new node(i);
}
function node(i){
this.connectArray = new Array(netsize);
}

i’d like to fill and spill them with matrixes coming from normal max.
no, didn’t check the examples *blush*, sorry, but searched the
documention pdf.
so off to check them now… at first glance i see some output, but no
input.

thanks

isjtar

Op 16-mrt-07, om 17:00 heeft Wesley Smith het volgende geschreven:

> Do you have an example of what you’re trying to do? Have you looked
> at the Jitter/JS examples?
>
> wes
>
> On 3/16/07, isjtar

wrote:
>> hello,
>>
>> i’m working with lot’s of arrays and matrixes as datastructures in
>> JS. with the max message size limit, it’s nice to use jitter
>> matrixes.
>> i could spill them in and allocate them like that, but JS seems so
>> take function jit_matrix() as an input function.
>> how do i deal with it this way? can i copy it to a 2D array?
>> i’m not doing any image processing btw
>>
>> thanks
>>
>> isj
>>


March 16, 2007 | 8:10 pm

Looks to me like you’re going to want to use the getcell and setcell
jit.matrix methods. They work just the same as in the patcher.

var mat = new JitterMatrix(1, "float32", 2, 2)
mat.setcell(0, 0, "val", 4);
var value = mat.getcell(0, 0);

wes

On 3/16/07, isjtar

wrote:
> i have an array of objects (with an array in them), like this:
>
> var net = new Array(netsize);
> for (var i = 0; i < netsize; i++){
> net[i] = new node(i);
> }
> function node(i){
> this.connectArray = new Array(netsize);
> }
>
> i’d like to fill and spill them with matrixes coming from normal max.
> no, didn’t check the examples *blush*, sorry, but searched the
> documention pdf.
> so off to check them now… at first glance i see some output, but no
> input.
>
> thanks
>
> isjtar
>
> Op 16-mrt-07, om 17:00 heeft Wesley Smith het volgende geschreven:
>
> > Do you have an example of what you’re trying to do? Have you looked
> > at the Jitter/JS examples?
> >
> > wes
> >
> > On 3/16/07, isjtar
wrote:
> >> hello,
> >>
> >> i’m working with lot’s of arrays and matrixes as datastructures in
> >> JS. with the max message size limit, it’s nice to use jitter
> >> matrixes.
> >> i could spill them in and allocate them like that, but JS seems so
> >> take function jit_matrix() as an input function.
> >> how do i deal with it this way? can i copy it to a 2D array?
> >> i’m not doing any image processing btw
> >>
> >> thanks
> >>
> >> isj
> >>
>
>


March 16, 2007 | 8:27 pm

cool, but how do i do this with matrix input?
or do i have to refer to a named matrix -i believe you can do this, no?
atmof i use js just as a different language inside max, so i haven’t
really explored the js max model world.

thanks

isjtar

Op 16-mrt-07, om 21:10 heeft Wesley Smith het volgende geschreven:

> Looks to me like you’re going to want to use the getcell and setcell
> jit.matrix methods. They work just the same as in the patcher.
>
> var mat = new JitterMatrix(1, "float32", 2, 2)
> mat.setcell(0, 0, "val", 4);
> var value = mat.getcell(0, 0);
>
> wes
>
> On 3/16/07, isjtar

wrote:
>> i have an array of objects (with an array in them), like this:
>>
>> var net = new Array(netsize);
>> for (var i = 0; i < netsize; i++){
>> net[i] = new node(i);
>> }
>> function node(i){
>> this.connectArray = new Array(netsize);
>> }
>>
>> i’d like to fill and spill them with matrixes coming from normal max.
>> no, didn’t check the examples *blush*, sorry, but searched the
>> documention pdf.
>> so off to check them now… at first glance i see some output, but no
>> input.
>>
>> thanks
>>
>> isjtar
>>
>> Op 16-mrt-07, om 17:00 heeft Wesley Smith het volgende geschreven:
>>
>> > Do you have an example of what you’re trying to do? Have you
>> looked
>> > at the Jitter/JS examples?
>> >
>> > wes
>> >
>> > On 3/16/07, isjtar
wrote:
>> >> hello,
>> >>
>> >> i’m working with lot’s of arrays and matrixes as datastructures in
>> >> JS. with the max message size limit, it’s nice to use jitter
>> >> matrixes.
>> >> i could spill them in and allocate them like that, but JS seems so
>> >> take function jit_matrix() as an input function.
>> >> how do i deal with it this way? can i copy it to a 2D array?
>> >> i’m not doing any image processing btw
>> >>
>> >> thanks
>> >>
>> >> isj
>> >>
>>
>>


March 16, 2007 | 8:31 pm

You need to have a matrix object for this, not just a name.

var mat = new JitterMatrix();

function jit_matrix(name)
{
mat.name = name;
val x = mat.getcell(0, 0);
}

something like the above should work but I wrote the code in the email
so no guarantees.

wes

On 3/16/07, isjtar

wrote:
> cool, but how do i do this with matrix input?
> or do i have to refer to a named matrix -i believe you can do this, no?
> atmof i use js just as a different language inside max, so i haven’t
> really explored the js max model world.
>
> thanks
>
> isjtar
>
> Op 16-mrt-07, om 21:10 heeft Wesley Smith het volgende geschreven:
>
> > Looks to me like you’re going to want to use the getcell and setcell
> > jit.matrix methods. They work just the same as in the patcher.
> >
> > var mat = new JitterMatrix(1, "float32", 2, 2)
> > mat.setcell(0, 0, "val", 4);
> > var value = mat.getcell(0, 0);
> >
> > wes
> >
> > On 3/16/07, isjtar
wrote:
> >> i have an array of objects (with an array in them), like this:
> >>
> >> var net = new Array(netsize);
> >> for (var i = 0; i < netsize; i++){
> >> net[i] = new node(i);
> >> }
> >> function node(i){
> >> this.connectArray = new Array(netsize);
> >> }
> >>
> >> i’d like to fill and spill them with matrixes coming from normal max.
> >> no, didn’t check the examples *blush*, sorry, but searched the
> >> documention pdf.
> >> so off to check them now… at first glance i see some output, but no
> >> input.
> >>
> >> thanks
> >>
> >> isjtar
> >>
> >> Op 16-mrt-07, om 17:00 heeft Wesley Smith het volgende geschreven:
> >>
> >> > Do you have an example of what you’re trying to do? Have you
> >> looked
> >> > at the Jitter/JS examples?
> >> >
> >> > wes
> >> >
> >> > On 3/16/07, isjtar
wrote:
> >> >> hello,
> >> >>
> >> >> i’m working with lot’s of arrays and matrixes as datastructures in
> >> >> JS. with the max message size limit, it’s nice to use jitter
> >> >> matrixes.
> >> >> i could spill them in and allocate them like that, but JS seems so
> >> >> take function jit_matrix() as an input function.
> >> >> how do i deal with it this way? can i copy it to a 2D array?
> >> >> i’m not doing any image processing btw
> >> >>
> >> >> thanks
> >> >>
> >> >> isj
> >> >>
> >>
> >>
>
>


March 16, 2007 | 8:50 pm

ok, got it, so i can get matrixes in, then use the virtual (well you
know what i mean) matrix object to link and parse it.
i’ll try it later on, thanks!
isj

Op 16-mrt-07, om 21:31 heeft Wesley Smith het volgende geschreven:

> You need to have a matrix object for this, not just a name.
>
> var mat = new JitterMatrix();
>
> function jit_matrix(name)
> {
> mat.name = name;
> val x = mat.getcell(0, 0);
> }
>
> something like the above should work but I wrote the code in the email
> so no guarantees.
>
> wes
>
> On 3/16/07, isjtar

wrote:
>> cool, but how do i do this with matrix input?
>> or do i have to refer to a named matrix -i believe you can do
>> this, no?
>> atmof i use js just as a different language inside max, so i haven’t
>> really explored the js max model world.
>>
>> thanks
>>
>> isjtar
>>
>> Op 16-mrt-07, om 21:10 heeft Wesley Smith het volgende geschreven:
>>
>> > Looks to me like you’re going to want to use the getcell and
>> setcell
>> > jit.matrix methods. They work just the same as in the patcher.
>> >
>> > var mat = new JitterMatrix(1, "float32", 2, 2)
>> > mat.setcell(0, 0, "val", 4);
>> > var value = mat.getcell(0, 0);
>> >
>> > wes
>> >
>> > On 3/16/07, isjtar
wrote:
>> >> i have an array of objects (with an array in them), like this:
>> >>
>> >> var net = new Array(netsize);
>> >> for (var i = 0; i < netsize; i++){
>> >> net[i] = new node(i);
>> >> }
>> >> function node(i){
>> >> this.connectArray = new Array(netsize);
>> >> }
>> >>
>> >> i’d like to fill and spill them with matrixes coming from
>> normal max.
>> >> no, didn’t check the examples *blush*, sorry, but searched the
>> >> documention pdf.
>> >> so off to check them now… at first glance i see some output,
>> but no
>> >> input.
>> >>
>> >> thanks
>> >>
>> >> isjtar
>> >>
>> >> Op 16-mrt-07, om 17:00 heeft Wesley Smith het volgende geschreven:
>> >>
>> >> > Do you have an example of what you’re trying to do? Have you
>> >> looked
>> >> > at the Jitter/JS examples?
>> >> >
>> >> > wes
>> >> >
>> >> > On 3/16/07, isjtar
wrote:
>> >> >> hello,
>> >> >>
>> >> >> i’m working with lot’s of arrays and matrixes as
>> datastructures in
>> >> >> JS. with the max message size limit, it’s nice to use jitter
>> >> >> matrixes.
>> >> >> i could spill them in and allocate them like that, but JS
>> seems so
>> >> >> take function jit_matrix() as an input function.
>> >> >> how do i deal with it this way? can i copy it to a 2D array?
>> >> >> i’m not doing any image processing btw
>> >> >>
>> >> >> thanks
>> >> >>
>> >> >> isj
>> >> >>
>> >>
>> >>
>>
>>


March 18, 2007 | 12:23 pm

i got it to work with some fiddling : )
still, this strikes me as the only part of max which isn’t documented
at all.
am i missing something or is it in the pipeline?
xj

On Mar 16, 2007, at 9:50 PM, isjtar wrote:

> ok, got it, so i can get matrixes in, then use the virtual (well
> you know what i mean) matrix object to link and parse it.
> i’ll try it later on, thanks!
> isj
>
> Op 16-mrt-07, om 21:31 heeft Wesley Smith het volgende geschreven:
>
>> You need to have a matrix object for this, not just a name.
>>
>> var mat = new JitterMatrix();
>>
>> function jit_matrix(name)
>> {
>> mat.name = name;
>> val x = mat.getcell(0, 0);
>> }
>>
>> something like the above should work but I wrote the code in the
>> email
>> so no guarantees.
>>
>> wes
>>
>> On 3/16/07, isjtar

wrote:
>>> cool, but how do i do this with matrix input?
>>> or do i have to refer to a named matrix -i believe you can do
>>> this, no?
>>> atmof i use js just as a different language inside max, so i haven’t
>>> really explored the js max model world.
>>>
>>> thanks
>>>
>>> isjtar
>>>
>>> Op 16-mrt-07, om 21:10 heeft Wesley Smith het volgende geschreven:
>>>
>>> > Looks to me like you’re going to want to use the getcell and
>>> setcell
>>> > jit.matrix methods. They work just the same as in the patcher.
>>> >
>>> > var mat = new JitterMatrix(1, "float32", 2, 2)
>>> > mat.setcell(0, 0, "val", 4);
>>> > var value = mat.getcell(0, 0);
>>> >
>>> > wes
>>> >
>>> > On 3/16/07, isjtar
wrote:
>>> >> i have an array of objects (with an array in them), like this:
>>> >>
>>> >> var net = new Array(netsize);
>>> >> for (var i = 0; i < netsize; i++){
>>> >> net[i] = new node(i);
>>> >> }
>>> >> function node(i){
>>> >> this.connectArray = new Array(netsize);
>>> >> }
>>> >>
>>> >> i’d like to fill and spill them with matrixes coming from
>>> normal max.
>>> >> no, didn’t check the examples *blush*, sorry, but searched the
>>> >> documention pdf.
>>> >> so off to check them now… at first glance i see some output,
>>> but no
>>> >> input.
>>> >>
>>> >> thanks
>>> >>
>>> >> isjtar
>>> >>
>>> >> Op 16-mrt-07, om 17:00 heeft Wesley Smith het volgende
>>> geschreven:
>>> >>
>>> >> > Do you have an example of what you’re trying to do? Have you
>>> >> looked
>>> >> > at the Jitter/JS examples?
>>> >> >
>>> >> > wes
>>> >> >
>>> >> > On 3/16/07, isjtar
wrote:
>>> >> >> hello,
>>> >> >>
>>> >> >> i’m working with lot’s of arrays and matrixes as
>>> datastructures in
>>> >> >> JS. with the max message size limit, it’s nice to use jitter
>>> >> >> matrixes.
>>> >> >> i could spill them in and allocate them like that, but JS
>>> seems so
>>> >> >> take function jit_matrix() as an input function.
>>> >> >> how do i deal with it this way? can i copy it to a 2D array?
>>> >> >> i’m not doing any image processing btw
>>> >> >>
>>> >> >> thanks
>>> >> >>
>>> >> >> isj
>>> >> >>
>>> >>
>>> >>
>>>
>>>
>


March 18, 2007 | 7:15 pm

I think the key is understanding what a Jitter object has (attributes
and methods) and how to itnerface with JS to those attributes and
methods. The second step is translating that understanding into how
to accomplish a particular task. In your case it was how can I access
matrix data that’s outside my script. The answer is using a named
matrix which means creating a matrix object with the same name in JS
just like you would in a patch. The concepts are documented in the
Jitter HTML ref, akk that needs to be done is to mentally translate
that information to what you know about how Jitter objects interface
with JS. that’s how I think about it at least.

wes

On 3/18/07, isjtar

wrote:
> i got it to work with some fiddling : )
> still, this strikes me as the only part of max which isn’t documented
> at all.
> am i missing something or is it in the pipeline?
> xj
>
> On Mar 16, 2007, at 9:50 PM, isjtar wrote:
>
> > ok, got it, so i can get matrixes in, then use the virtual (well
> > you know what i mean) matrix object to link and parse it.
> > i’ll try it later on, thanks!
> > isj
> >
> > Op 16-mrt-07, om 21:31 heeft Wesley Smith het volgende geschreven:
> >
> >> You need to have a matrix object for this, not just a name.
> >>
> >> var mat = new JitterMatrix();
> >>
> >> function jit_matrix(name)
> >> {
> >> mat.name = name;
> >> val x = mat.getcell(0, 0);
> >> }
> >>
> >> something like the above should work but I wrote the code in the
> >> email
> >> so no guarantees.
> >>
> >> wes
> >>
> >> On 3/16/07, isjtar
wrote:
> >>> cool, but how do i do this with matrix input?
> >>> or do i have to refer to a named matrix -i believe you can do
> >>> this, no?
> >>> atmof i use js just as a different language inside max, so i haven’t
> >>> really explored the js max model world.
> >>>
> >>> thanks
> >>>
> >>> isjtar
> >>>
> >>> Op 16-mrt-07, om 21:10 heeft Wesley Smith het volgende geschreven:
> >>>
> >>> > Looks to me like you’re going to want to use the getcell and
> >>> setcell
> >>> > jit.matrix methods. They work just the same as in the patcher.
> >>> >
> >>> > var mat = new JitterMatrix(1, "float32", 2, 2)
> >>> > mat.setcell(0, 0, "val", 4);
> >>> > var value = mat.getcell(0, 0);
> >>> >
> >>> > wes
> >>> >
> >>> > On 3/16/07, isjtar
wrote:
> >>> >> i have an array of objects (with an array in them), like this:
> >>> >>
> >>> >> var net = new Array(netsize);
> >>> >> for (var i = 0; i < netsize; i++){
> >>> >> net[i] = new node(i);
> >>> >> }
> >>> >> function node(i){
> >>> >> this.connectArray = new Array(netsize);
> >>> >> }
> >>> >>
> >>> >> i’d like to fill and spill them with matrixes coming from
> >>> normal max.
> >>> >> no, didn’t check the examples *blush*, sorry, but searched the
> >>> >> documention pdf.
> >>> >> so off to check them now… at first glance i see some output,
> >>> but no
> >>> >> input.
> >>> >>
> >>> >> thanks
> >>> >>
> >>> >> isjtar
> >>> >>
> >>> >> Op 16-mrt-07, om 17:00 heeft Wesley Smith het volgende
> >>> geschreven:
> >>> >>
> >>> >> > Do you have an example of what you’re trying to do? Have you
> >>> >> looked
> >>> >> > at the Jitter/JS examples?
> >>> >> >
> >>> >> > wes
> >>> >> >
> >>> >> > On 3/16/07, isjtar
wrote:
> >>> >> >> hello,
> >>> >> >>
> >>> >> >> i’m working with lot’s of arrays and matrixes as
> >>> datastructures in
> >>> >> >> JS. with the max message size limit, it’s nice to use jitter
> >>> >> >> matrixes.
> >>> >> >> i could spill them in and allocate them like that, but JS
> >>> seems so
> >>> >> >> take function jit_matrix() as an input function.
> >>> >> >> how do i deal with it this way? can i copy it to a 2D array?
> >>> >> >> i’m not doing any image processing btw
> >>> >> >>
> >>> >> >> thanks
> >>> >> >>
> >>> >> >> isj
> >>> >> >>
> >>> >>
> >>> >>
> >>>
> >>>
> >
>
>


March 18, 2007 | 8:01 pm

yes, you’re right and it’s not unreasonable. but then on the other
hand max is often credited for having excellent documentation, it
seems that there is a need for bringing all knowledge together -if
not explicitely then at least explaining the method. for example in
my js .pdf there are a number of reserve function keywords, but
jit_matrix() isn’t one of them.
i don’t mind asking helpful people as yourself for some advice, i was
just thinking of the max-msp workshops i’m teaching later this month.

best

isjtar
On Mar 18, 2007, at 8:15 PM, Wesley Smith wrote:

> I think the key is understanding what a Jitter object has (attributes
> and methods) and how to itnerface with JS to those attributes and
> methods. The second step is translating that understanding into how
> to accomplish a particular task. In your case it was how can I access
> matrix data that’s outside my script. The answer is using a named
> matrix which means creating a matrix object with the same name in JS
> just like you would in a patch. The concepts are documented in the
> Jitter HTML ref, akk that needs to be done is to mentally translate
> that information to what you know about how Jitter objects interface
> with JS. that’s how I think about it at least.
>
> wes
>
> On 3/18/07, isjtar

wrote:
>> i got it to work with some fiddling : )
>> still, this strikes me as the only part of max which isn’t documented
>> at all.
>> am i missing something or is it in the pipeline?
>> xj
>>
>> On Mar 16, 2007, at 9:50 PM, isjtar wrote:
>>
>> > ok, got it, so i can get matrixes in, then use the virtual (well
>> > you know what i mean) matrix object to link and parse it.
>> > i’ll try it later on, thanks!
>> > isj
>> >
>> > Op 16-mrt-07, om 21:31 heeft Wesley Smith het volgende geschreven:
>> >
>> >> You need to have a matrix object for this, not just a name.
>> >>
>> >> var mat = new JitterMatrix();
>> >>
>> >> function jit_matrix(name)
>> >> {
>> >> mat.name = name;
>> >> val x = mat.getcell(0, 0);
>> >> }
>> >>
>> >> something like the above should work but I wrote the code in the
>> >> email
>> >> so no guarantees.
>> >>
>> >> wes
>> >>
>> >> On 3/16/07, isjtar
wrote:
>> >>> cool, but how do i do this with matrix input?
>> >>> or do i have to refer to a named matrix -i believe you can do
>> >>> this, no?
>> >>> atmof i use js just as a different language inside max, so i
>> haven’t
>> >>> really explored the js max model world.
>> >>>
>> >>> thanks
>> >>>
>> >>> isjtar
>> >>>
>> >>> Op 16-mrt-07, om 21:10 heeft Wesley Smith het volgende
>> geschreven:
>> >>>
>> >>> > Looks to me like you’re going to want to use the getcell and
>> >>> setcell
>> >>> > jit.matrix methods. They work just the same as in the patcher.
>> >>> >
>> >>> > var mat = new JitterMatrix(1, "float32", 2, 2)
>> >>> > mat.setcell(0, 0, "val", 4);
>> >>> > var value = mat.getcell(0, 0);
>> >>> >
>> >>> > wes
>> >>> >
>> >>> > On 3/16/07, isjtar
wrote:
>> >>> >> i have an array of objects (with an array in them), like this:
>> >>> >>
>> >>> >> var net = new Array(netsize);
>> >>> >> for (var i = 0; i < netsize; i++){
>> >>> >> net[i] = new node(i);
>> >>> >> }
>> >>> >> function node(i){
>> >>> >> this.connectArray = new Array(netsize);
>> >>> >> }
>> >>> >>
>> >>> >> i’d like to fill and spill them with matrixes coming from
>> >>> normal max.
>> >>> >> no, didn’t check the examples *blush*, sorry, but searched the
>> >>> >> documention pdf.
>> >>> >> so off to check them now… at first glance i see some output,
>> >>> but no
>> >>> >> input.
>> >>> >>
>> >>> >> thanks
>> >>> >>
>> >>> >> isjtar
>> >>> >>
>> >>> >> Op 16-mrt-07, om 17:00 heeft Wesley Smith het volgende
>> >>> geschreven:
>> >>> >>
>> >>> >> > Do you have an example of what you’re trying to do? Have
>> you
>> >>> >> looked
>> >>> >> > at the Jitter/JS examples?
>> >>> >> >
>> >>> >> > wes
>> >>> >> >
>> >>> >> > On 3/16/07, isjtar
wrote:
>> >>> >> >> hello,
>> >>> >> >>
>> >>> >> >> i’m working with lot’s of arrays and matrixes as
>> >>> datastructures in
>> >>> >> >> JS. with the max message size limit, it’s nice to use
>> jitter
>> >>> >> >> matrixes.
>> >>> >> >> i could spill them in and allocate them like that, but JS
>> >>> seems so
>> >>> >> >> take function jit_matrix() as an input function.
>> >>> >> >> how do i deal with it this way? can i copy it to a 2D
>> array?
>> >>> >> >> i’m not doing any image processing btw
>> >>> >> >>
>> >>> >> >> thanks
>> >>> >> >>
>> >>> >> >> isj
>> >>> >> >>
>> >>> >>
>> >>> >>
>> >>>
>> >>>
>> >
>>
>>


March 18, 2007 | 8:15 pm

Ah. jit_matrix isn’t a special method at all. That’s how matrices are
actually passed around the patch and this *is* documented. In the JS
PDF it states how to call JS functions from the patch. You name a
function and set it a message of the same name with arguments to
follow. jit_matrix is a convention but the name could be arbitrary.
If you hook a print up to the outlet of a matrix object, you’ll see
jit_matrix u398439843 or something like that. The first part of the
message triggers a function call (jit_matrix) and the u398439843 is
the argument. You could actually change this to
matrix_matrix_matrix_matrix u398439843 and crete a function in JS
called matrix_matrix_matrix_matrix and then have the same process
inside the function and things would be no different.

#P toggle 84 46 15 0;
#P window setfont "Sans Serif" 9.;
#P window linecount 1;
#P newex 84 67 27 196617 + 1;
#P button 121 46 15 0;
#P user jit.pwindow 128 200 82 62 0 1 0 0 1 0;
#P user jit.pwindow 42 200 82 62 0 1 0 0 1 0;
#P newex 121 113 251 196617 substitute jit_matrix matrix_matrix_matrix_matrix;
#P newex 84 92 47 196617 gate 2 1;
#P newex 121 66 105 196617 jit.matrix 1 char 4 4;
#P newex 121 142 89 196617 js MatrixName.js;
#P fasten 1 0 4 0 126 88 48 88;
#P connect 8 0 7 0;
#P connect 7 0 2 0;
#P connect 6 0 1 0;
#P connect 1 0 2 1;
#P connect 2 1 3 0;
#P fasten 2 0 0 0 89 135 126 135;
#P connect 3 0 0 0;
#P fasten 0 0 5 0 126 187 134 187;
#P window clipboard copycount 9;

——————————————MatrixName.js
var mat1 = new JitterMatrix()
var mat2 = new JitterMatrix()

function jit_matrix(name)
{
post("jit_matrixn")
mat1.name = name
mat1.setcell(0, 0, "val", 255)
outlet(0, "jit_matrix", mat1.name)
}

function matrix_matrix_matrix_matrix(name)
{
post("matrix_matrix_matrix_matrixn")
mat2.name = name
mat2.setcell(0, 0, "val", 255)
outlet(0, "jit_matrix", mat2.name)
}


March 18, 2007 | 10:31 pm

ah, missed that, thanks for clearing it up.
On Mar 18, 2007, at 9:15 PM, Wesley Smith wrote:

> Ah. jit_matrix isn’t a special method at all. That’s how matrices are
> actually passed around the patch and this *is* documented. In the JS
> PDF it states how to call JS functions from the patch. You name a
> function and set it a message of the same name with arguments to
> follow. jit_matrix is a convention but the name could be arbitrary.
> If you hook a print up to the outlet of a matrix object, you’ll see
> jit_matrix u398439843 or something like that. The first part of the
> message triggers a function call (jit_matrix) and the u398439843 is
> the argument. You could actually change this to
> matrix_matrix_matrix_matrix u398439843 and crete a function in JS
> called matrix_matrix_matrix_matrix and then have the same process
> inside the function and things would be no different.
>
> #P toggle 84 46 15 0;
> #P window setfont "Sans Serif" 9.;
> #P window linecount 1;
> #P newex 84 67 27 196617 + 1;
> #P button 121 46 15 0;
> #P user jit.pwindow 128 200 82 62 0 1 0 0 1 0;
> #P user jit.pwindow 42 200 82 62 0 1 0 0 1 0;
> #P newex 121 113 251 196617 substitute jit_matrix
> matrix_matrix_matrix_matrix;
> #P newex 84 92 47 196617 gate 2 1;
> #P newex 121 66 105 196617 jit.matrix 1 char 4 4;
> #P newex 121 142 89 196617 js MatrixName.js;
> #P fasten 1 0 4 0 126 88 48 88;
> #P connect 8 0 7 0;
> #P connect 7 0 2 0;
> #P connect 6 0 1 0;
> #P connect 1 0 2 1;
> #P connect 2 1 3 0;
> #P fasten 2 0 0 0 89 135 126 135;
> #P connect 3 0 0 0;
> #P fasten 0 0 5 0 126 187 134 187;
> #P window clipboard copycount 9;
>
>
>
>
> ——————————————MatrixName.js
> var mat1 = new JitterMatrix()
> var mat2 = new JitterMatrix()
>
> function jit_matrix(name)
> {
> post("jit_matrixn")
> mat1.name = name
> mat1.setcell(0, 0, "val", 255)
> outlet(0, "jit_matrix", mat1.name)
> }
>
> function matrix_matrix_matrix_matrix(name)
> {
> post("matrix_matrix_matrix_matrixn")
> mat2.name = name
> mat2.setcell(0, 0, "val", 255)
> outlet(0, "jit_matrix", mat2.name)
> }


Viewing 12 posts - 1 through 12 (of 12 total)