Forums > Dev

Unable to create jit objects with jit_object_new


So9
November 16, 2007 | 9:53 am

Hi,

I have some trouble creating jitter objects with the jit_object_new function.
I’ve tried to create different objects from within my external but the only one that seems to be working so far is "jit_qt_movie".
( void* jitQtMovie=jit_object_new(gensym("jit_qt_movie")); )

This happily gives me an instance of the qtmovie object, but others like "jit_rota", "jit_lcd", "jit_gl_model" or "jit_gl_sketch" all seem to fail (returning NULL).

Anybody got any clue why?


November 19, 2007 | 3:41 pm

On Nov 16, 2007 9:53 AM, So9 wrote:

> I have some trouble creating jitter objects with the jit_object_new
> function.
> I’ve tried to create different objects from within my external but the
> only one that seems to be working so far is "jit_qt_movie".
> ( void* jitQtMovie=jit_object_new(gensym("jit_qt_movie")); )
>
> This happily gives me an instance of the qtmovie object, but others like
> "jit_rota", "jit_lcd", "jit_gl_model" or "jit_gl_sketch" all seem to fail
> (returning NULL).
>
> Anybody got any clue why?
>
>
You need to load the Jitter bundle for most objects. I’m not sure why but
most object don’t get loaded on max startup. This is a function I use in my
jitter object:

void mav_util_load_jit_bundle(t_symbol *realname, t_symbol *diskname)
{
void *c, *p;

c = (void *)class_findbyname(gensym("jitter"),realname);

if (!c) {
if (p=newinstance(diskname,0,NULL)) {
c = (void *)class_findbyname(gensym("jitter"),realname);
freeobject((t_object *)p);
p = NULL;
}
}
}

Then, in your objects new function you do something like this:

mav_util_load_jit_bundle(gensym("jit_gl_gridshape"), gensym("
jit.gl.gridshape"));

m_gridshape = (t_jit_object *)jit_object_new(gensym("jit_gl_gridshape"),
ctxt);

You only need to call the load bundle function once for every jitter object
type.

Cheers,
Thijs



So9
November 19, 2007 | 6:26 pm

That indeeds seems to be solving all my problems!
There is even a jit_class_findbyname(t_symbol *classname) to find jitter objects…

Thanks a lot!


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