예제 #1
0
파일: pib~.c 프로젝트: sebshader/shadylib
static void *pib_tilde_new(void) {
    t_pib *x = (t_pib *)pd_new(pib_tilde_class);
    x->x_time = clock_getlogicaltime();
    outlet_new(&x->x_obj, &s_float);
    return (x);
}
예제 #2
0
파일: matrix.c 프로젝트: porres/pd-cyclone
static void *matrix_new(t_symbol *s, int argc, t_atom *argv)
{
	t_matrix *x = (t_matrix *)pd_new(matrix_class);

	t_float rampval = MATRIX_DEFRAMP;
	x->x_numinlets = (int)MATRIX_MININLETS;
	x->x_numoutlets = (int)MATRIX_MINOUTLETS;
	x->x_defgain = MATRIX_DEFGAIN;

	int i;
	int argnum = 0;
	while(argc > 0){
		if(argv -> a_type == A_FLOAT){
			t_float argval = atom_getfloatarg(0, argc, argv);
			switch(argnum){
				case 0:
					if(argval < MATRIX_MININLETS){
						x->x_numinlets = (int)MATRIX_MININLETS;
					}
					else if (argval > MATRIX_MAXINLETS){
						x->x_numinlets = (int)MATRIX_MAXINLETS;
						post("matrix~: resizing to %d signal inlets", (int)MATRIX_MAXINLETS);
					}
					else{
						x->x_numinlets = (int)argval;
					};
					break;
				case 1:
					if(argval < MATRIX_MINOUTLETS){
						x->x_numoutlets = (int)MATRIX_MINOUTLETS;
					}
					else if (argval > MATRIX_MAXOUTLETS){
						x->x_numoutlets = (int)MATRIX_MAXOUTLETS;
						post("matrix~: resizing to %d signal outlets", (int)MATRIX_MAXOUTLETS);
					}
					else{
						x->x_numoutlets = (int)argval;
					};
					break;
				case 2:
					x->x_defgain = argval;
					break;
				default:
					break;
			};
			argc--;
			argv++;
			argnum++;
		}
		else if(argv -> a_type == A_SYMBOL){
			t_symbol *argname = atom_getsymbolarg(0, argc, argv);
			if(strcmp(argname->s_name, "@ramp")==0){
				if(argc >= 2){
					t_float argval = atom_getfloatarg(1, argc, argv);
					if(argval < MATRIX_MINRAMP){
						rampval = MATRIX_MINRAMP;
					}
					else{
						rampval = argval;
					};
					argc -= 2;
					argv += 2;
				}
				else{
					goto errstate;
				};
			}
			else{
				goto errstate;
			};
		}
		else{
			goto errstate;
		};
	};

	int gaingiven = argnum >= 3; //if >=  3 args given, then gain is given, binary mode is off

	x->x_ncells = x->x_numinlets * x->x_numoutlets;
	x->x_ivecs = getbytes(x->x_numinlets * sizeof(*x->x_ivecs));
	x->x_ovecs = getbytes(x->x_numoutlets * sizeof(*x->x_ovecs));
	x->x_nblock = x->x_maxblock = sys_getblksize();
	x->x_osums = getbytes(x->x_numoutlets * sizeof(*x->x_osums));
	for (i = 0; i < x->x_numoutlets; 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));
	/* zerovec for filtering float inputs*/
	x->x_zerovec = getbytes(x->x_maxblock * sizeof(*x->x_zerovec));
	matrix_clear(x);

	if (gaingiven){
	    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, rampval);
	    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_numinlets; i++){
		pd_float( (t_pd *)inlet_new(&x->x_obj, &x->x_obj.ob_pd, &s_signal, &s_signal), -0.);
		x->x_signalscalars[i] = obj_findsignalscalar((t_object *)x, i);
	};
	for (i = 0; i < x->x_numoutlets; i++){
	 	outlet_new(&x->x_obj, gensym("signal"));
	};
	x->x_dumpout = outlet_new((t_object *)x, &s_list);
	x->x_glist = canvas_getcurrent();
	return (x);
	errstate:
		pd_error(x, "matrix~: improper args");
		return NULL;
}
예제 #3
0
파일: x_net.c 프로젝트: Gaz5700/pd-double
static void *netreceive_new(t_symbol *compatflag,
    t_floatarg fportno, t_floatarg udpflag)
{
    t_netreceive *x;
    struct sockaddr_in server;
    int sockfd, portno = fportno, udp = (udpflag != 0);
    int old = !strcmp(compatflag->s_name , "old");
    int intarg;
        /* create a socket */
    sockfd = socket(AF_INET, (udp ? SOCK_DGRAM : SOCK_STREAM), 0);
#if 0
    fprintf(stderr, "receive socket %d\n", sockfd);
#endif
    if (sockfd < 0)
    {
        sys_sockerror("socket");
        return (0);
    }
    server.sin_family = AF_INET;
    server.sin_addr.s_addr = INADDR_ANY;

#if 1
        /* ask OS to allow another Pd to repoen this port after we close it. */
    intarg = 1;
    if (setsockopt(sockfd, SOL_SOCKET, SO_REUSEADDR,
        (char *)&intarg, sizeof(intarg)) < 0)
            post("setsockopt (SO_REUSEADDR) failed\n");
#endif
#if 0
    intarg = 0;
    if (setsockopt(sockfd, SOL_SOCKET, SO_RCVBUF,
        &intarg, sizeof(intarg)) < 0)
            post("setsockopt (SO_RCVBUF) failed\n");
#endif
    intarg = 1;
    if(setsockopt(sockfd, SOL_SOCKET, SO_BROADCAST, 
                  (const void *)&intarg, sizeof(intarg)) < 0)
        post("setting SO_BROADCAST");
        /* Stream (TCP) sockets are set NODELAY */
    if (!udp)
    {
        intarg = 1;
        if (setsockopt(sockfd, IPPROTO_TCP, TCP_NODELAY,
            (char *)&intarg, sizeof(intarg)) < 0)
                post("setsockopt (TCP_NODELAY) failed\n");
    }
        /* assign server port number */
    server.sin_port = htons((u_short)portno);

        /* name the socket */
    if (bind(sockfd, (struct sockaddr *)&server, sizeof(server)) < 0)
    {
        sys_sockerror("bind");
        sys_closesocket(sockfd);
        return (0);
    }
    x = (t_netreceive *)pd_new(netreceive_class);
    if (old)
    {
        /* old style, nonsecure version */
        x->x_msgout = 0;
    }
    else x->x_msgout = outlet_new(&x->x_obj, &s_anything);

    if (udp)        /* datagram protocol */
    {
        t_socketreceiver *y = socketreceiver_new((void *)x, 
            (t_socketnotifier)netreceive_notify,
                (x->x_msgout ? netreceive_doit : 0), 1);
        sys_addpollfn(sockfd, (t_fdpollfn)socketreceiver_read, y);
        x->x_connectout = 0;
    }
    else        /* streaming protocol */
    {
        if (listen(sockfd, 5) < 0)
        {
            sys_sockerror("listen");
            sys_closesocket(sockfd);
            sockfd = -1;
        }
        else
        {
            sys_addpollfn(sockfd, (t_fdpollfn)netreceive_connectpoll, x);
            x->x_connectout = outlet_new(&x->x_obj, &s_float);
        }
    }
    x->x_connectsocket = sockfd;
    x->x_nconnections = 0;
    x->x_udp = udp;

    return (x);
}
예제 #4
0
static void *radialBeamformNew(t_symbol *s, int argc, t_atom *argv) {
    
    RadialBeamform *x = (RadialBeamform *)object_alloc(radialbeameq_class);
    
    int k;
    
    x->z1=0;
    x->z2=0;
    x->a1=0;
    x->a2=0;
    x->b0=0;
    x->b1=0;
    x->num_ma_sec=0;
    x->num_ar_sec=0;
    x->delta_n0=0.3f/343.0f*44100.0f/8.0f;
    x->delta_n=1.5f/343.0f*44100.0f/8.0f;
    x->max_wng=20;
    x->sh_degree=0;
    radialBeamformSetV(x);
    
    /*
    for (k=0; k<argc; k++) {
        if (atom_getsym(&argv[k])==gensym("delta_n0")) {
            k++;
            radialBeamformSetDeltan0 (x,gensym("delta_n0"),argc-k,argv+k);
        }
        else if (atom_getsym(&argv[k])==gensym("delta_n")) {
            k++;
            radialBeamformSetDeltan (x,gensym("delta_n"),argc-k,argv+k);
        }
        else if (atom_getsym(&argv[k])==gensym("wng")) {
            k++;
            radialBeamformSetWNG (x,gensym("wng"),argc-k,argv+k);
        }
        else if (atom_getsym(&argv[k])==gensym("n")) {
            k++;
            radialBeamformSetn (x,gensym("n"),argc-k,argv+k);
        }
        else if (atom_getsym(&argv[k])==gensym("v")) {
            radialBeamformSetV(x);
        }
        else if (atom_getsym(&argv[k])==gensym("p")) {
            radialBeamformSetP(x);
        }
    }
     */
    
    attr_args_process(x, argc, argv);
    
    // one signal in
    dsp_setup((t_pxobject*)x, 1);

    // no inplace
    x->x_obj.z_misc = Z_NO_INPLACE;
    
    // some list out
    x->list_outlet = outlet_new(&x->x_obj, "list");
    
    // one signal out
    outlet_new(&x->x_obj, "signal");

    return x;
}
예제 #5
0
static void *invert_new(t_symbol *s) /* init vals in struc */
{
    t_invert *x = (t_invert *)pd_new(invert_class);
    x->t_out1 = outlet_new(&x->x_obj, 0);
    return(x);
}
예제 #6
0
파일: peak~.c 프로젝트: porres/Porres-ELS
static void *peak_tilde_new(t_symbol *s, int argc, t_atom *argv)
{
    t_sigpeak *x;
    int npoints = 0;
    int period = 0;
    int dbstate = 0;
/////////////////////////////////////////////////////////////////////////////////////
    int argnum = 0;
    while(argc > 0)
    {
        if(argv -> a_type == A_FLOAT)
        { //if current argument is a float
            t_float argval = atom_getfloatarg(0, argc, argv);
            switch(argnum)
            {
                case 0:
                    npoints = argval;
                    break;
                case 1:
                    period = argval;
                    break;
                default:
                    break;
            };
            argnum++;
            argc--;
            argv++;
        }
        else if (argv -> a_type == A_SYMBOL)
        {
            t_symbol *curarg = atom_getsymbolarg(0, argc, argv);
            if(strcmp(curarg->s_name, "-db")==0)
            {
                dbstate = 1;
                argc -= 1;
                argv += 1;
            }
            else
            {
                goto errstate;
            };
        }
    };
/////////////////////////////////////////////////////////////////////////////////////
    if (npoints < 1) npoints = 1024;
    if (period < 1) period = npoints/2;
    if (period < npoints / MAXOVERLAP + 1)
        period = npoints / MAXOVERLAP + 1;
    x = (t_sigpeak *)pd_new(peak_tilde_class);
    x->x_npoints = npoints;
    x->x_phase = 0;
    x->x_value = 0.;
    x->x_period = period;
    x->x_clock = clock_new(x, (t_method)peak_tilde_tick);
    x->x_outlet = outlet_new(&x->x_obj, gensym("float"));
    x->x_allocforvs = INITVSTAKEN;
    x->x_db = dbstate;
    return (x);
    errstate:
        pd_error(x, "rms~: improper args");
        return NULL;
}
예제 #7
0
void *grans_new(t_symbol *s, long argc, t_atom *argv)
{
    int n;
	t_grans *x = (t_grans *)object_alloc(grans_class);
    
	if (x) {
		dsp_setup((t_pxobject *)x, 8);
        
        x->maxoscillators = DEFAULTMAXOSCILLATORS;
        
        if( argc > 0)
        {
            int i;
            t_atom *ap;
            for (i = 0, ap = argv; i < argc; i++, ap++) {
                if(atom_gettype(ap) == A_LONG)
                {
                    switch(i){
                        case 0:
                            n = atom_getlong(ap);
                            x->maxoscillators = n;
                            // object_post((t_object *)x, "%d oscillators initialized", n);
                            break;
                        case 1:
                            n = atom_getlong(ap);
                            x->numoutlets = n;
                            // object_post((t_object *)x, "%d outlets?", n);
                            
                            while(n--){
                                outlet_new(x, "signal");
                            }
                        default:
                            break;
                    }
                }
            }
            
        }
        else
        {
            x->numoutlets = 1;
            outlet_new(x, "signal");
            // outlet_new(x, "signal");
            
        }
		
        x->ob.z_misc |= Z_NO_INPLACE;
        
        
		x->base = (t_osc *)calloc(x->maxoscillators, sizeof(t_osc));
        //		x->modbase = (t_osc *)calloc(x->maxoscillators, sizeof(t_osc));
        
        x->sinetab = (double *)calloc(STABSZ, sizeof(double));
        x->wind_costab = (double *)calloc(STABSZ, sizeof(double));
        x->expdecaytab = (double *)calloc(STABSZ, sizeof(double));
        x->dampedsinetab = (double *)calloc(STABSZ, sizeof(double));
        x->sincwindow = (double *)calloc(STABSZ, sizeof(double));
        
        double coefshape[NSHAPINGTABS];
        
        PowTableFunction(NSHAPINGTABS, coefshape, 1, 0.0001, 1.0, 2.0);
        
        
        x->exptab = (double **)calloc(NSHAPINGTABS, sizeof(double *));
        
        long i;
        for(i = 0; i < NSHAPINGTABS; i++){
            x->exptab[i] = (double *)calloc(STABSZ, sizeof(double));
            if(x->exptab[i])
            {
                PowTableFunction(STABSZ, x->exptab[i], 1, 0.0001, 1.0, coefshape[i] * 10.0);
            } else {
                object_error((t_object *)x, "could not allocate memory for lookup table");
            }
        }
        
        x->samplerate =  sys_getsr();
        if(x->samplerate<=0)
            x->samplerate = 44100;
        
        
        x->sampleinterval = 1.0 / x->samplerate;
        x->pkw = ( STABSZ * x->sampleinterval ) ;
        
        x->maxhz = (x->samplerate / 2) * x->pkw;
        x->nosc = x->next_nosc = 0;
        
        x->prev_in1 = 0.0;
        
        x->sincripples = 5; //could make this an attribute, or maybe compute sinc in realtime...
        
        Makeoscsinetable(x);
        MakeCosWindow(x);
        MakeExpDecaytable(x);
        MakeDampedSineWindow(x);
        MakeSincWindow(x);
        
        grans_clear(x);
        
        x->always_on = 0;
        
        t_dictionary *d = NULL;
        d = dictionary_new();
        
        if (d) {
            attr_args_dictionary(d, argc, argv);
            attr_dictionary_process(x, d);
            object_free(d);
        }
        
        
        
    } else {
        object_post((t_object *)x, "this is potentially bad!");
    }
    
	return (x);
}
예제 #8
0
파일: xtract~.c 프로젝트: tchajed/LibXtract
static void *xtract_tilde_new(t_symbol *me, t_int argc, t_atom *argv) {
    
    t_symbol *tmp;
    t_xtract_tilde *x = (t_xtract_tilde *)newobject(xtract_tilde_class);
    xtract_mel_filter *mf;
    t_int n, N, f, F, n_args, type;
    t_float *argv_max;
    xtract_function_descriptor_t *fd;
    char *p_name, *p_desc, *author;
    int year;

    tmp = NULL;
    p_name = p_desc = author = NULL;
   
    n_args = type = x->feature = 0;

    f = F = XTRACT_FEATURES;

    N = BLOCKSIZE;
    
    x->argv = NULL;
    x->done_init = 0;
    
    if(argc)
	tmp = argv[0].a_w.w_sym; /*atom_getsymbol(argv); */
    if(argc > 1)
	N = (t_int)argv[1].a_w.w_long;

    x->init_blocksize = N;

    /* get function descriptors */
    fd = (xtract_function_descriptor_t *)xtract_make_descriptors();

    /* iterate over descriptors */
    while(f--){
	/* map creation arg to feature */
	if(tmp == gensym(fd[f].algo.name)){ 
	    x->feature = f;
	    break;
	}
    }

    /* allocate memory for feature arguments */
    n_args = fd[f].argc;
    type = fd[f].argv.type;

    if(n_args){
	for(n = 0; n < n_args; n++){
		    argv_max = &fd[f].argv.max[n]; 
		    //post("Argument %d, max: %.2f", n, *argv_max);
	}
	if(type == XTRACT_MEL_FILTER){
	    x->memory.argv = (size_t)(n_args * sizeof(xtract_mel_filter));
	    x->argv = (xtract_mel_filter *)getbytes(x->memory.argv);
	}
	else if(type == XTRACT_INT){
	    x->memory.argv = (size_t)(n_args * sizeof(t_int));
	    x->argv = (t_int *)getbytes(x->memory.argv);
	}
	else if (type == XTRACT_FLOAT){
	    x->memory.argv = (size_t)(n_args * sizeof(t_float));
	    x->argv = (t_float *)getbytes(x->memory.argv);
	}
	else
	    x->memory.argv = 0;
    }


    p_name = fd[f].algo.p_name;
    p_desc = fd[f].algo.p_desc;
    author = fd[f].algo.author;
    year = fd[f].algo.year; 

    if(argc){
	if(strcmp(p_name, ""))	
	    post("xtract~: %s", p_name );
	if(strcmp(p_desc, ""))	
	    post("xtract~: %s", p_desc );
	if(strcmp(author, "") && year)	
	    post("xtract~: %s(%d)", author, year);
    }	
    else
	post("xtract~: No arguments given");
    
    /* do init if needed */
    if(x->feature == XTRACT_MFCC){

        mf = x->argv;
        
        mf->n_filters = 20;
        
        post("xtract~: mfcc: filters = %d", 
		((xtract_mel_filter *)x->argv)->n_filters);
        mf->filters = 
            (t_float **)getbytes(mf->n_filters * sizeof(t_float *));
        for(n = 0; n < mf->n_filters; n++)
            mf->filters[n] = (float *)getbytes(N * sizeof(float));
                 
        xtract_init_mfcc(N, NYQUIST, XTRACT_EQUAL_GAIN, 80.0f,
        18000.0f, mf->n_filters, mf->filters);
    }
    else if(x->feature == XTRACT_BARK_COEFFICIENTS)
        xtract_init_bark(N, NYQUIST, x->argv);
    
    /* Initialise fft_plan if required */
    if(x->feature == XTRACT_AUTOCORRELATION_FFT ||
            x->feature == XTRACT_SPECTRUM ||
            x->feature == XTRACT_DCT){
        xtract_init_fft(N, x->feature);
        x->done_init = 1;
    }

    if(x->feature == XTRACT_AUTOCORRELATION || 
	    x->feature == XTRACT_AUTOCORRELATION_FFT || 
	    x->feature == XTRACT_MFCC || x->feature == XTRACT_AMDF || 
	    x->feature == XTRACT_ASDF|| x->feature == XTRACT_DCT || 
	    x->feature == XTRACT_BARK_COEFFICIENTS || 
	    x->feature == XTRACT_SPECTRUM || 
	    x->feature == XTRACT_PEAK_SPECTRUM || 
	    x->feature == XTRACT_HARMONIC_SPECTRUM) 
	x->feature_type = XTRACT_VECTOR;
                
    else if (x->feature == XTRACT_FLUX || x->feature == XTRACT_ATTACK_TIME || 
            x->feature == XTRACT_DECAY_TIME || x->feature == XTRACT_DELTA) 
        x->feature_type = XTRACT_DELTA;
       
    else x->feature_type = XTRACT_SCALAR;

    /* argv through right inlet */
    inlet_new((t_pxobject *)x, "list"); 

    /* DSP inlet */
    dsp_setup((t_pxobject *)x, 1);


    /* if feature is vector, create signal out */
    if(x->feature_type == XTRACT_VECTOR)  
	outlet_new((t_pxobject *)x, "signal");

    /* otherwise: float */
    else 
	x->outlet = floatout((t_pxobject *)x);

    
    /* free the function descriptors */
    xtract_free_descriptors(fd);
    
    return (void *)x;
}
예제 #9
0
t_outlet* symbolout(void *x)
{
    return outlet_new((t_object *)x, &s_symbol);
}
예제 #10
0
static t_oscparse *oscparse_new(t_symbol *s, int argc, t_atom *argv)
{
    t_oscparse *x = (t_oscparse *)pd_new(oscparse_class);
    outlet_new(&x->x_obj, gensym("list"));
    return (x);
}
예제 #11
0
void *dllreport_new(t_symbol *s, long argc, t_atom *argv)
{
	t_dllreport *x = (t_dllreport *)object_alloc(s_dllreport_class);
	x->d_outlet = outlet_new((t_object *)x, NULL);
	return x;
}
예제 #12
0
static void *loadbang_new(void)
{
    t_loadbang *x = (t_loadbang *)pd_new(loadbang_class);
    outlet_new(&x->x_obj, &s_bang);
    return (x);
}
예제 #13
0
static void *acos_new(void)
{
    t_acos *x = (t_acos *)pd_new(acos_class);
    outlet_new((t_object *)x, &s_signal);
    return (x);
}
예제 #14
0
파일: mtr.c 프로젝트: EQ4/Pd-for-LibPd
static void *mtr_new(t_floatarg f)
{
    t_mtr *x = 0;
    int ntracks = (int)f;
    t_mtrack **tracks;
    if (ntracks < 1)
	ntracks = 1;
    if (tracks = getbytes(ntracks * sizeof(*tracks)))
    {
	int i;
	t_mtrack **tpp;
	for (i = 0, tpp = tracks; i < ntracks; i++, tpp++)
	{
	    if (!(*tpp = (t_mtrack *)pd_new(mtrack_class)) ||
		!((*tpp)->tr_binbuf = binbuf_new()) ||
		!((*tpp)->tr_clock = clock_new(*tpp, (t_method)mtrack_tick)))
	    {
		if (*tpp) pd_free((t_pd *)*tpp);
		if ((*tpp)->tr_binbuf) binbuf_free((*tpp)->tr_binbuf);
		while (i--)
		{
		    tpp--;
		    binbuf_free((*tpp)->tr_binbuf);
		    clock_free((*tpp)->tr_clock);
		    pd_free((t_pd *)*tpp);
		}
		return (0);
	    }
	}
	if (x = (t_mtr *)pd_new(mtr_class))
	{
	    int id;
	    t_outlet *mainout = outlet_new((t_object *)x, &s_list);
	    x->x_glist = canvas_getcurrent();
	    x->x_filehandle = hammerfile_new((t_pd *)x, 0,
					     mtr_readhook, mtr_writehook, 0);
	    if (ntracks > MTR_C74MAXTRACKS)
		fittermax_rangewarning(mtr_class, MTR_C74MAXTRACKS, "tracks");
	    x->x_ntracks = ntracks;
	    x->x_tracks = tracks;
	    for (id = 1; id <= ntracks; id++, tracks++)  /* CHECKED 1-based */
	    {
		t_mtrack *tp = *tracks;
		inlet_new((t_object *)x, (t_pd *)tp, 0, 0);
		tp->tr_trackout = outlet_new((t_object *)x, &s_);
		tp->tr_mainout = mainout;
		tp->tr_owner = x;
		tp->tr_id = id;
		tp->tr_listed = 0;
		tp->tr_filehandle =  /* LATER rethink */
		    hammerfile_new((t_pd *)tp, 0,
				   mtrack_readhook, mtrack_writehook, 0);
		tp->tr_mode = MTR_STEPMODE;
		tp->tr_muted = 0;
		tp->tr_restarted = 0;
		tp->tr_atdelta = 0;
		tp->tr_ixnext = 0;
		tp->tr_tempo = 1.;
		tp->tr_clockdelay = 0.;
		tp->tr_prevtime = 0.;
	    }
	}
    }
    return (x);
}
예제 #15
0
파일: tanx.c 프로젝트: amurtet/pd-cyclone
static void *tanx_new(void)
{
    t_tanx *x = (t_tanx *)pd_new(tanx_class);
    outlet_new((t_object *)x, &s_signal);
    return (x);
}
예제 #16
0
t_outlet* listout(void *x)
{
    return outlet_new((t_object *)x, &s_list);
}
예제 #17
0
파일: avg~.c 프로젝트: iem-projects/pd-zexy
static void *avg_new(void)
{
  t_avg *x = (t_avg *)pd_new(avg_class);
  outlet_new(&x->x_obj, gensym("float"));
  return (x);
}
예제 #18
0
t_outlet* floatout(void *x)
{
    return outlet_new((t_object *)x, &s_float);
}
예제 #19
0
void *granufm_new(t_symbol *s, long argc, t_atom *argv)
{
    int n;
	t_grans *x = (t_grans *)pd_new(granufm_class);
    
	if (x) {
        
        x->numinlets = 8;
        for(n = 0; n < x->numinlets; n++)
            inlet_new(&x->ob, &x->ob.ob_pd, &s_signal, &s_signal);
        
        x->maxoscillators = DEFAULTMAXOSCILLATORS;
        
        
        x->x_arrayname = NULL;
        x->x_npoints = 0;
        x->x_vec = 0;
        
        if( argc > 0)
        {
            int i;
            t_atom *ap;
            for (i = 0, ap = argv; i < argc; i++, ap++) {
                if(ap->a_type == A_FLOAT)
                {
                    switch(i){
                        case 0:
                            n = atom_getfloat(ap);
                            x->maxoscillators = (int)n;
                            // object_post((t_object *)x, "%d oscillators initialized", n);
                            break;
                        case 1:
                            n = atom_getfloat(ap);
                            x->numoutlets = n;
                            // object_post((t_object *)x, "%d outlets?", n);
                            
                            while(n--){
                                outlet_new(&x->ob, &s_signal);
                            }
                        default:
                            break;
                    }
                }
                else if(ap->a_type == A_SYMBOL)
                {
                    //pseudo attributes here
                    //@envbuffer
                    //(@buffer for granubuf)
                
                }

            }
            
        }
        else
        {
            x->numoutlets = 1;
            outlet_new(&x->ob, &s_signal);
            
        }
		
    //    x->ob.z_misc |= Z_NO_INPLACE;
        
        x->w = (t_int **)malloc((x->numoutlets + x->numinlets + 2) * sizeof(t_int *)); //DSP vector array
        
		x->base = (t_osc *)calloc(x->maxoscillators, sizeof(t_osc));

        x->samplerate =  sys_getsr();
        if(x->samplerate<=0)
            x->samplerate = 44100;
        
        
        x->sampleinterval = 1.0 / x->samplerate;
        x->pkw = ( STABSZ * x->sampleinterval ) ;
        
        x->maxhz = (x->samplerate / 2) * x->pkw;
        x->nosc = x->next_nosc = 0;
        
        x->prev_in1 = 0.0;
        
       // x->sincripples = 5; //could make this an attribute, or maybe compute sinc in realtime...
       // I just made it a #define macro in the pd rev
        
        grans_clear(x);
        
        x->always_on = 0;
        
        
    } else {
        post("this is potentially bad!");
    }
    
	return (x);
}
예제 #20
0
t_outlet* bangout(void *x)
{
    return outlet_new((t_object *)x, &s_bang);
}
예제 #21
0
파일: sigzero~.c 프로젝트: Angeldude/pd
static void *sigzero_new(void)
{
  t_sigzero *x = (t_sigzero *)pd_new(sigzero_class);
  outlet_new(&x->x_obj, gensym("float"));
  return (x);
}
예제 #22
0
t_outlet* anythingout(void *x)
{
    return outlet_new((t_object *)x, &s_anything);
}
예제 #23
0
파일: j.in.cpp 프로젝트: EQ4/JamomaPureData
void WrappedInputClass_new(TTPtr self, long argc, t_atom *argv)
{
	WrappedModularInstancePtr	x = (WrappedModularInstancePtr)self;
 	long						attrstart = attr_args_offset(argc, argv);			// support normal arguments
	TTString					sInstance;
	TTValue						v;
	
	// Prepare extra data
	x->extra = (t_extra*)malloc(sizeof(t_extra));
	
	// Get input instance symbol
	if (attrstart && argv) {
		
		jamoma_ttvalue_from_Atom(v, _sym_nothing, attrstart, argv);
		
		v.toString();
		sInstance = TTString(v[0]);
		EXTRA->instance = TTSymbol(sInstance.data());
	}
	else
		EXTRA->instance = kTTSymEmpty;
    
    // set no model or view by default
    EXTRA->modelOrView = NULL;
		
	// Create Input Object and one outlet
	x->outlets = (TTHandle)sysmem_newptr(sizeof(TTPtr));
		
#ifdef J_IN_TILDE
	jamoma_input_create_audio((t_object*)x, x->wrappedObject);
	 
	dsp_setup((t_pxobject *)x, 1);	
	x->obj.z_misc = Z_NO_INPLACE | Z_PUT_FIRST;
	
	outlet_new((t_pxobject *)x, "signal");
	
#endif
    
#ifdef J_IN_MULTI
    
    jamoma_input_create_audio((t_object*)x, x->wrappedObject);
	
	x->outlets[0] = outlet_new(x, 0L);
#endif

#ifndef J_IN_TILDE
#ifndef J_IN_MULTI
	jamoma_input_create((t_object*)x, x->wrappedObject);
	
    x->outlets[0] = outlet_new((t_object*)x, 0L);
#endif
#endif

	// handle attribute args
	attr_args_process(x, argc, argv);

	// The following must be deferred because we have to interrogate our box,
	// and our box is not yet valid until we have finished instantiating the object.
	// Trying to use a loadbang method instead is also not fully successful (as of Max 5.0.6)
    // in_subscribe(x);
//	defer_low((t_object*)x, (method)in_subscribe, NULL, 0, NULL);
}
예제 #24
0
파일: pong.c 프로젝트: jwmatthys/pd-cyclone
static void *pong_new(t_symbol *s, int argc, t_atom *argv){
	//two optional args (lo, hi), then attributes for mode (str) and range (2 fl)
	t_pong *x = (t_pong *)pd_new(pong_class);
	int numargs = 0;//number of args read
	int pastargs = 0; //if any attrs have been declared yet
	x->minval = CYPONGLO_DEF;
	x->maxval = CYPONGHI_DEF;
	x->mode = CYPONGMODE_DEF;
	while(argc > 0 ){
		t_symbol *curarg = atom_getsymbolarg(0, argc, argv); //returns nullpointer if not symbol
			if(curarg == &s_){ //if nullpointer, should be float or int
				if(!pastargs){//if we aren't past the args yet
					switch(numargs){
						case 0: 	x->minval = atom_getfloatarg(0, argc, argv);
									numargs++;
									argc--;
									argv++;
									break;
					
						case 1: 	x->maxval = atom_getfloatarg(0, argc, argv);
									numargs++;
									argc--;
									argv++;
									break;
					
						default:	argc--;
									argv++;
									break;
					};
				}
				else{
					argc--;
					argv++;
				};
			}
			else{
			pastargs = 1;
			int isrange = strcmp(curarg->s_name, "@range") == 0;
			int ismode = strcmp(curarg->s_name, "@mode") == 0;
			if(isrange && argc >= 3){
					t_symbol *arg1 = atom_getsymbolarg(1, argc, argv);
					t_symbol *arg2 = atom_getsymbolarg(2, argc, argv);
					if(arg1 == &s_ && arg2 == &s_){
						x->minval = atom_getfloatarg(1, argc, argv);
						x->maxval = atom_getfloatarg(2, argc, argv);
						argc -= 3;
						argv += 3;
					}
					else{
						goto errstate;
					};}
	
			else if(ismode && argc >= 2){
					t_symbol *arg3 = atom_getsymbolarg(1, argc, argv);
					if(arg3 != &s_){
						x->mode = pong_setmode_help(arg3->s_name);
						argc -= 2;
						argv += 2;
					}
					else{
						goto errstate;
					};}
			else{
				goto errstate;
			};	};
	};

	floatinlet_new(&x->x_obj, &x->minval);
	floatinlet_new(&x->x_obj, &x->maxval);
	outlet_new(&x->x_obj, gensym("list"));
	return (x);
	errstate:
		pd_error(x, "pong: improper args");
		return NULL;
}
예제 #25
0
파일: n_CNLMS~.c 프로젝트: IcaroL2ORK/pd
static void *n_CNLMS_tilde_new(t_symbol *s, t_int argc, t_atom *argv)
{
  t_n_CNLMS_tilde *x = (t_n_CNLMS_tilde *)pd_new(n_CNLMS_tilde_class);
  char buffer[400];
  int i;
  t_int n_order=39, n_io=1;
  t_symbol    *w_name;
  t_float beta=0.1f;
  t_float gamma=0.00001f;
  t_float kappa = 1.0f;
  
  if((argc >= 6) &&
    IS_A_FLOAT(argv,0) &&   //IS_A_FLOAT/SYMBOL from iemlib.h
    IS_A_FLOAT(argv,1) &&
    IS_A_FLOAT(argv,2) &&
    IS_A_FLOAT(argv,3) &&
    IS_A_FLOAT(argv,4) &&
    IS_A_SYMBOL(argv,5))
  {
    n_io = (t_int)atom_getintarg(0, argc, argv);
    n_order = (t_int)atom_getintarg(1, argc, argv);
    beta    = (t_float)atom_getfloatarg(2, argc, argv);
    gamma   = (t_float)atom_getfloatarg(3, argc, argv);
    kappa   = (t_float)atom_getfloatarg(4, argc, argv);
    w_name  = (t_symbol *)atom_getsymbolarg(5, argc, argv);
    
    if(beta < 0.0f)
      beta = 0.0f;
    if(beta > 2.0f)
      beta = 2.0f;
    
    if(gamma < 0.0f)
      gamma = 0.0f;
    if(gamma > 1.0f)
      gamma = 1.0f;
    
    if(kappa < 0.0001f)
      kappa = 0.0001f;
    if(kappa > 10000.0f)
      kappa = 10000.0f;
    
    if(n_order < 2)
      n_order = 2;
    if(n_order > 11111)
      n_order = 11111;
    
    if(n_io < 1)
      n_io = 1;
    if(n_io > 60)
      n_io = 60;
    
    for(i=0; i<n_io; i++)
      inlet_new(&x->x_obj, &x->x_obj.ob_pd, &s_signal, &s_signal);
    for(i=0; i<=n_io; i++)
      outlet_new(&x->x_obj, &s_signal);
    
    x->x_out_compressing_bang = outlet_new(&x->x_obj, &s_bang);
    
    x->x_msi = 0;
    x->x_n_io = n_io;
    x->x_n_order = n_order;
    x->x_update = 0;
    x->x_beta = beta;
    x->x_gamma = gamma;
    x->x_kappa = kappa;
    x->x_my_kern = (t_n_CNLMS_tilde_kern *)getbytes(x->x_n_io*sizeof(t_n_CNLMS_tilde_kern));
    for(i=0; i<n_io; i++)
    {
      sprintf(buffer, "%d_%s", i+1, w_name->s_name);
      x->x_my_kern[i].x_w_array_sym_name = gensym(buffer);
      x->x_my_kern[i].x_w_array_mem_beg = (t_float *)0;
      x->x_my_kern[i].x_in_hist = (t_float *)getbytes(2*x->x_n_order*sizeof(t_float));
    }
    x->x_clock = clock_new(x, (t_method)n_CNLMS_tilde_tick);
    
    return(x);
  }
  else
  {
    post("n_CNLMSC~-ERROR: need 5 float- + 1 symbol-arguments:");
    post("  number_of_filters + order_of_filters + learnrate_beta + security_value_gamma + threshold_kappa + array_name_taps");
    return(0);
  }
}
예제 #26
0
파일: iCircle2D.c 프로젝트: Angeldude/pd
void *iCircle2D_new(t_symbol *s, int argc, t_atom *argv)
{
  t_iCircle2D *x = (t_iCircle2D *)pd_new(iCircle2D_class);

  x->x_sym = atom_getsymbolarg(0, argc, argv);

  x->force_new=outlet_new(&x->x_obj, 0);
  
  if (argc>=19)
    SETFLOAT(&(x->force[19]), atom_getfloatarg(18, argc, argv));
  else
    SETFLOAT(&(x->force[19]), 0);

  if (argc>=18)
    SETFLOAT(&(x->force[18]), atom_getfloatarg(17, argc, argv));
  else
    SETFLOAT(&(x->force[18]), 0);

 if (argc>=17)
    SETFLOAT(&(x->force[17]), atom_getfloatarg(16, argc, argv));
  else
    SETFLOAT(&(x->force[17]), 0);

  if (argc>=16)
    SETFLOAT(&(x->force[16]), atom_getfloatarg(15, argc, argv));
  else
    SETFLOAT(&(x->force[16]), 0);

    if (argc>=15)
    SETFLOAT(&(x->force[13]), atom_getfloatarg(14, argc, argv));
  else
    SETFLOAT(&(x->force[13]), 0);

  if (argc>=14)
    SETFLOAT(&(x->force[12]), atom_getfloatarg(13, argc, argv));
  else
    SETFLOAT(&(x->force[12]), 0);

  if (argc>=13)
    SETFLOAT(&(x->force[11]), atom_getfloatarg(12, argc, argv));
  else
    SETFLOAT(&(x->force[11]), 0);
 
  if (argc>=12)
    SETFLOAT(&(x->force[10]), atom_getfloatarg(11, argc, argv));
  else
    SETFLOAT(&(x->force[10]), 0);

  if (argc>=11)
    SETFLOAT(&(x->force[9]), atom_getfloatarg(10, argc, argv));
  else
    SETFLOAT(&(x->force[9]), 0);
 
  if (argc>=10)
    SETFLOAT(&(x->force[8]), atom_getfloatarg(9, argc, argv));
  else
    SETFLOAT(&(x->force[8]), 0);

  if (argc>=9)
    SETFLOAT(&(x->force[7]), atom_getfloatarg(8, argc, argv));
  else
    SETFLOAT(&(x->force[7]), 0);

  if (argc>=8)
    SETFLOAT(&(x->force[6]), atom_getfloatarg(7, argc, argv));
  else
    SETFLOAT(&(x->force[6]), 0);

    if (argc>=7)
    SETFLOAT(&(x->force[5]), atom_getfloatarg(6, argc, argv));
  else
    SETFLOAT(&(x->force[5]), 0);

    if (argc>=6)
    SETFLOAT(&(x->force[4]), atom_getfloatarg(5, argc, argv));
  else
    SETFLOAT(&(x->force[4]), 0);

  if (argc>=5)
    SETFLOAT(&(x->force[3]), atom_getfloatarg(4, argc, argv));
  else
    SETFLOAT(&(x->force[3]), 1);

  if (argc>=4)
    SETFLOAT(&(x->force[2]), atom_getfloatarg(3, argc, argv));
  else
    SETFLOAT(&(x->force[2]), 0);

  if (argc>=3)
  {
    SETFLOAT(&(x->force[1]), atom_getfloatarg(2, argc, argv));
    SETFLOAT(&(x->force[15]), atom_getfloatarg(2, argc, argv));
    x->posY_old = atom_getfloatarg(2, argc, argv);
  }
  else
  {
	  SETFLOAT(&(x->force[1]), 0);
 	  SETFLOAT(&(x->force[15]), 0);
  	  x->posY_old = 0;
  }

  if (argc>=2)
  {
	  SETFLOAT(&(x->force[0]), atom_getfloatarg(1, argc, argv));
	  SETFLOAT(&(x->force[14]), atom_getfloatarg(1, argc, argv));
	  x->posX_old = atom_getfloatarg(1, argc, argv);
  }
  else
  {
	  SETFLOAT(&(x->force[0]), 0);
	  SETFLOAT(&(x->force[14]), 0);
	  x->posX_old = 0;
  }

  return (x);
}
예제 #27
0
파일: NLMSerr_in~.c 프로젝트: Angeldude/pd
static void *NLMSerr_in_tilde_new(t_symbol *s, t_int argc, t_atom *argv)
{
    t_NLMSerr_in_tilde *x = (t_NLMSerr_in_tilde *)pd_new(NLMSerr_in_tilde_class);
    t_int i, n_order=39;
    t_symbol    *w_name;
    t_float beta=0.01f;
    t_float gammax=0.00001f;
    
    if((argc >= 4) &&
        IS_A_FLOAT(argv,0) &&   //IS_A_FLOAT/SYMBOL from iemlib.h
        IS_A_FLOAT(argv,1) &&
        IS_A_FLOAT(argv,2) &&
        IS_A_SYMBOL(argv,3))
    {
        n_order = (t_int)atom_getintarg(0, argc, argv);
        beta    = (t_float)atom_getfloatarg(1, argc, argv);
        gammax  = (t_float)atom_getfloatarg(2, argc, argv);
        w_name  = (t_symbol *)atom_getsymbolarg(3, argc, argv);
        
        if(beta < 0.0f)
            beta = 0.0f;
        if(beta > 2.0f)
            beta = 2.0f;
        
        if(gammax < 0.0f)
            gammax = 0.0f;
        if(gammax > 1.0f)
            gammax = 1.0f;
        
        if(n_order < 2)
            n_order = 2;
        if(n_order > 1111111)
            n_order = 1111111;
        
        inlet_new(&x->x_obj, &x->x_obj.ob_pd, &s_signal, &s_signal);
        inlet_new(&x->x_obj, &x->x_obj.ob_pd, &s_signal, &s_signal);
        outlet_new(&x->x_obj, &s_signal);
        
        x->x_flt_sig_in1 = 0;
        x->x_n_order = n_order;
        x->x_update = 0;
        x->x_beta = beta;
        x->x_gamma = gammax;
        // 2 times in and one time err_in memory allocation (history)
        x->x_ref_filt_in_hist = (t_float *)getbytes(x->x_n_order*sizeof(t_float));
        x->x_ref_adapt_in_hist = (t_float *)getbytes(x->x_n_order*sizeof(t_float));
        
        // table-symbols will be linked to their memory in future (dsp_routine)
        x->x_w_array_sym_name = gensym(w_name->s_name);
        x->x_w_array_mem_beg = (t_float *)0;
        
        x->x_rw_index = 0;
        
        return(x);
    }
    else
    {
        post("NLMSerr_in~-ERROR: need 3 float- + 1 symbol-arguments:");
        post("  order_of_filter + learnrate_beta + security_value + array_name_taps");
        return(0);
    }
}
예제 #28
0
static t_grid *grid_new(t_symbol *s, int argc, t_atom *argv)
{
    int zz;
    t_grid *x;
    char *str;

    // post( "grid_new : create : %s argc =%d", s->s_name, argc );

    x = (t_grid *)pd_new(grid_class);
    // new grid created from the gui
    if ( argc != 0 )
    {
        if ( argc != 14 )
        {
            pd_error(x, "grid : error in the number of arguments ( %d instead of 14 )", argc );
            return NULL;
        }
        if ( argv[0].a_type != A_SYMBOL || argv[1].a_type != A_FLOAT ||
                argv[2].a_type != A_FLOAT || argv[3].a_type != A_FLOAT ||
                argv[4].a_type != A_FLOAT || argv[5].a_type != A_FLOAT ||
                argv[6].a_type != A_FLOAT || argv[7].a_type != A_FLOAT ||
                argv[8].a_type != A_FLOAT || argv[9].a_type != A_FLOAT ||
                argv[10].a_type != A_FLOAT || argv[11].a_type != A_FLOAT ||
                argv[12].a_type != A_FLOAT || argv[13].a_type != A_FLOAT )
        {
            pd_error(x, "grid : wrong arguments" );
            return NULL;
        }

        // update grid count
        if (!strncmp((str = argv[0].a_w.w_symbol->s_name), "grid", 5)
                && (zz = atoi(str + 5)) > gridcount)
        {
            gridcount = zz;
        }
        x->x_name = argv[0].a_w.w_symbol;
        pd_bind(&x->x_obj.ob_pd, x->x_name);
        x->x_width = argv[1].a_w.w_float;
        x->x_min = argv[2].a_w.w_float;
        x->x_max = argv[3].a_w.w_float;
        x->x_height = argv[4].a_w.w_float;
        x->y_min = argv[5].a_w.w_float;
        x->y_max = argv[6].a_w.w_float;
        x->x_grid = argv[7].a_w.w_float;
        x->x_xstep = argv[8].a_w.w_float;
        x->x_ystep = argv[9].a_w.w_float;
        x->x_xlines = argv[10].a_w.w_float;
        x->x_ylines = argv[11].a_w.w_float;
        x->x_current = argv[12].a_w.w_float;
        x->y_current = argv[13].a_w.w_float;
        x->x_point = 1;
    }
    else
    {
        char buf[40];

        sprintf(buf, "grid%d", ++gridcount);
        s = gensym(buf);

        x->x_name = s;
        pd_bind(&x->x_obj.ob_pd, x->x_name);

        x->x_width = DEFAULT_GRID_WIDTH;
        x->x_min = 0;
        x->x_max = DEFAULT_GRID_WIDTH - 1;
        x->x_height = DEFAULT_GRID_HEIGHT;
        x->y_min = 0;
        x->y_max = DEFAULT_GRID_HEIGHT - 1;
        x->x_grid = 1;
        x->x_xstep = 1.0;
        x->x_ystep = 1.0;
        x->x_xlines = DEFAULT_GRID_NBLINES;
        x->x_ylines = DEFAULT_GRID_NBLINES;
        x->x_current = 0;
        x->y_current = 0;

    }

    // common fields for new and restored grids
    x->x_point = 0;
    x->x_selected = 0;
    x->x_glist = (t_glist *) canvas_getcurrent();
    x->x_xoutlet = outlet_new(&x->x_obj, &s_float );
    x->x_youtlet = outlet_new(&x->x_obj, &s_float );

    x->x_bgcolor = (char*)getbytes(12);
    strcpy( x->x_bgcolor, "#123589" );

    // post( "grid_new name : %s width: %d height : %d", x->x_name->s_name, x->x_width, x->x_height );

    return (x);
}
예제 #29
0
static void *iem_append_kernel_new(void)
{
  t_iem_append_kernel *x = (t_iem_append_kernel *)pd_new(iem_append_kernel_class);
  t_glist *glist = (t_glist *)canvas_getcurrent();
  t_canvas *canvas=glist_getcanvas(glist);
  int ac=0;
  t_atom *av;
  
  canvas_setcurrent(canvas);
  canvas_getargs(&ac, &av);
  canvas_unsetcurrent(canvas);
  
  x->x_type1 = A_NULL;
  x->x_sym1 = &s_list;
  x->x_size2 = 10;
  if(ac > 5)
    x->x_size2 = 2*ac;
  x->x_at2 = (t_atom *)getbytes(x->x_size2 * sizeof(t_atom));
  x->x_size12 = x->x_size2 + 10;
  x->x_at12 = (t_atom *)getbytes(x->x_size12 * sizeof(t_atom));
  x->x_ac1 = 0;
  x->x_inlet_select = 1;
  if(ac <= 0)
  {
    x->x_type2 = A_NULL;
    x->x_ac2 = 0;
    x->x_sym2 = &s_list;
  }
  else
  {
    if(IS_A_FLOAT(av, 0))
    {
      if(ac == 1)
        iem_append_kernel_float(x, atom_getfloat(av));
      else
        iem_append_kernel_list(x, &s_list, ac, av);
    }
    else if(IS_A_SYMBOL(av, 0))
    {
      t_symbol *xsym=atom_getsymbol(av);
      
      if(xsym == gensym("symbol"))
      {
        if(ac > 1)
          iem_append_kernel_symbol(x, atom_getsymbol(av+1));
        else
          iem_append_kernel_symbol(x, gensym(""));
      }
      else if(xsym == gensym("float"))
      {
        if(ac > 1)
        {
          if(IS_A_FLOAT(av, 1))
            iem_append_kernel_float(x, atom_getfloat(av+1));
          else
            iem_append_kernel_float(x, 0.0f);
        }
        else
          iem_append_kernel_float(x, 0.0f);
      }
      else if(xsym == gensym("list"))
      {
        iem_append_kernel_list(x, &s_list, ac-1, av+1);
      }
      else
      {
        iem_append_kernel_anything(x, xsym, ac-1, av+1);
      }
    }
  }
  outlet_new(&x->x_obj, &s_list);
  return (x);
}
예제 #30
0
static void *abl_link_state_new(void) {
    t_abl_link_state *x = (t_abl_link_state *)pd_new(abl_link_state_class);
    x->quantum_out = outlet_new(&x->obj, &s_float);
    x->tempo_out = outlet_new(&x->obj, &s_float);
    return x;
}