jitter javascript object & method reference?

Nadav Assor's icon

hi there, sorry for the oh-so-very-basic-question, but i searched for quite a while through the forums, lists and documentation and couldn't find it. Is there some kind of reference document containing the javascript object names and methods for all the jitter objects, including global methods etc.? Or does it always follow exactly the same syntax as the normal max messages? For example if I want to instantiate a new jit.scissors object called "myscissors", and assign it a certain number of rows and columnss, will I access them via "myscissors.columns" , etc.? Also same question for the jit.gl objects?
Sorry if I didn't use the proper phrasing, getting a bit rusty on my javascript...
thanks,
-Nadav

yair reshef's icon

i think what is needed here is a way to "call" scissors.out1, out2 etc. and
assign this different outputs to different matrix. i too haven't found a way
to achieve this.
maybe its beyond current state of jitter-js.
guess the problem is how to handle objects with more then one matrix outlet
inside js.
now either we get a syntax or a no.

On 1/19/07, Nadav Assor wrote:
>
>
> hi there, sorry for the oh-so-very-basic-question, but i searched for
> quite a while through the forums, lists and documentation and couldn't find
> it. Is there some kind of reference document containing the javascript
> object names and methods for all the jitter objects, including global
> methods etc.? Or does it always follow exactly the same syntax as the normal
> max messages? For example if I want to instantiate a new jit.scissorsobject called "myscissors", and assign it a certain number of rows and
> columnss, will I access them via "myscissors.columns" , etc.? Also same
> question for the jit.gl objects?
> Sorry if I didn't use the proper phrasing, getting a bit rusty on my
> javascript...
> thanks,
> -Nadav
>

phreakhead's icon

I think you can specify multiple input and output matrices by putting them in an array:

scissors.matrixcalc(inMatrix, [outMatrix1, outMatrix2]);

However, I've never gotten to actually work, and the moderators seem to be pretty good at avoiding these kinds of questions... maybe JavaScript will get better in future releases, but they seem to be concentrating on new features and UI stuff for Max 5 instead of the basics like a working programming environment.

Maxtréal's icon

I'm also interested of a "Completed Jitter object & method reference for javascript".

I have found this usefull one for Max/MSP but it does'nt include infos for jitter. (look in attachement)

Does it exist ?

dtr's icon

Thread resurrection...

Is there a Max / Jitter javascript reference? Have searched extensively but can't find it.

timtation's icon

i started to write one, but its still incomplete...

Max Gardener's icon

You may also find some helpful information on the Cycling '74 Wiki: https://cycling74.com/wiki/index.php?title=Category:Javascript_In_Max_Docs

mirrorboy's icon

>timtation
It 's good work!

thouldcroft's icon

I'm having issues with the same problem Nadav Assor is having! I have been using JavaScript with Jitter for the past few months, essentially learning both simultaneously (probably not the smartest thing to do, but using JavaScript with Jitter makes more sense to me as I have a background in Matlab/C). I have been using JavaScript because I had been implementing a lot of functions that have to scan through matrices, and it made sense to me to use for() loops. As the patch got more complex, the for() loops began to take their toll, so now I'm trying to optimize the code by calling Jitter built in functions and matrix operations. I have gotten most things to work through trial and error (for example, jit.op with a comparison object was not working, but jit.expr with the expr "in < 1" for example does work).

So I was surprised to find an object that was straighforward like jit.scissors to not work in JavaScript as well. I had assumed that with code such as the following would properly implement jit.scissors:

var jitscissors = new JitterObject( jit.scissors);

var jitscissors.columns = 2;
var jitscissors.rows = 2;

var mymatrix = new JitterMatrix(1, char, 80, 60 );

var mymatrix_chunk1 = new JitterMatrix(1, char, 80/2, 60/2);
var mymatrix_chunk2 = new JitterMatrix(1, char, 80/2, 60/2);
var mymatrix_chunk3 = new JitterMatrix(1, char, 80/2, 60/2);
var mymatrix_chunk4 = new JitterMatrix(1, char, 80/2, 60/2);

jitscissors.matrixcalc( mymatrix, [mymatrix_chunk1, mymatrix_chunk2, mymatrix_chunk3, mymatrix_chunk4 ];

I then try to get the average of one of those chunks from an instantiated jit.3m object, and I get the following error message:

"matrix array argument not valid matrix or matrixname"

Can anyone explain why I am getting this error? I seem to be getting this message while the actual function is working (as reported from post() ). Maybe my problem actually lies with jit.3m??

timtation's icon

there is a brace missing at the end of the array:

jitscissors.matrixcalc( mymatrix, [mymatrix_chunk1, mymatrix_chunk2, mymatrix_chunk3, mymatrix_chunk4 ] ) ;

didn't tested it, but it looks like it could work.