コード例 #1
0
ファイル: d_array.c プロジェクト: davidjonas/mediawerf_game
static void tabosc4_tilde_set(t_tabosc4_tilde *x, t_symbol *s)
{
    t_garray *a;
    int npoints, pointsinarray;

    x->x_arrayname = s;
    if (!(a = (t_garray *)pd_findbyclass(x->x_arrayname, garray_class)))
    {
        if (*s->s_name)
            pd_error(x, "tabosc4~: %s: no such array", x->x_arrayname->s_name);
        x->x_vec = 0;
    }
    else if (!garray_getfloatwords(a, &pointsinarray, &x->x_vec))
    {
        pd_error(x, "%s: bad template for tabosc4~", x->x_arrayname->s_name);
        x->x_vec = 0;
    }
    else if ((npoints = pointsinarray - 3) != (1 << ilog2(pointsinarray - 3)))
    {
        pd_error(x, "%s: number of points (%d) not a power of 2 plus three",
            x->x_arrayname->s_name, pointsinarray);
        x->x_vec = 0;
        garray_usedindsp(a);
    }
    else
    {
        x->x_fnpoints = npoints;
        x->x_finvnpoints = 1./npoints;
        garray_usedindsp(a);
    }
}
コード例 #2
0
ファイル: cybuf.c プロジェクト: porres/pd-cyclone
/* on failure *bufsize is not modified */
t_word *cybuf_get(t_cybuf *c, t_symbol * name, int *bufsize, int indsp, int complain){
//in dsp = used in dsp, 
  
    if (name && name != &s_){
	t_garray *ap = (t_garray *)pd_findbyclass(name, garray_class);
	if (ap){
	    int bufsz;
	    t_word *vec;
	    if (garray_getfloatwords(ap, &bufsz, &vec)){
   	        //c->c_len = garray_npoints(ap);
		if (indsp) garray_usedindsp(ap);
		if (bufsize) *bufsize = bufsz;
		return (vec);
	    }
	     else pd_error(c->c_owner,  /* always complain */
			"bad template of array '%s'", name->s_name);
        }
	else{
            if(complain){
	        pd_error(c->c_owner, "no such array '%s'", name->s_name);
            };
	};
    }
    return (0);
}
コード例 #3
0
ファイル: chopper~.c プロジェクト: pd-projects/lyonpotpourri
void chopper_set(t_chopper *x, t_symbol *wavename)
{
  int frames;
  t_garray *a;
  x->disabled = 0;

  x->b_frames = 0;
  x->b_nchans = 1;
  if (!(a = (t_garray *)pd_findbyclass(wavename, garray_class))) {
      if (*wavename->s_name) pd_error(x, "chopper~: %s: no such array",
				      wavename->s_name);
      x->b_samples = 0;
      x->disabled = 1;
    }
  else if (!garray_getfloatarray(a, &frames, &x->b_samples)) {
      pd_error(x, "%s: bad template for chopper~", wavename->s_name);
      x->b_samples = 0;
      x->disabled = 1;
    }
  else  {
    x->b_frames = frames;
//    post("%d frames in buffer",x->b_frames);
    garray_usedindsp(a);
  }
}
コード例 #4
0
ファイル: sliceplay~.c プロジェクト: baordog/memorycorruption
static void sliceplay_set(t_sliceplay *x)
{
	t_garray *array;
	int arraysize, logloopsize;
	
	if(!(array = (t_garray *)pd_findbyclass(x->arrayname, garray_class)))
	{
		if (x->arrayname->s_name) pd_error(x, "sliceplay~: %s: no such array", 
            x->arrayname->s_name);
		x->arraypointer = 0;
	}
	
	else if (!garray_getfloatwords(array, &arraysize, &x->arraypointer))
	{
		pd_error(x, "%s: bad template for sliceplay~", x->arrayname->s_name);
		x->arraypointer = 0;
	}
	
	else
	{
		logloopsize = ilog2(arraysize-3);	// arraysize must be at least loopsize + 1 sample
		x->loopsize = 1<<logloopsize;		// loopsize is rounded to a power of two
		x->loopmask = x->loopsize - 1;		// bitwise-and mask for loopsize
		garray_usedindsp(array);
	}
}
コード例 #5
0
ファイル: FIR~.c プロジェクト: IcaroL2ORK/pd
void FIR_tilde_set(t_FIR_tilde *x, t_symbol *table_name, t_floatarg forder)
{
  t_garray *ga;
  int table_size;
  int order = (int)forder;
  
  x->x_table_name = table_name;
  if(!(ga = (t_garray *)pd_findbyclass(x->x_table_name, garray_class)))
  {
    if(*table_name->s_name)
      error("FIR~: %s: no such table~", x->x_table_name->s_name);
    x->x_coef_beg = 0;
  }
  else if(!garray_getfloatarray(ga, &table_size, &x->x_coef_beg))
  {
    error("%s: bad template for FIR~", x->x_table_name->s_name);
    x->x_coef_beg = 0;
  }
  else if(table_size < order)
  {
    error("FIR~: tablesize %d < order %d !!!!", table_size, order);
    x->x_coef_beg = 0;
  }
  else
    garray_usedindsp(ga);
  x->x_rw_index = 0;
  if(order > x->x_fir_order)/* resize */
    x->x_history_beg =  (t_float *)resizebytes(x->x_history_beg, 2*x->x_fir_order*sizeof(t_float), 2*order*sizeof(float));
  x->x_fir_order = order;
}
コード例 #6
0
void granulesf_setbuf(t_granulesf *x, t_symbol *wavename, t_symbol *windowname)
{
    t_garray *a;
    int frames;
    
    x->hosed = 0;
    x->wavebuf->b_frames = 0;
    x->windowbuf->b_frames = 0;
    x->wavebuf->b_nchans = 1;//unused, should kill
    x->windowbuf->b_nchans = 1;  //unused, should kill
    x->b_nchans = 1;
    
    /* load up sample array */
    if (!(a = (t_garray *)pd_findbyclass(wavename, garray_class))) {
        if (*wavename->s_name) pd_error(x, "granulesf~: %s: no such array", wavename->s_name);
        x->hosed = 1;
    }
    else if (!garray_getfloatwords(a, &frames, &x->wavebuf->b_samples)) {
        pd_error(x, "%s: bad template for granulesf~", wavename->s_name);
        x->hosed = 1;
    }
    else  {
        x->wavebuf->b_frames = frames;
        x->b_nchans = 1; // Pd buffers are always mono (so far)
        garray_usedindsp(a);
    }
    
    /* load up envelope array*/
    if (!(a = (t_garray *)pd_findbyclass(windowname, garray_class))) {
        if (*wavename->s_name) pd_error(x, "granulesf~: %s: no such array", windowname->s_name);
        x->hosed = 1;
    }
    else if (!garray_getfloatwords(a, &frames, &x->windowbuf->b_samples)) {
        pd_error(x, "%s: bad template for granulesf~", windowname->s_name);
        x->hosed = 1;
    }
    else  {
        x->windowbuf->b_frames = frames;
        garray_usedindsp(a);
    }
    
    x->maxskip = x->wavebuf->b_frames - 1;
}
コード例 #7
0
ファイル: fofsynth~.c プロジェクト: reduzent/pd-ggee
void fofsynth_usearray(t_symbol* s,int* points,t_word** vec)
{
     t_garray *a;
     if (!(a = (t_garray *)pd_findbyclass(s, garray_class))) 
	  error("%s: no such array", s->s_name);
     else if (!garray_getfloatwords(a,points,vec))
	  error("%s: bad template for fof~", s->s_name);
     else
	  garray_usedindsp(a); 
}
コード例 #8
0
void arrayfilt_setarray(t_arrayfilt *x, t_symbol *arrayname)
{
    t_garray *a;
	if (!(a = (t_garray *)pd_findbyclass(arrayname, garray_class))) {
		if (*arrayname->s_name) pd_error(x, "player~: %s: no such array", arrayname->s_name);
    }
	else  {
		garray_usedindsp(a);
        if (!garray_getfloatarray(a, &x->a_frames, &x->a_samples))
        {
            pd_error(x, "%s: bad template for player~", arrayname->s_name);
        }
	}
}
コード例 #9
0
ファイル: tabwrite~.c プロジェクト: BurntBrunch/rockbox-fft
void tabwrite_tilde_set(t_tabwrite_tilde *x, t_symbol *s)
{
    t_garray *a;

    x->x_arrayname = s;
    if (!(a = (t_garray *)pd_findbyclass(x->x_arrayname, garray_class)))
    {
    	if (*s->s_name) pd_error(x, "tabwrite~: %s: no such array",
    	    x->x_arrayname->s_name);
    	x->x_vec = 0;
    }
    else if (!garray_getfloatarray(a, &x->x_nsampsintab, &x->x_vec))
    {
    	error("%s: bad template for tabwrite~", x->x_arrayname->s_name);
    	x->x_vec = 0;
    }
    else garray_usedindsp(a);
}
コード例 #10
0
ファイル: d_array.c プロジェクト: davidjonas/mediawerf_game
static void tabsend_set(t_tabsend *x, t_symbol *s)
{
    t_garray *a;
    
    x->x_arrayname = s;
    if (!(a = (t_garray *)pd_findbyclass(x->x_arrayname, garray_class)))
    {
        if (*s->s_name)
            pd_error(x, "tabsend~: %s: no such array", x->x_arrayname->s_name);
        x->x_vec = 0;
    }
    else if (!garray_getfloatwords(a, &x->x_npoints, &x->x_vec))
    {
        pd_error(x, "%s: bad template for tabsend~", x->x_arrayname->s_name);
        x->x_vec = 0;
    }
    else garray_usedindsp(a);
}
コード例 #11
0
ファイル: mill~.c プロジェクト: ollierik/pd-mill
void mill_tilde_set(t_mill_tilde *x, t_symbol *s)
{
     t_garray *a;

     x->arrayname = s;
     if (!(a = (t_garray *)pd_findbyclass(x->arrayname, garray_class)))
     {
         if (*s->s_name)
             pd_error(x, "tabread~: %s: no such array", x->arrayname->s_name);
         x->x_vec = 0;
     }
     else if (!garray_getfloatwords(a, &x->arraysize, &x->x_vec))
     {
         pd_error(x, "%s: bad template for tabread~", x->arrayname->s_name);
         x->x_vec = 0;
     }
     else garray_usedindsp(a);
}
コード例 #12
0
void function_setbuf(t_function *x, t_symbol *wavename)
{
    int frames;
    t_garray *a;
    
    x->b_frames = 0;
    x->b_nchans = 1;
    if (!(a = (t_garray *)pd_findbyclass(wavename, garray_class))) {
        if (*wavename->s_name) pd_error(x, "function~: %s: no such array", wavename->s_name);
    }
    else if (!garray_getfloatwords(a, &frames, &x->b_samples)) {
        pd_error(x, "%s: bad template for function~", wavename->s_name);
    }
    else  {
        x->b_frames = frames;
        garray_usedindsp(a);
        // post("%d frames in buffer", x->b_frames);
    }
}
コード例 #13
0
ファイル: moop~.c プロジェクト: sebshader/shadylib
void moop_tilde_set(t_moop *x, t_symbol *s) {
    t_garray *a;
    int points;
    x->x_arrayname = s;
    if (!(a = (t_garray *)pd_findbyclass(x->x_arrayname, garray_class)))
    {
        if (*s->s_name)
            pd_error(x, "moop~: %s: no such array", x->x_arrayname->s_name);
        x->x_buf.x_vec = 0;
    }
    else if (!garray_getfloatwords(a, &points, &x->x_buf.x_vec))
    {
        pd_error(x, "%s: bad template for moop~", x->x_arrayname->s_name);
        x->x_buf.x_vec = 0;
    } else {
    	x->x_buf.x_npoints = points - 4;
    	garray_usedindsp(a);
    }
}
コード例 #14
0
ファイル: granufm~.c プロジェクト: ramagottfried/tilde
// set user defined grain buffer
static void granu_set_array(t_grans *x, t_symbol *s)
{

    t_garray *a;
    
    x->x_arrayname = s;
    if (!(a = (t_garray *)pd_findbyclass(x->x_arrayname, garray_class)))
    {
        if (*s->s_name)
            pd_error(x, "granufm~: %s: no such array", x->x_arrayname->s_name);
        
        x->x_vec = 0;
    }
    else if (!garray_getfloatarray(a, &x->x_npoints, &x->x_vec)) //store array in vector
    {
        pd_error(x, "granufm~: failed to get buffer data for %s", x->x_arrayname->s_name);
        x->x_vec = 0;
    }
    else garray_usedindsp(a);

}
コード例 #15
0
/*
void function_rcos(t_function *x)
{
    int i;
    long b_frames;
    t_word *b_samples;
    t_symbol *wavename = x->wavename;
    int frames;
    t_garray *a;
    
    x->b_frames = 0;
    x->b_nchans = 1;
    // open array
    if (!(a = (t_garray *)pd_findbyclass(wavename, garray_class))) {
        if (*wavename->s_name) pd_error(x, "function~: %s: no such array", wavename->s_name);
    }
    else if (!garray_getfloatwords(a, &frames, &x->b_samples)) {
        pd_error(x, "%s: bad template for function~", wavename->s_name);
    }
    else  {
        x->b_frames = frames;
        garray_usedindsp(a);
    }
    b_frames = x->b_frames;
    post("rcos generating %d frames", b_frames); // correct
    // put samples into array
    for(i=0;i<b_frames;i++){
        x->b_samples[i].w_float = (t_float) (0.5 - 0.5 * cos(TWOPI * (t_float)i/(t_float)b_frames));
    }
    if (!(a = (t_garray *)pd_findbyclass(x->wavename, garray_class))) {
        if (*x->wavename->s_name) pd_error(x, "function~: %s: no such array", x->wavename->s_name);
    }
    else  {
        garray_redraw(a);
    }
    // printed samples are correct
    for(i=0;i<b_frames;i++){
        post("%f", x->b_samples[i].w_float);
    }
}
*/
void function_print(t_function *x)
{
    int frames;
    t_garray *a;
    int i;
    x->b_frames = 0;
    x->b_nchans = 1;
    if (!(a = (t_garray *)pd_findbyclass(x->wavename, garray_class))) {
        if (*x->wavename->s_name) pd_error(x, "function~: %s: no such array", x->wavename->s_name);
    }
    else if (!garray_getfloatwords(a, &frames, &x->b_samples)) {
        pd_error(x, "%s: bad template for function~", x->wavename->s_name);
    }
    else  {
        x->b_frames = frames;
        garray_usedindsp(a);
        for(i = 0; i < frames; i++){
            post("%d: %f",i, x->b_samples[i].w_float);
        }
    }
}
コード例 #16
0
ファイル: pvwarpb~.c プロジェクト: ericlyon/fftease3.0-32bit
void pvwarpb_attachbuf(t_pvwarpb *x)
{
  	int frames;
    t_symbol *buffername = x->buffername;
	t_garray *a;
    
	x->b_frames = 0;
	x->b_valid = 0;
	if (!(a = (t_garray *)pd_findbyclass(buffername, garray_class)))
    {
		if (*buffername->s_name) pd_error(x, "player~: %s: no such array",
                                          buffername->s_name);
    }
	else if (!garray_getfloatarray(a, &frames, &x->b_samples))
    {
		pd_error(x, "%s: bad template for player~", buffername->s_name);
    }
	else  {
		x->b_frames = frames;
		x->b_valid = 1;
		garray_usedindsp(a);
	}
}
コード例 #17
0
void bvplay_set(t_bvplay *x, t_symbol *wavename)
{
    
	t_garray *a;
	int b_frames;
	t_word *b_samples;
	if (!(a = (t_garray *)pd_findbyclass(wavename, garray_class))) {
		if (*wavename->s_name) pd_error(x, "%s: %s: no such array",OBJECT_NAME,wavename->s_name);
		x->wavebuf->b_valid = 0;
    }
	else if (!garray_getfloatwords(a, &b_frames, &b_samples)) {
		pd_error(x, "%s: bad array for %s", wavename->s_name,OBJECT_NAME);
		x->wavebuf->b_valid = 0;
    }
	else  {
		x->wavebuf->b_valid = 1;
		x->wavebuf->b_frames = b_frames;
		x->wavebuf->b_nchans = 1;
		x->wavebuf->b_samples = b_samples;
		garray_usedindsp(a);
	}
    
}