Esempio n. 1
0
static void *maxmode_new(t_symbol *s, int ac, t_atom *av)
{
    t_maxmode *x = (t_maxmode *)pd_new(maxmode_class);
    int selective = ac;
    if (maxmode_withbanner && !ac)
    {
	post("this is maxmode %s, %s %s build",
	     CYCLONE_VERSION, loud_ordinal(CYCLONE_BUILD), CYCLONE_RELEASE);
	loud_warning(0, "maxmode",
 "creating maxmode object without loading cyclone components");
	maxmode_withbanner = 0;
    }
    if (selective)
    {
	/* a numeric argument is valid -- transparent object is created
	   (global mode is not set, nothing is registered) */
	while (ac--) if (av->a_type == A_SYMBOL)
	{
	    /* FIXME register into fitter for per-patch-file, selective
	       compatibility control */
	    av++;
	}
    }
    else if (!fittermax_get())
	fittermax_set();
    x->x_filehandle = hammerfile_new((t_pd *)x, 0, maxmode_readhook, 0, 0);
    outlet_new((t_object *)x, &s_float);
    x->x_modeout = outlet_new((t_object *)x, &s_symbol);
    return (x);
}
Esempio n. 2
0
void hammer_setup(void)
{
    if (canvas_getcurrent())
    {
	/* Loading the library by object creation is banned, because of a danger
	   of having some of the classes already loaded. LATER rethink. */
	loud_error(0, "apparently an attempt to create a 'hammer' object");
	loud_errand(0, "without having hammer library preloaded");
	return;
    }
    if (zgetfn(&pd_objectmaker, gensym("hammer")))
    {
	loud_error(0, "hammer is already loaded");
	return;
    }
    if (!zgetfn(&pd_objectmaker, gensym("cyclone")))
	post("this is hammer %s, %s %s build",
	     CYCLONE_VERSION, loud_ordinal(CYCLONE_BUILD), CYCLONE_RELEASE);
    hammer_class = class_new(gensym("hammer"),
			     (t_newmethod)hammer_new,
			     (t_method)hammer_free,
			     sizeof(t_hammer), 0, 0);
    class_addbang(hammer_class, hammer_bang);
    class_addmethod(hammer_class, (t_method)hammer_cd,
		    gensym("cd"), A_DEFSYM, 0);
    class_addmethod(hammer_class, (t_method)hammer_pwd,
		    gensym("pwd"), A_SYMBOL, 0);
    class_addmethod(hammer_class, (t_method)hammer_import,
		    gensym("import"), A_DEFSYM, 0);
    class_addmethod(hammer_class, (t_method)hammer_click,
		    gensym("click"),
		    A_FLOAT, A_FLOAT, A_FLOAT, A_FLOAT, A_FLOAT, 0);
    hammerfile_setup(hammer_class, 0);
    hammer_firstndx = fragile_class_count();
    allhammers_setup();
    hammer_lastndx = fragile_class_count() - 1;
}