Exemple #1
0
/* CHECKED refman's error: ``if the number received in the left inlet
   specifies a sample index that does not exist in the buffer~ object's
   currently allocated memory, nothing happens.''  This is plainly wrong,
   at least for max/msp 4.0.7 bundle: the index is clipped (just like
   in tabread/tabwrite).   As a kind of an experiment, lets make this
   the refman's way... */
static void peek_float(t_peek *x, t_float f)
{
    t_arsic *sic = (t_arsic *)x;
    t_word *vp;
    arsic_validate(sic, 0);  /* LATER rethink (efficiency, and complaining) */
    if ((vp = sic->s_vectors[x->x_effchannel]))
    {
	int ndx = (int)f;
	if (ndx >= 0 && ndx < sic->s_vecsize)
	{
	    if (x->x_pokemode)
	    {
		double timesince;
		t_float f = x->x_value;
		vp[ndx].w_float = (x->x_clipmode ? peek_doclip(f) : f);
		x->x_pokemode = 0;
		timesince = clock_gettimesince(x->x_clocklasttick);
		if (timesince > 1000) peek_tick(x);
		else if (!x->x_clockset)
		{
		    clock_delay(x->x_clock, 1000 - timesince);
		    x->x_clockset = 1;
		}
	    }
	    /* CHECKED: output not clipped */
	    else outlet_float(((t_object *)x)->ob_outlet, vp[ndx].w_float);
	}
    }
}
Exemple #2
0
void arsic_dsp(t_arsic *x, t_signal **sp, t_perfroutine perf, int complain)
{
    t_int *ap = x->s_perfargs;
    if (ap)
    {
	int i, nsigs = x->s_nperfargs - 2;
	x->s_ksr = sp[0]->s_sr * 0.001;
	arsic_validate(x, complain);
	arsic_check(x);

	/* LATER consider glist traversing, and, if we have no feeders,
	   choosing an optimized version of perform routine */

	*ap++ = (t_int)x;
	*ap++ = (t_int)sp[0]->s_n;
	for (i = 0; i < nsigs; i++) *ap++ = (t_int)sp[i]->s_vec;
	dsp_addv(perf, x->s_nperfargs, x->s_perfargs);
    }
    else loudbug_bug("arsic_dsp");
}
Exemple #3
0
/* CHECKED: no float-to-signal conversion.  'Float' message is ignored
   when dsp is on -- whether a signal is connected to the left inlet, or not
   (if not, current index is set to zero).  Incompatible (revisit LATER) */
static void poke_float(t_poke *x, t_float f)
{
    t_arsic *sic = (t_arsic *)x;
    t_float *vp;
    arsic_validate(sic, 0);  /* LATER rethink (efficiency, and complaining) */
    if (vp = sic->s_vectors[x->x_effchannel])
    {
	int ndx = (int)*x->x_indexptr;
	if (ndx >= 0 && ndx < sic->s_vecsize)
	{
	    double timesince;
	    vp[ndx] = f;
	    timesince = clock_gettimesince(x->x_clocklasttick);
	    if (timesince > 1000) poke_tick(x);
	    else if (!x->x_clockset)
	    {
		clock_delay(x->x_clock, 1000 - timesince);
		x->x_clockset = 1;
	    }
	}
    }
}
Exemple #4
0
void arsic_setarray(t_arsic *x, t_symbol *s, int complain)
{
    if (s)
    {
	if (x->s_mononame) x->s_mononame = s;
	else
	{
	    x->s_stub = s->s_name;
	    if (*x->s_stub)
	    {
		char buf[MAXPDSTRING];
		int ch;
		for (ch = 0; ch < x->s_nchannels; ch++)
		{
		    sprintf(buf, "%d-%s", ch, x->s_stub);
		    x->s_channames[ch] = gensym(buf);
		}
	    }
	}
	arsic_validate(x, complain);
    }
    arsic_check(x);
}