javascript jitter inconsistency
Hello,
I'm working on js in Jitter and trying to explore the possibilities of using js for fundamental matrix operation.
I was working on jit.op emulator and I've found some problems, so I'd like to have some advice about the correctness of my trials:
Is it possible to instantiate a jit.op as myOp = new JitterObject("jit.op") ?
if possible, how can I pass the operation type and operands? I've tried with properties
myOp.op and myOp.val without success
So I've switched to .op message of jit.matrix,
but I've found some inconsistencies. When trying to add two matrix the result is far from what expected.
This is the js code
inlets = 1;
outlets = 3;
var myMatrix1 = new JitterMatrix(1, "float32", 4, 3);
var myMatrix2 = new JitterMatrix(1, "float32", 4, 3);
var myMatrix3 = new JitterMatrix(1, "float32", 4, 3);
var myOp = new JitterObject("jit.op");
function bang() {
myMatrix1.setall(5);
myMatrix2.setall(2);
myMatrix3.setall(1);
myMatrix3.op("+", 2);
outlet(0, "jit_matrix", myMatrix1.name);
outlet(1, "jit_matrix", myMatrix2.name);
outlet(2, "jit_matrix", myMatrix3.name);
}
function mang() {
myMatrix1.setall(5);
myMatrix2.setall(2);
//myMatrix3.setall(1);
myMatrix3.op("+", myMatrix1, myMatrix2);
outlet(0, "jit_matrix", myMatrix1.name);
outlet(1, "jit_matrix", myMatrix2.name);
outlet(2, "jit_matrix", myMatrix3.name);
}
function mang doesn't work properly when adding a matrix of all 5 with a matrix of all 1, returns a matrix of all -12666317 !!!!
Any advice?
Thanks in advance
Matteo
hmmm, something appears to be broken here. I will investigate further, thanks for the report.
if you want to make progress with your experiments in the meantime, you can use Max 8.0.8, which appears to work as expected - https://cycling74.com/downloads/older
(you can have both versions of Max installed without problems, if you rename the app on Mac, or the app folder on Windows)
Thanks a lot.