コード例 #1
0
ファイル: atan2.c プロジェクト: amurtet/pd-cyclone
static void *atan2_new(t_floatarg f)
{
    t_atan2 *x = (t_atan2 *)pd_new(atan2_class);
    sic_newinlet((t_sic *)x, f);  /* CHECKED x-value argument */
    outlet_new((t_object *)x, &s_signal);
    return (x);
}
コード例 #2
0
ファイル: pow.c プロジェクト: Git689/libpd-cyclone-ios
static void *pow_new(t_floatarg f)
{
    t_pow *x = (t_pow *)pd_new(pow_class);
    sic_newinlet((t_sic *)x, f);  /* CHECKED default 0 */
    outlet_new((t_object *)x, &s_signal);
    return (x);
}
コード例 #3
0
ファイル: cycle.c プロジェクト: EQ4/Pd-for-LibPd
static void *cycle_new(t_symbol *s, int ac, t_atom *av)
{
    t_cycle *x = (t_cycle *)pd_new(cycle_class);
    int i = (ac && av->a_type == A_FLOAT ? 1 : 0);
    int tabsize = CYCLE_TABSIZE;
    x->x_costable = sic_makecostable(&tabsize);
    if (tabsize != CYCLE_TABSIZE)
    {
        loudbug_bug("cycle_new");
        pd_free((t_pd *)x);
        return (0);
    }
    if (ac && av->a_type == A_FLOAT)
    {
        sic_inlet((t_sic *)x, 0, 0, 0, ac, av);
        ac--, av++;
    }
    sic_newinlet((t_sic *)x, 0);
    outlet_new((t_object *)x, &s_signal);
    x->x_offset = 0;
    if (ac && av->a_type == A_SYMBOL)
    {
        x->x_name = av->a_w.w_symbol;
        ac--, av++;
        if (ac && av->a_type == A_FLOAT)
            if ((x->x_offset = (int)av->a_w.w_float) < 0)
                x->x_offset = 0;
    }
    else x->x_name = 0;
    x->x_table = 0;
    x->x_phase = 0.;
    x->x_conv = 0.;
    return (x);
}
コード例 #4
0
ファイル: wave.c プロジェクト: EQ4/Pd-for-LibPd
static void *wave_new(t_symbol *s, t_floatarg f1, t_floatarg f2, t_floatarg f3)
{
    /* three auxiliary signals:  phase, clipstart, and clipend inputs */
    t_wave *x = (t_wave *)arsic_new(wave_class, s, (int)f3, 0, 3);
    if (x)
    {
	int nch = arsic_getnchannels((t_arsic *)x);
	if (f1 < 0) f1 = 0;
	if (f2 < 0) f2 = 0;
	sic_newinlet((t_sic *)x, f1);
	sic_newinlet((t_sic *)x, f2);
	while (nch--)
	    outlet_new((t_object *)x, &s_signal);
	wave_interp(x, 1);
    }
    return (x);
}
コード例 #5
0
ファイル: teeth.c プロジェクト: electrickery/pd-miXedSon
static void *teeth_new(t_floatarg a_gain, t_floatarg b_gain, 
    t_floatarg c_gain, t_floatarg fw_delay, t_floatarg fb_delay)
{
    t_teeth *x = (t_teeth *)pd_new(teeth_class);  
    x->x_bufsize = 0;
  
    /* create signal inlets */
    sic_newinlet((t_sic *)x, fw_delay);
    sic_newinlet((t_sic *)x, fb_delay);
    sic_newinlet((t_sic *)x, a_gain);
    sic_newinlet((t_sic *)x, b_gain);
    sic_newinlet((t_sic *)x, c_gain);
    
    /* create a signal outlet */
    outlet_new(&x->x_obj, &s_signal);
  
    return (void *)x;
}
コード例 #6
0
ファイル: rand.c プロジェクト: psoamusic/PourOver
static void *rand_new(t_floatarg f)
{
    t_rand *x = (t_rand *)pd_new(rand_class);
    /* borrowed from d_osc.c, LATER rethink */
    static int init = 307;
    x->x_state = (init *= 1319);
    x->x_lastphase = 0.;
    x->x_nextphase = 1.;  /* start from 0, force retargetting */
    x->x_target = x->x_scaling = 0;
    sic_newinlet((t_sic *)x, (f > 0. ? -f : 0.));
    outlet_new((t_object *)x, &s_signal);
    return (x);
}
コード例 #7
0
ファイル: matrix.c プロジェクト: EQ4/Pd-for-LibPd
static void *matrix_new(t_symbol *s, int ac, t_atom *av)
{
    t_pd *z;
    if (!fittermax_get() &&
	(z = fragile_class_mutate(matrixps_matrixtilde,
				  (t_newmethod)matrix_new, ac, av)))
	return (z);
    else if (ac < 2)
    {
	loud_error(0, "bad creation arguments for class '%s'",
		   matrixps_matrixtilde->s_name);
	loud_errand(0, "missing number of %s", (ac ? "outlets" : "inlets"));
	return (0);  /* CHECKED */
    }
    else
    {
	t_matrix *x = (t_matrix *)pd_new(matrix_class);
	int i;
	if (av[0].a_type == A_FLOAT)
	{
	    if ((x->x_ninlets = (int)av[0].a_w.w_float) < 1)
		x->x_ninlets = 1;
	}
	else x->x_ninlets = 1;  /* CHECKED */
	if (av[1].a_type == A_FLOAT)
	{
	    if ((x->x_noutlets = (int)av[1].a_w.w_float) < 1)
		x->x_noutlets = 1;
	}
	else x->x_noutlets = 1;  /* CHECKED */
	x->x_ncells = x->x_ninlets * x->x_noutlets;
	x->x_ivecs = getbytes(x->x_ninlets * sizeof(*x->x_ivecs));
	x->x_ovecs = getbytes(x->x_noutlets * sizeof(*x->x_ovecs));
	x->x_nblock = x->x_maxblock = sys_getblksize();
	x->x_osums = getbytes(x->x_noutlets * sizeof(*x->x_osums));
	for (i = 0; i < x->x_noutlets; i++)
	    x->x_osums[i] = getbytes(x->x_maxblock * sizeof(*x->x_osums[i]));
	x->x_cells = getbytes(x->x_ncells * sizeof(*x->x_cells));
	matrix_clear(x);
	if (ac >= 3)
	{
	    if (av[2].a_type == A_FLOAT)
		x->x_defgain = av[2].a_w.w_float;
	    else
		x->x_defgain = MATRIX_DEFGAIN;
	    x->x_gains = getbytes(x->x_ncells * sizeof(*x->x_gains));
	    for (i = 0; i < x->x_ncells; i++)
		x->x_gains[i] = x->x_defgain;
	    x->x_ramps = getbytes(x->x_ncells * sizeof(*x->x_ramps));
	    matrix_ramp(x, MATRIX_DEFRAMP);
	    x->x_coefs = getbytes(x->x_ncells * sizeof(*x->x_coefs));
	    for (i = 0; i < x->x_ncells; i++)
		x->x_coefs[i] = 0.;
	    x->x_ksr = sys_getsr() * .001;
	    x->x_incrs = getbytes(x->x_ncells * sizeof(*x->x_incrs));
	    x->x_bigincrs = getbytes(x->x_ncells * sizeof(*x->x_bigincrs));
	    x->x_remains = getbytes(x->x_ncells * sizeof(*x->x_remains));
	    for (i = 0; i < x->x_ncells; i++)
		x->x_remains[i] = 0;
	}
	else
	{
	    x->x_gains = 0;
	    x->x_ramps = 0;
	    x->x_coefs = 0;
	    x->x_incrs = 0;
	    x->x_bigincrs = 0;
	    x->x_remains = 0;
	}
	for (i = 1; i < x->x_ninlets; i++)
	    sic_newinlet((t_sic *)x, 0.);
	for (i = 0; i < x->x_noutlets; i++)
	    outlet_new((t_object *)x, &s_signal);
	x->x_dumpout = outlet_new((t_object *)x, &s_list);
	return (x);
    }
}