// Load an external for internal use // returns true if successful bool jamoma_loadextern(t_symbol *objectname, long argc, t_atom *argv, t_object **object) { t_class *c = NULL; t_object *p = NULL; c = class_findbyname(jps_box, objectname); if (!c) { p = (t_object *)newinstance(objectname, 0, NULL); if (p) { c = class_findbyname(jps_box, objectname); freeobject(p); p = NULL; } else { error("jamoma: could not load extern (%s) within the core", objectname->s_name); return false; } } if (*object != NULL) { // if there was an object set previously, free it first... object_free(*object); *object = NULL; } *object = (t_object *)object_new_typed(CLASS_BOX, objectname, argc, argv); return true; }
t_plugtastic* plugtastic_new() { t_plugtastic* self = (t_plugtastic*)(object_alloc(sPlugtasticClass)); t_atom a; t_class* c; t_object* p; c = class_findbyname(_sym_box, _sym_forward); if (!c) { p = (t_object*)newinstance(_sym_forward, 0, NULL); if (p) { c = class_findbyname(_sym_box, _sym_forward); freeobject(p); p = NULL; } } atom_setsym(&a, GENSYM("plugtastic_extra_toggle")); self->forward = (t_object*)object_new_typed(CLASS_BOX, _sym_forward, 1, &a); self->openSplash = &sPlugtasticSplash; a.a_type = 0; preferences_getatomforkey(GENSYM("plugtastic_splash"), &a); if (a.a_type) *self->openSplash = atom_getlong(&a); return self; }
// Load an external for internal use t_max_err loadextern(t_symbol *objectname, long argc, t_atom *argv, t_object **object) { t_class *c = NULL; t_object *p = NULL; c = class_findbyname(_sym_box, objectname); if (!c) { p = (t_object*)newinstance(objectname, 0, NULL); if(p){ c = class_findbyname(_sym_box, objectname); freeobject(p); p = NULL; } else{ error("could not load extern (%s) within the oscar extension", objectname->s_name); return MAX_ERR_GENERIC; } } if (*object != NULL) { // if there was an object set previously, free it first... object_free(*object); *object = NULL; } *object = (t_object*)object_new_typed(_sym_box, objectname, argc, argv); return MAX_ERR_NONE; }
void load_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(p); p = NULL; } } }