示例#1
0
static void *plane_new(t_symbol *s, int argc, t_atom *argv)
{
    t_plane *x = (t_plane *)eobj_new(plane_class);
    t_binbuf* d = binbuf_via_atoms(argc,argv);
    if(x && d)
    {
        ebox_new((t_ebox *)x, 0 | EBOX_GROWLINK);
        eobj_proxynew(x);
        eobj_proxynew(x);
        ebox_parameter_create((t_ebox *)x, 1);
        ebox_parameter_create((t_ebox *)x, 2);
        x->f_out_x = outlet_new((t_object *)x, &s_float);
        x->f_out_y = outlet_new((t_object *)x, &s_float);
        
        ebox_attrprocess_viabinbuf(x, d);
        ebox_ready((t_ebox *)x);
        return x;
    }
    
    return  NULL;
}
示例#2
0
static void *dsp_tilde_new(t_symbol *s, int argc, t_atom *argv)
{
    long flags;
	t_dsp_tilde *x  = (t_dsp_tilde *)eobj_new(dsp_tildeclass);
    t_binbuf* d     = binbuf_via_atoms(argc,argv);

    if(x && d)
    {
        flags = 0
        | EBOX_GROWLINK
        ;
        
        ebox_new((t_ebox *)x, flags);
        eobj_proxynew(x);
        x->f_init = 0;
        ebox_attrprocess_viabinbuf(x, d);
        ebox_ready((t_ebox *)x);
        pd_bind((t_pd *)x, gensym("pd"));
        return x;
    }

	return NULL;
}
示例#3
0
static void *pak_new(t_symbol *s, int argc, t_atom *argv)
{
    int i;
    t_pak *x = (t_pak *)eobj_new(pak_class);
    if(x)
    {
        if(argc < 2)
        {
            argc = 2;
        }
        x->f_argc = argc;
        x->f_argv = (t_atom *)calloc((size_t)x->f_argc, sizeof(t_atom));
        x->f_selectors = (char *)calloc((size_t)x->f_argc, sizeof(char));
        eobj_proxynew(x);
        eobj_proxynew(x);
        if(argc > 0 &&atom_gettype(argv) == A_SYMBOL && (atom_getsymbol(argv) == gensym("f") || atom_getsymbol(argv) == gensym("float")))
        {
            x->f_selectors[0] = 0;
            atom_setfloat(x->f_argv, 0.);
        }
        else if(argc > 0 && atom_gettype(argv) == A_FLOAT)
        {
            x->f_selectors[0] = 0;
            atom_setfloat(x->f_argv, atom_getfloat(argv));
        }
        else if(argc > 0 && atom_gettype(argv) == A_SYMBOL && (atom_getsymbol(argv) == gensym("s") || atom_getsymbol(argv) == gensym("symbol")))
        {
            x->f_selectors[0] = 1;
            atom_setsym(x->f_argv, gensym("symbol"));
        }
        else if(argc > 0 && atom_gettype(argv) == A_SYMBOL)
        {
            x->f_selectors[0] = 1;
            atom_setsym(x->f_argv, atom_getsymbol(argv));
        }
        else
        {
            x->f_selectors[0] = 0;
            atom_setfloat(x->f_argv, 0.);
        }
        if(argc > 1 && atom_gettype(argv+1) == A_SYMBOL && (atom_getsymbol(argv+1) == gensym("f") || atom_getsymbol(argv+1) == gensym("float")))
        {
            x->f_selectors[1] = 0;
            atom_setfloat(x->f_argv+1, 0.);
        }
        else if(argc > 1 && atom_gettype(argv+1) == A_FLOAT)
        {
            x->f_selectors[1] = 0;
            atom_setfloat(x->f_argv+1, atom_getfloat(argv+1));
        }
        else if(argc > 1 && atom_gettype(argv+1) == A_SYMBOL && (atom_getsymbol(argv+1) == gensym("s") || atom_getsymbol(argv+1) == gensym("symbol")))
        {
            x->f_selectors[1] = 1;
            atom_setsym(x->f_argv+1, gensym("symbol"));
        }
        else if(argc > 1 && atom_gettype(argv+1) == A_SYMBOL)
        {
            x->f_selectors[1] = 1;
            atom_setsym(x->f_argv+1, atom_getsymbol(argv+1));
        }
        else
        {
            x->f_selectors[1] = 0;
            atom_setfloat(x->f_argv+1, 0.);
        }
        for(i = 2; i < x->f_argc; i++)
        {
            eobj_proxynew(x);
            if(atom_gettype(argv+i) == A_SYMBOL && (atom_getsymbol(argv+i) == gensym("f") || atom_getsymbol(argv+i) == gensym("float")))
            {
                x->f_selectors[i] = 0;
                atom_setfloat(x->f_argv+i, 0.);
            }
            else if(atom_gettype(argv+i) == A_FLOAT)
            {
                x->f_selectors[i] = 0;
                atom_setfloat(x->f_argv+i, atom_getfloat(argv));
            }
            else if(atom_gettype(argv+i) == A_SYMBOL && (atom_getsymbol(argv+i) == gensym("s") || atom_getsymbol(argv+i) == gensym("symbol")))
            {
                x->f_selectors[i] = 1;
                atom_setsym(x->f_argv+i, gensym("symbol"));
            }
            else if(atom_gettype(argv+i) == A_SYMBOL)
            {
                x->f_selectors[i] = 1;
                atom_setsym(x->f_argv+i, atom_getsymbol(argv+i));
            }
            else
            {
                x->f_selectors[i] = 1;
                atom_setsym(x->f_argv+i, gensym("symbol"));
            }
        }
        x->f_out = outlet_new((t_object *)x, &s_list);
    }
    
    return (x);
}