Forums > Dev

restrict width and height on mop initialization

May 31 2012 | 7:32 pm

I would like to create a mop with 0 input and 1 output and restrict the matrix info to be "4 char 640 480".

How can I restrict the matrix width and height?

in order to set the type and planecount I use jit_mop_single_type and jit_mop_single_planecount. it seems like there is no such utility function for the dimensions.

I tried:

p = jit_object_method(mop, _jit_sym_getoutput, 1);
m = jit_object_method(p, _jit_sym_matrix);
jit_object_method(m, _jit_sym_getinfo, &info);
jit_attr_setlong_array(&info, _jit_sym_dim, 2, dims);

but m returns null.

I also saw _jit_sym_restrict_dim symbol used in jit_mop_ioproc_copy_adapt method, but I don’t know how I could use that when assigning width and height from scratch.

Any suggestions?
Thanks a lot

Jun 03 2012 | 12:42 am

The solution I eventually found is to use _jit_sym_mindim and _jit_sym_maxdim methods like this:

void *p, *m;
t_atom args[4];
jit_atom_setlong(args, 640);
jit_atom_setlong(args + 1, 480);

p = jit_object_method(mop, _jit_sym_getoutput, 1);
jit_object_method(p, _jit_sym_mindim, 2, &args);
jit_object_method(p, _jit_sym_maxdim, 2, &args);


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

Forums > Dev