コード例 #1
0
ファイル: jsusfx_pd.cpp プロジェクト: OpenDAWN/jsusfx
void *jsusfx_new(t_symbol *notused, long argc, t_atom *argv) {
    JsusFxPd *fx = new JsusFxPd();

    fx->normalizeSliders = 1;
    t_jsusfx *x = (t_jsusfx *)pd_new(jsusfx_class);

    t_symbol *dir = canvas_getcurrentdir();
    strcpy(x->canvasdir, dir->s_name);
    x->fx = fx;
    x->bypass = true;
    x->scriptpath[0] = 0;

    inlet_new(&x->x_obj, &x->x_obj.ob_pd, &s_signal, &s_signal);
    outlet_new(&x->x_obj, gensym("signal"));
    outlet_new(&x->x_obj, gensym("signal"));

	if ( argc < 1 || (argv[0]).a_type != A_SYMBOL ) {
		error("jsusfx~: missing script");
        return x;
	}

    t_symbol *s = atom_getsymbol(argv);
    jsusfx_compile(x, s);

    return (x);
}
コード例 #2
0
ファイル: pybase.cpp プロジェクト: McAlyster/py
void pybase::AddCurrentPath(flext_base *o)
{
    char dir[1024];

    // add dir of current patch to path
    o->GetCanvasDir(dir,sizeof(dir));
    if(*dir) AddToPath(dir);

    // add current dir to path
#if FLEXT_SYS == FLEXT_SYS_PD
    AddToPath(GetString(canvas_getcurrentdir()));
#elif FLEXT_SYS == FLEXT_SYS_MAX
    short path = path_getdefault();
    path_topathname(path,NULL,dir);
    AddToPath(dir);
#endif
}
コード例 #3
0
ファイル: binfile.c プロジェクト: reduzent/pd-mrpeach
static void *binfile_new(t_symbol *s, int argc, t_atom *argv)
{
    t_binfile  *x = (t_binfile *)pd_new(binfile_class);
    t_symbol    *pathSymbol;
    int         i;

    if (x == NULL)
    {
        error("binfile: Could not create...");
        return x;
    }
    x->x_fP = NULL;
    x->x_fPath[0] = '\0';
    x->x_our_directory = canvas_getcurrentdir();/* get the current directory to use as the base for relative file paths */
    x->x_rd_offset = x->x_wr_offset = x->x_length = 0L;
    x->x_buf_length = 0;//ALLOC_BLOCK_SIZE;
    /* find the first string in the arg list and interpret it as a path to a file */
    /* find the first float in the arg list and interpret it as the size of the buffer */
    for (i = 0; i < argc; ++i)
    {
        if (argv[i].a_type == A_FLOAT)
        {
            x->x_buf_length = atom_getfloat(&argv[i]);
            break; // take the first number
        }
    }
    for (i = 0; i < argc; ++i)
    {
        if (argv[i].a_type == A_SYMBOL)
        {
            pathSymbol = atom_getsymbol(&argv[i]);
            if (pathSymbol != NULL) binfile_read(x, pathSymbol, x->x_buf_length);
            break; // only try one path
        }
    }
    if ((x->x_buf = getbytes(x->x_buf_length)) == NULL)
        error ("binfile: Unable to allocate %lu bytes for buffer", x->x_buf_length);
    x->x_bin_outlet = outlet_new(&x->x_obj, gensym("float"));
    x->x_info_outlet = outlet_new(&x->x_obj, gensym("list"));
    x->x_bang_outlet = outlet_new(&x->x_obj, gensym("bang")); /* bang at end of file */
    return (void *)x;
}
コード例 #4
0
ファイル: m_class.c プロジェクト: BurntBrunch/rockbox-fft
    /* this routine is called when a new "object" is requested whose class Pd
    doesn't know.  Pd tries to load it as an extern, then as an abstraction. */
void new_anything(void *dummy, t_symbol *s, int argc, t_atom *argv)
{
    t_pd *current;
    t_symbol *dir = canvas_getcurrentdir();
    int fd;
    char dirbuf[MAXPDSTRING], *nameptr;
    if (tryingalready) return;
    newest = 0;
    class_loadsym = s;
    if (sys_load_lib(dir->s_name, s->s_name))
    {
    	tryingalready = 1;
    	typedmess(dummy, s, argc, argv);
    	tryingalready = 0;
    	return;
    }
    class_loadsym = 0;
    current = s__X.s_thing;
    if ((fd = open_via_path(dir->s_name, s->s_name, ".pd",
    	dirbuf, &nameptr, MAXPDSTRING, 0)) >= 0 ||
	    (fd = open_via_path(dir->s_name, s->s_name, ".pat",
    	    	dirbuf, &nameptr, MAXPDSTRING, 0)) >= 0)
    {
    	close (fd);
	if (!pd_setloadingabstraction(s))
	{
    	    canvas_setargs(argc, argv); /* bug fix by Krzysztof Czaja */
    	    binbuf_evalfile(gensym(nameptr), gensym(dirbuf));
    	    if (s__X.s_thing != current)
    	    	canvas_popabstraction((t_canvas *)(s__X.s_thing));
    	    canvas_setargs(0, 0);
	}
	else error("%s: can't load abstraction within itself\n", s->s_name);
    }
    else newest = 0;
}