t_jit_matrix and getcell ?

Feb 14, 2010 at 4:50pm

t_jit_matrix and getcell ?

Hello maxers,

i try to get first cell of a one dim matrix :

long    argc, rac ;
t_atom  argv ;
t_atom  *rav ;

atom_setlong (&argv, 0) ;

jit_object_method (ptr_jit_o, gensym ("getcell"), 1, &argv, &rac, &rav) ;

but rac is always zero ? (Everything is ok with “getinfo” method) ; Is anything wrong in my code ?

#48487
Feb 15, 2010 at 9:10am

Hello maxers,

maybe my ptr_jit_o isn’t valid ?

I try to find all [jit.matrix] in “badaboum” name’s supatchers, and get data of them. I’m not sure what i’m doing here is good ; so much things i still don’t understand in SDK ;-)

void collecter_matrix (t_november *x)
	{
		t_object *ptr_p = NULL ;

		if (!(object_obex_lookup (x, gensym ("#P"), &ptr_p)))
			{
				long result = 0 ;
				object_method (ptr_p, gensym ("iterate"), (method)chercher_matrix, x, PI_WANTBOX | PI_DEEP, &result) ;
			}
	}

long chercher_matrix (t_november *x, t_object *ptr_b)
	{
		t_symbol *sym_p ;
		t_symbol *sym_b ;
		t_object *ptr_p ;

		ptr_p = jbox_get_patcher (ptr_b) ;
		sym_b = jpatcher_get_maxclass (ptr_b) ;
		sym_p = jpatcher_get_name (ptr_p) ;

		if (sym_p == gensym ("badaboum") && sym_b == gensym ("jit.matrix"))
			{
				t_object *ptr_o = NULL ;
				t_object *ptr_jit_o = NULL ;

				ptr_o = jbox_get_object (ptr_b) ;

				if (ptr_jit_o = max_jit_obex_jitob_get (ptr_o))
					{
						post ("%x", ptr_jit_o) ; // ####### is this a valid t_jit_matrix pointer ?
					}
			}

		return 0 ;
	}

Thanks.

#174376
Feb 15, 2010 at 6:52pm

Yes, this is a bit tricky. The issue here is that when calling jit_object_method() it is an untyped call through to the method, so you provide the message name and then any arguments to follow. Some methods like “getinfo” don’t have a symbol message argument, so it works, but for things with a prototype like the following which does have a symbol message argument:

t_jit_err jit_matrix_getcell (t_jit_matrix *x, t_symbol *s, long argc, t_atom *argv, long *rac, t_atom **rav);

you will need to use a double message to account for this stripping away of the message symbol as in:

jit_object_method(x,msg,msg,ac,av,&rac,&rav);

I hope this makes sense, but let us know if you need more assistance.

-Joshua

#174377
Feb 16, 2010 at 11:47am

Hello Joshua,

I would not have found alone ;-)
It works fine ; Thank you very much.

#174378

You must be logged in to reply to this topic.