How to get dimension of jit.movie in Java/MXJ?
Hi,
In Java, after I've created a jit.movie, with:
JitterObject movie = new JitterObject("jit.movie");
...I can't query its dimensions. If I'd write:
dims = movie.getAttr("dim");
then dims just becomes null.
Querying other attributes is no problem at all, but dims specifically is weird.
Is this the expected behaviour? How do I find out the dimensions of my movie?
thanks -t
I think the dimensions are an array. So it should be something like: int dims [] = movie.getAttr("dim"); . Also I believe you can also use the function: movie.getDim();
Thanks Timo,
Yes, the dimensions should be an array. When I run the .getAttr("dim") or indeed the .getDim() method on a JitterMatrix, I get the expected result. However, this doesn't work for JitterObject objects within Java.
I'm not entirely sure, but maybe you can do something like this:
JitterMatrix mat = new JitterMatrix();
mat.frommatrix(movie);
int dim[] = mat.getDim();
Thanks, I think somewhere along such lines I could find a solution indeed. Unfortunate though that this involves reading in a movie twice:
once using the JitterMatrix to determine its dimensions.
once using the JitterObject referring to a "jit.movie" to actually play it.
but if this is the only way, I'll use an alternate (equally ugly, but more cpu friendly) solution: scripting the creation of a jit.movie in the parent patcher of my mxj and controlling/querying it through send and receive.
If anyone knows why accessing dimensions in an internal jit.movie is impossible, they're very welcome to enlighten us!
use the "moviedim" attribute. this will give native file dimensions at file load time.