Esempio n. 1
0
/* If nauxsigs is positive, then the number of signals is nchannels + nauxsigs;
   otherwise the channels are not used as signals, and the number of signals is
   nsigs -- provided that nsigs is positive -- or, if it is not, then an arsic
   is not used in dsp (peek~). */
void *arsic_new(t_class *c, t_symbol *s,
		int nchannels, int nsigs, int nauxsigs)
{
    t_arsic *x;
    t_symbol *mononame;
    char *stub;
    t_float **vectors;
    int nperfargs = 0;
    t_int *perfargs = 0;
    t_symbol **channames = 0;
    if (!s) s = &s_;
    if (nchannels < 1)
    {
	nchannels = 1;
	mononame = s;
	stub = 0;
    }
    else
    {
	mononame = 0;
	stub = s->s_name;
    }
    if (!(vectors = (t_float **)getbytes(nchannels * sizeof(*vectors))))
	return (0);
    if (nauxsigs > 0)
	nperfargs = nchannels + nauxsigs + 2;
    else if (nsigs > 0)
	nperfargs = nsigs + 2;
    if (nperfargs
	&& !(perfargs = (t_int *)getbytes(nperfargs * sizeof(*perfargs))))
    {
	freebytes(vectors, nchannels * sizeof(*vectors));
	return (0);
    }
    if (stub &&
	!(channames = (t_symbol **)getbytes(nchannels * sizeof(*channames))))
    {
	freebytes(vectors, nchannels * sizeof(*vectors));
	if (perfargs) freebytes(perfargs, nperfargs * sizeof(*perfargs));
	return (0);
    }
    x = (t_arsic *)pd_new(c);
    x->s_vecsize = 0;
    x->s_nchannels = nchannels;
    x->s_vectors = vectors;
    x->s_channames = channames;
    x->s_nperfargs = nperfargs;
    x->s_perfargs = perfargs;
    x->s_mononame = mononame;
    x->s_stub = stub;
    x->s_ksr = sys_getsr() * 0.001;
    ((t_sic *)x)->s_disabled = 0;
    x->s_playable = 0;
    x->s_minsize = 1;
    arsic_setarray(x, s, 0);
    return (x);
}
Esempio n. 2
0
static void peek_set(t_peek *x, t_symbol *s)
{
    arsic_setarray((t_arsic *)x, s, 1);
}
Esempio n. 3
0
static void play_set(t_play *x, t_symbol *s)
{
    arsic_setarray((t_arsic *)x, s, 1);
}
Esempio n. 4
0
static void poke_set(t_poke *x, t_symbol *s)
{
    arsic_setarray((t_arsic *)x, s, 1);
}
Esempio n. 5
0
static void wave_set(t_wave *x, t_symbol *s)
{
    arsic_setarray((t_arsic *)x, s, 1);
}
Esempio n. 6
0
static void record_set(t_record *x, t_symbol *s)
{
    arsic_setarray((t_arsic *)x, s, 1);
    record_mstoindex(x);
}