Forums > Java

matrixcalc with obj with more than 1 input in Java

April 3, 2006 | 6:11 am

(Sorry ..new in Java)

I got the point in JS passing an Array of matrix trough the "matrixcalc" method for Jitter objects with more than 1 input (or output..).
But in Java what will be the syntax ?..
I’ve tried something like :
(where m m1 m2 are JitterMatrix and myobj a JitterObject)
myobj.matrixcalc(new JitterMatrix[]{m1,m2},m);
and the compiler returns :
incompatible types
found :com.cycling74.jitter.JitterObject
required :com.cycling74.jitter.JitterMatrix

I guess i’m missing the point creating an Array of JitterMatrix…
(Sorry ..new in Java)

Help !


April 3, 2006 | 11:40 pm

Hi Pascal,

I just made the following class and everything seems to be working
okay. Let me know if this code doesn’t help you.

Ben

import com.cycling74.max.*;
import com.cycling74.jitter.*;

public class matrixcalctest extends MaxObject {

JitterObject jo = new JitterObject("jit.op");

public void jit_matrix(String mname)
{
JitterMatrix out = new JitterMatrix();
JitterMatrix arr[] = new JitterMatrix[] {new JitterMatrix(), new
JitterMatrix()};
arr[0].frommatrix(mname);
arr[1].frommatrix(mname);
out.frommatrix(mname);

jo.send("op", "+");
jo.matrixcalc(arr, out);

outlet(0, "jit_matrix", out.getName());
}
}

Ben


April 3, 2006 | 11:43 pm

Without seeing more code, this doesn’t look like an error resulting
from myobj.matrixcalc(new JitterMatrix[]{m1,m2},m); since matrixcalc
(Object,Object) should accept the following input. It wouldd appear
that elsewhere you are using myobj (or some other instance of
JitterObject in place of a required JitterMatrix type). Could m1 or
m2 be JitterObject instead of JitterMatrix? Might want to post a
minimal, but similarly offending .java file for more feedback.

-Joshua


April 4, 2006 | 9:54 am

Thanks a lot ..for the precision ..and sorry for the noise.
My "JitterMatrix"..were created as behind "JitterObject"..so changing the declaration ..solve my problems..
Need to read more deeply the Jitter Java Docs..

Pascal


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