コード例 #1
0
void *breakpoints_new(t_symbol *s, int argc, t_atom *argv)
{
    t_binbuf* d = binbuf_via_atoms(argc,argv);
	t_breakpoints *x = (t_breakpoints *)eobj_new(breakpoints_class);
    if(x && d)
    {
        x->f_outline_mode = 0;
        long flags = 0
        | EBOX_GROWINDI
        ;
        ebox_new((t_ebox *)x, flags);
        
        x->f_out_float = (t_outlet *)floatout(x);
        x->f_out_list = (t_outlet *)listout(x);
        x->f_out_function = (t_outlet *)listout(x);
        
        x->f_number_of_points = 0;
        x->f_point_hover    = -1;
        x->f_point_selected = -1;
        x->f_output_inc     = -1;
        x->f_output_nextprev = 0;
        x->f_point_last_created = -1;
        x->f_mouse.x = -666666;
        x->f_mouse.y = -666666;
        
        x->f_clock = clock_new(x, (t_method)breakpoints_inc);
        
        ebox_attrprocess_viabinbuf(x, d);
        breakpoints_init(x, d);
        ebox_ready((t_ebox *)x);
    }
    
    return (x);
}
コード例 #2
0
void *EermMaxNew(Symbol *s, short ac, Atom *av)
{
	int nnodes = KNNodesDefault;
	int nmaxsimplices = KNMaxSimplicesDefault;
	int nmaxtokens = KNMaxTokensDefault;
	int Nf = KNfDefault;
	float dt = KDtInMsDefault;
	EermMax *m;

	MTraceCall("eermMax:\tNew..");

	unused(s);
	
	arg_num(nnodes,0,ac,av);
	arg_num(nmaxsimplices,1,ac,av);
	arg_num(nmaxtokens,2,ac,av);
	arg_num(Nf,3,ac,av);
	arg_num(dt,4,ac,av);

	MTrace5("eermMax:\tNew: nnodes=%d, nmaxsimp=%d, nmaxt=%d, Nf=%d, dt=%f",
		nnodes, nmaxsimplices, nmaxtokens, Nf, dt);
		
	m = (EermMax *)newobject(EermMaxClass);
	m->e = EermNew(nnodes, nmaxsimplices, nmaxtokens, Nf, dt);

	m->DoClock = 0;
	
	m->xout = listout(m);
	m->out = listout(m);
	
	EermMaxLabelsNew(m);
	
	MTraceCall("eermMax:\tNew finished.");
	return (m);
}
コード例 #3
0
void *ibufconcatenate_new (t_symbol *buffer_name, long max_mode)
{
    t_ibufconcatenate *x = (t_ibufconcatenate *)object_alloc (this_class);
	
	x->last_added_out = listout(x);

	if (!max_mode)
	{
		dsp_setup((t_pxobject *)x, 1);
		outlet_new((t_object *)x, "signal");
		outlet_new((t_object *)x, "signal");
		outlet_new((t_object *)x, "signal");
		outlet_new((t_object *)x, "signal");
	}
	else
	{
		x->data_out = listout(x);
	}
	
	x->attachment = new_ibufconcatenate_info(buffer_name);
	
	if (!x->attachment)
		return 0;
	
	x->max_mode = max_mode;
	
	return(x);
}
コード例 #4
0
void *gold_new(long n)
{
	t_gold *x; 
	x = (t_gold *)object_alloc(gold_class);
	if(x){
		x->g_out2 = listout(x);
		x->g_outlet = listout(x);
		x->g_result = 0;
		x->g_goldie = ((sqrt(5) -1.0) * 0.5) ;
	}
	return x;
}
コード例 #5
0
ファイル: bthresher~.c プロジェクト: Angeldude/pd
void *bthresher_new(t_symbol *s, int argc, t_atom *argv)
{
#if MSP
  t_bthresher *x = (t_bthresher *)newobject(bthresher_class);
  x->list_outlet = listout((t_pxobject *)x);
  dsp_setup((t_pxobject *)x,3);
  outlet_new((t_pxobject *)x, "signal");
#endif

#if PD
    t_bthresher *x = (t_bthresher *)pd_new(bthresher_class);
    inlet_new(&x->x_obj, &x->x_obj.ob_pd, gensym("signal"), gensym("signal"));
    inlet_new(&x->x_obj, &x->x_obj.ob_pd, gensym("signal"), gensym("signal"));
    outlet_new(&x->x_obj, gensym("signal"));
    x->list_outlet = outlet_new(&x->x_obj,gensym("list"));
#endif


  x->D = sys_getblksize();
  x->R = sys_getsr();
  
  x->init_thresh = atom_getfloatarg(0,argc,argv);
  x->init_damping = atom_getfloatarg(1,argc,argv);
  x->overlap = atom_getintarg(2,argc,argv);
  x->winfac = atom_getintarg(3,argc,argv);
  
  bthresher_init(x,0);
  


  return (x);
}
コード例 #6
0
void *r2y_new(long n, long m)
{
	t_r2y *x;
	t_atom *thelist;
	
	x = (t_r2y *)object_alloc(r2y_class);
	if(x) {
		thelist = x->y_thelist;

		x->y_outlet = listout(x);
		
		if(n > 0){			// arg1
			x->y_switchflag = 1;
		}else{
			x->y_switchflag = 0;
		}
				
		if(m){				// arg2
			x->y_yuvoffset = m;
		}else{
			x->y_yuvoffset = 16;
		}
	}
	return x;
}
コード例 #7
0
ファイル: SDIF-ranges.c プロジェクト: CNMAT/CNMAT-Externs
void *SDIFranges_new(t_symbol *dummy, short argc, t_atom *argv) {
	SDIFranges *x;
	int i;
	
	// post("SDIFranges_new: %s, %ld args", s->s_name, (long) argc);
	
	x = object_alloc(SDIFranges_class);
	if(!x){
		return NULL;
	}
	x->t_buffer = 0;
	x->t_out = listout(x);
	
	if (argc >= 1) {
		// First argument is name of SDIF-buffer
		if (argv[0].a_type != A_SYM) {
			object_error((t_object *)x, NAME ": argument must be name of an SDIF-buffer");
		} else {
			// post("* You want SDIF-buffer %s", argv[0].a_w.w_sym->s_name);
			x->t_bufferSym = argv[0].a_w.w_sym;
		}
	}
	
	x->t_buf = NULL;

	return (x);
}
コード例 #8
0
ファイル: 2threshattack~.c プロジェクト: CNMAT/CNMAT-Externs
void *tta_new(double l, double h) {
	t_tta *x;
	
	// double taua=0, taur=0;	
	
	x = (t_tta *)object_alloc(tta_class);
	if(!x){
		return NULL;
	}
  // dynamic alloc
  	dsp_setup((t_pxobject *)x,2);  // two inlets
    x->event_outlet = listout (x);	
	outlet_new((t_object *)x,"signal");
	
	// post("Args: low %f, high %f", l, h);
	
	if (l == 0.0) {
		l = 0.25;
	}
	
	if (h == 0.0) {
		h = 0.75;
	}
	
	x->low = l;
	x->high = h;

	x->in_attack = 0;
    return x;
}
コード例 #9
0
ファイル: hoa.space_old.cpp プロジェクト: dimibil/HoaLibrary
void *space_new(t_symbol *s, int argc, t_atom *argv)
{
	t_space *x =  NULL; 
	t_dictionary *d;
	long flags;
	
	if (!(d = object_dictionaryarg(argc,argv)))
		return NULL;

	x = (t_space *)object_alloc(space_class);
	flags = 0 
			| JBOX_DRAWFIRSTIN 
			| JBOX_DRAWINLAST
			| JBOX_TRANSPARENT	
			| JBOX_GROWY
			;
    x->f_number_of_microphones_initialized = false;

	x->f_viewer				= new AmbisonicViewer(1);
    x->f_recomposer         = new ambisonicRecomposer(1, 3);
    
	jbox_new((t_jbox *)x, flags, argc, argv);
	x->j_box.b_firstin = (t_object *)x;

	x->f_outInfos	= outlet_new(x, NULL);
    x->f_out        = listout(x);
    dictionary_getfloat(d, gensym("coeffs"), x->f_microphonesValues);
	attr_dictionary_process(x, d);
	jbox_ready((t_jbox *)x);

	return (x);
}			
コード例 #10
0
void *hoa_space_new(t_symbol *s, int argc, t_atom *argv)
{
    t_hoa_space *x = NULL;
    t_binbuf *d;
	long flags;
    
    if (!(d = binbuf_via_atoms(argc, argv)))
		return NULL;
    
    x = (t_hoa_space *)eobj_new(hoa_space_class);
    x->f_viewer                 = new AmbisonicViewer(1);
    x->f_recomposer             = new AmbisonicRecomposer(1, 4);
    
    x->f_out                    = listout(x);
    x->f_number_of_microphones  = 4;
    x->f_new_number             = 4;
    x->f_defer                  = clock_new(x, (t_method)hoa_space_do_channels_set);

    flags = 0
    | EBOX_GROWLINK
    ;
    ebox_new((t_ebox *)x, flags);
    
    
    ebox_attrprocess_viabinbuf(x, d);
    ebox_ready((t_ebox *)x);
    return (x);
}
コード例 #11
0
void *dpoltocar_new(t_symbol *s, short ac, t_atom *av)
{
	t_dpoltocar *x;
	x = (t_dpoltocar *)object_alloc(dpoltocar_class);
	if(x) {
		x->d_outlet = listout(x);

		t_ptr_size attrstart = attr_args_offset(ac, av);		// support normal arguments
		
		if((attrstart != 0) && (av)) {
			int argument = atom_getlong(&av[0]);
			if(argument == 0){
				x->d_mode = 0;
			}else{
				x->d_mode = 1;
			}
		}
		object_attr_setlong(x, gensym("mode"), x->d_mode);
		attr_args_process(x, ac, av);
		
		x->d_operational[0]=0;
		x->d_operational[1]=0;
		x->d_operational[2]=0;
	}
	return x;
}
コード例 #12
0
ファイル: tpeq-sinelist.c プロジェクト: CNMAT/CNMAT-Externs
void *tpeq_sinelist_new(long maxpartials) {
	tpeq_sinelist *x;
	int i;
				
	x = newobject(tpeq_sinelist_class);		// get memory for a new object & initialize	
	x->o_outlet = listout(x);

	if (maxpartials <= 0) maxpartials = DEFAULT_MAX_PARTIALS;

	x->n = 1;
	x->findex[0] = 0.f;     /* Doesn't matter, since n==1 */
	x->gains[0] = 0.f;	    /* Sets all gains to zero Db as default */
	x->maxpartials = maxpartials;
	x->validFactors = maxpartials;
	/* Output list has 2 Atoms per partials: freq, amp */
	x->outputlist = (Atom *) getbytes(2 * maxpartials * sizeof(Atom));
	x->partialFactors = (float *) getbytes(maxpartials * sizeof(float));

	if (x->outputlist == 0 || x->partialFactors == 0) {
		error("Out of memory");
		return 0;
	}

	for (i = 0; i < maxpartials; ++i) {
		x->outputlist[i].a_type = A_FLOAT;
		x->partialFactors[i] = 1.0f;
	}
	x->interp = COSINE;

	return (x);
}
コード例 #13
0
ファイル: euclid.c プロジェクト: cheesymoo/euclid-max-msp
void *euclid_new(t_symbol *s, long argc, t_atom *argv)
{
	t_euclid *x = NULL;
    long i;

	// object instantiation, NEW STYLE
	if (x = (t_euclid *)object_alloc(euclid_class)) {
        object_post((t_object *)x, "a new %s object was instantiated: 0x%X", s->s_name, x);
        object_post((t_object *)x, "it has %ld arguments", argc);
		x = (t_euclid *)object_alloc(euclid_class);
		
		x->m_outlet1 = listout((t_euclid *)x);
        
        for (i = 0; i < argc; i++) {
            if ((argv + i)->a_type == A_LONG) {
                object_post((t_object *)x, "arg %ld: long (%ld)", i, atom_getlong(argv+i));
            } else if ((argv + i)->a_type == A_FLOAT) {
                object_post((t_object *)x, "arg %ld: float (%f)", i, atom_getfloat(argv+i));
            } else if ((argv + i)->a_type == A_SYM) {
                object_post((t_object *)x, "arg %ld: symbol (%s)", i, atom_getsym(argv+i)->s_name);
            } else {
                object_error((t_object *)x, "forbidden argument");
            }
        }
	}
	// default values
	x->l_M = 12;
	x->l_N = 5;
	x->l_rotate = 0;
	return (x);
}
コード例 #14
0
ファイル: hoa.space.cpp プロジェクト: dimibil/HoaLibrary
void *space_new(t_symbol *s, int argc, t_atom *argv)
{
	t_space *x =  NULL; 
	t_dictionary *d;
	long flags;
	
	if (!(d = object_dictionaryarg(argc,argv)))
		return NULL;

	x = (t_space *)object_alloc(space_class);
	flags = 0 
			| JBOX_DRAWFIRSTIN 
			| JBOX_DRAWINLAST
			| JBOX_TRANSPARENT	
			| JBOX_GROWY
			;
    
	x->f_viewer				= new AmbisonicViewer(1);
    x->f_recomposer         = new ambisonicRecomposer(1, 3);
    
	jbox_new((t_jbox *)x, flags, argc, argv);
	x->j_box.b_firstin = (t_object *)x;

    x->f_out        = listout(x);

	attr_dictionary_process(x, d);
	jbox_ready((t_jbox *)x);

	return (x);
}			
コード例 #15
0
ファイル: legion.c プロジェクト: CNMAT/CNMAT-Externs
void *legion_new(t_symbol *msg, short argc, t_atom *argv){
	t_legion *x = NULL;
	if(x = (t_legion *)object_alloc(legion_class)){
		object_obex_store(x, _sym_dumpout, outlet_new(x, NULL));
		x->t_out = listout(x);

		x->t_kappa = 1.0;
		x->t_lambda = 0.5;
		x->t_temperature = 0.0;
		x->t_learningRate = 0.3;
		x->t_entrainmentRate = 0.3;
		x->t_radius = 3.0;
		x->t_epoch = 0;
		//x->t_neighborhoodFunction = legion_gaussian;
		legion_setneighborhoodFunction(x, gensym("gaussian"));
		x->t_nfParam = 1.0;
		x->t_learn = 1;
		x->t_numColumns = 10;
		x->t_numRows = 10;
		x->t_vectorLength = 10;
		x->t_randMin = 0.;
		x->t_randMax = 10.;

		attr_args_process(x, argc, argv);

		legion_init(x);
	}
	return x;
}
コード例 #16
0
void *eulercon_new(long n)
{
	t_eulercon *x; 
	x = (t_eulercon *)object_alloc(eulercon_class);
	if(x){
		x->p_output = (t_atom *)malloc(MAXSIZE * sizeof(t_atom));
		x->p_output2 = (t_atom *)malloc(MAXSIZE * sizeof(t_atom));

		x->p_out2 = listout(x);
		x->p_outlet = listout(x);
		// E = 0.57721566490153286;
		x->divide_euler = 1.0/E;
		x->p_result = 0.0;
		x->p_result2 = 0.0;
	}
	return x;
}
コード例 #17
0
ファイル: hoa.space.cpp プロジェクト: natcl/HoaLibrary
void *hoa_space_new(t_symbol *s, int argc, t_atom *argv)
{
    t_hoa_space *x = NULL;
    t_dictionary *d;
	long flags;
    long defc;
    t_atom *defv;
    x = (t_hoa_space *)object_alloc(hoa_space_class);
    if (x)
    {
        if (!(d = object_dictionaryarg(argc,argv)))
            return NULL;
        flags = 0
            | JBOX_DRAWFIRSTIN
            | JBOX_DRAWINLAST
            | JBOX_TRANSPARENT
            | JBOX_GROWY
            | JBOX_DRAWBACKGROUND
        ;
        
        jbox_new((t_jbox *)x, 1, argc, argv);
        
        x->j_box.b_firstin = (t_object *)x;
        
        
        
        x->f_viewer                 = new AmbisonicViewer(1);
        x->f_recomposer             = new AmbisonicRecomposer(1, 4);
        x->f_out                    = listout(x);
        x->f_number_of_microphones  = 4;
        x->f_new_number             = 4;
        
        x->f_defer             = clock_new(x, (t_method)hoa_space_do_channels_set);
        
        attr_dictionary_process(x, d);
        
        binbuf_copy_atoms(d, gensym("@channels"), &defc, &defv);
        if(defc && defv)
        {
            x->f_new_number = Tools::clip(long(atom_getlong(defv)), (long)3, (long)MAX_CHANNELS);
            hoa_space_do_channels_set(x);
            defc = 0;
            free(defv);
            defv = NULL;
        }
        binbuf_copy_atoms(d, gensym("@coeffs"), &defc, &defv);
        if(defc && defv)
        {
            hoa_space_coefficients_set(x, NULL, defc, defv);
            defc = 0;
            free(defv);
            defv = NULL;
        }
        
        jbox_ready((t_jbox *)x);
    }
    return (x);
}
コード例 #18
0
ファイル: gaussdraw.c プロジェクト: CNMAT/CNMAT-Externs
t_gaussdraw *gaussdraw_new(Symbol *sym, short argc, Atom *argv)
{
	t_gaussdraw *x = (t_gaussdraw *)newobject(gaussdraw_class);	

	x->x_outlet = listout((t_gaussdraw *)x); // Create a list outlet
	floatin(x,2); // Create 1 additional inlets
	floatin(x,1); // Create 1 additional inlets

	switch (argc) { // Read arguments
		case 0: 
			x->x_max = DEFMAX;
			x->x_min = DEFMIN;
			x->x_height = DEFHEIGHT;
			x->x_N = DEF_N;
			break;
		case 1:
			x->x_max = DEFMAX;
			x->x_min = DEFMIN;
			x->x_height = DEFHEIGHT;
			readx_N(x,argv);
			break;
		case 2:
			x->x_max = DEFMAX;
			x->x_min = DEFMIN;
			readx_height(x,argv);
			readx_N(x,argv);
			break;
		case 3:
			x->x_max = DEFMAX;
			readx_min(x,argv);
			readx_height(x,argv);
			readx_N(x,argv);
			break;
		case 4:
			readx_max(x,argv);
			readx_min(x,argv);
			readx_height(x,argv);
			readx_N(x,argv);
			break;
		default:
			post("gaussdraw: too many arguments.");		
			readx_max(x,argv);
			readx_min(x,argv);
			readx_height(x,argv);
			readx_N(x,argv);
	}
	
	if (x->x_max <= x->x_min) {
		post("gaussdraw: min can't be higher than max. Taking default...");		
		x->x_max = DEFMAX;
		x->x_min = DEFMIN;
	}	
	x->myList = (Atom *) NewPtr(MAXNUMPTS * sizeof(*x->myList));     
	
	return x;
}
コード例 #19
0
ファイル: deinterleave.c プロジェクト: CNMAT/CNMAT-Externs
void *deinterleave_new(
	t_symbol *s, 
	int ac,
	t_atom *av)
{

	t_deinterleave *x;
	
	//post("Running deinterleave_new");

	x = (t_deinterleave *)object_alloc(deinterleave_class);
    if(!x){
        return NULL;
    }
	
	/* 
	 * Deal with arguments.
	 */
	
	if (ac == 0)
	{
		// If no args, then 2 outputs.
		x->num_outputs = 2;
	}
	else if (ac == 1)
	{
		// If 1 arg, then its value is number of outputs.
		x->num_outputs = av[0].a_w.w_long;
	}
	else
	{
		// if 2 or more args, then number of args= number of outputs.
		x->num_outputs = ac;
	}
	
	// Allow 2 to MAX_OUTLETS outputs.
	if (x->num_outputs > MAX_OUTLETS) {
		object_post((t_object *)x, "deinterleave: can't have more than %ld outlets (compile-time constant MAX_OUTLETS)", MAX_OUTLETS);
		x->num_outputs = MAX_OUTLETS;
	}
			
	if (x->num_outputs < 2)
		x->num_outputs = 2;
		
	// Make outputs (in right to left order) and allocate space to hold output lists
		for (int i = x->num_outputs-1; i >= 0; --i) {
		x->t_out[i] = listout(x);
		x->t_list_out[i] = (t_atom *) getbytes(DEFAULT_MAX_OUTARGS * sizeof(t_atom));
	}
		
	// Set output size 0	
	x->t_outsize = 0;
		
	return(x);

}
コード例 #20
0
void *posit_new(t_symbol *s, long argc, t_atom *argv)
{
	t_posit *x = NULL;
    
	if ((x = (t_posit *)object_alloc(posit_class))) {
	
        x->p_outlet3 = intout(x);
        x->p_outlet2 = bangout(x);
        x->p_outlet = listout(x);
	}
	return (x);
}
コード例 #21
0
ファイル: c.prepend.cpp プロジェクト: avilleret/CreamLibrary
void *prepend_new(t_symbol *s, int argc, t_atom *argv)
{
	t_prepend *x =  NULL;
    
    x = (t_prepend *)eobj_new(prepend_class);
    if(x)
    {
        prepend_set(x, gensym("set"), argc, argv);
        x->f_out = (t_outlet *)listout(x);
    }
    
    return (x);
}
コード例 #22
0
ファイル: scripto.c プロジェクト: AlvaroBuitrago/max-test
void *scripto_new(t_symbol *s, long argc, t_atom *argv)
{
	t_scripto *x = NULL;

	x = (t_scripto *)object_alloc(s_scripto_class);

	x->s_patcher = NULL;
	x->s_ui = NULL;
	x->s_oncolor.red = x->s_oncolor.green = x->s_oncolor.blue = 0.8;
	x->s_oncolor.alpha = 1.;
	x->s_offcolor.red = x->s_offcolor.green = x->s_offcolor.blue = 0.2;
	x->s_offcolor.alpha = 1.;
	x->s_out = listout((t_object *)x);
	return x;
}
コード例 #23
0
void *changelist_new(t_symbol *s, short ac, t_atom *av)
{
	t_changelist *x; 
	short 	i;
	t_atom *at;
	
	
	x = (t_changelist *)object_alloc(changelist_class);
	
	if(x){
		
		x->c_prox1 = proxy_new(x, 1L, &x->c_inletnum);
		x->c_outlet2 = listout(x);
		x->c_outlet = listout(x);
		
		x->c_input = (t_atom *)malloc(sizeof(t_atom) * MAXSIZE);
		x->c_compare = (t_atom *)malloc(sizeof(t_atom) * MAXSIZE);

		
		x->c_inletnum = 0;
		x->c_lock = 0;
		x->c_len = 0;
		
		ac = MIN(MAXSIZE, ac);		// argument-list
		at = x->c_compare;
		x->c_complen = ac;		
		for (i=0; i<ac; ++i) { *at++ = *av++; }

		for (i=0; i<MAXSIZE; ++i){	// initialize everything
			atom_setlong(x->c_input+i, 0);
			atom_setfloat(x->c_input+i, 0.0);
			atom_setsym(x->c_input+1, ps_none);
		}
	}
	return x;
}
コード例 #24
0
void *slice_new(long n, long m, long pos)
{
	t_slice *x; 
	short 	i;
	x = (t_slice *)object_alloc(slice_class);
	if(x){
	
		x->s_inlist = (t_atom *)malloc(MAXSIZE * sizeof(t_atom));
		x->s_outlist = (t_atom *)malloc(MAXSIZE * sizeof(t_atom));

		
		if(n==0){
			x->s_numoutlets = 1;
			x->s_mode = 1;						
		}else{
			if((n > 2)&&(n < NUMOUTLETS)){			
				x->s_numoutlets = (short)n;
				x->s_mode = 0;
			}else{
				x->s_numoutlets = 1;
				x->s_mode = 1;
			}
		}
							
		if(m==0){										
			x->s_slicesize = 128;						
		}else{
			if((m>0)&&(m<1024)){				
				x->s_slicesize = m;	
			}else{x->s_slicesize = 128;}					
		}

		for (i = x->s_numoutlets-1; i >= 0; i--)
			x->s_outlet[i] = listout(x);
			
		if((pos)&&(pos>=0)){
			x->s_slicepos = (long)pos;
		}else{
			x->s_slicepos = 0;
		}
	}
	return x;
}
コード例 #25
0
ファイル: trend-report.c プロジェクト: CNMAT/CNMAT-Externs
void *TrendReport_new(t_symbol *s, float arg)
{
	TrendReport *x;
	
	x = (TrendReport *)object_alloc(TrendReport_class);
    if(!x){
        return NULL;
    }
	x->outlet = listout(x);
	
	if (arg == 0.0) {
		x->tolerance = 5.0f;
	} else {
		x->tolerance = arg;
	}

	Reset(x);
	return (x);
}
コード例 #26
0
ファイル: ioi-report~.c プロジェクト: CNMAT/CNMAT-Externs
void *ioi_report_new(Symbol *s, short argc, Atom *argv) {
	int i;
	
    t_ioi_report *x = (t_ioi_report *)newobject(ioi_report_class);
    x->outlet = listout(x);
    dsp_setup((t_pxobject *)x,1);
    
    x->min_ioi_time = 50;
    x->max_ioi_time = 100000;
    x->max_num_iois = MAX_LISTLEN;
    
    for (i=0; i<MAX_LISTLEN; ++i) {
		x->outputList[i].a_type = A_FLOAT;
    }
    
    ioi_report_reset(x);
    
    return (x);
}
コード例 #27
0
void *resonators_new(t_symbol *s, short argc, t_atom *argv)
{
	t_resonators *x = (t_resonators *)object_alloc(resonators_class);
	x->samplerate =  sys_getsr();
	if(x->samplerate<=0.0)
		x->samplerate = 44100.0;
	x->sampleinterval = 1.0/x->samplerate;

	x->dbase = (dresdesc *) sysmem_newptr(MAXRESONANCES*sizeof(dresdesc));
    
	if(x->dbase==0)
	{			
			object_error((t_object *)x, "not enough memory. ");
			return 0;
	}

	x->nres = MAXRESONANCES;
	resonators_clear(x); // clears state
	x->nres = 0;
	resonators_list(x,s,argc,argv);
	{
		dresdesc *df = x->dbase;
		int i;
		for(i=0;i<x->nres;++i)
			{

				df[i].o_a1 = df[i].a1;
				df[i].o_b1 = df[i].b1;
				df[i].o_b2 = df[i].b2;

			}
	}

	x->b_obj.z_misc = Z_NO_INPLACE;
	dsp_setup((t_pxobject *)x,1);
	x->b_obj.z_misc = Z_NO_INPLACE;
 
	x->outlet1 = listout(x);
		
	outlet_new((t_object *)x, "signal");
	return (x);
}
コード例 #28
0
void *meter_new(t_symbol *s, int argc, t_atom *argv)
{
	t_meter *x =  NULL;
	t_dictionary *d;
	long flags;
	if (!(d = object_dictionaryarg(argc,argv)))
		return NULL;
    
	x = (t_meter *)object_alloc(meter_class);
	flags = 0
    | JBOX_DRAWFIRSTIN
    | JBOX_DRAWINLAST
    | JBOX_TRANSPARENT
    | JBOX_DRAWBACKGROUND
    | JBOX_GROWY
    ;
    
    x->f_number_of_channels = 8;
	jbox_new((t_jbox *)x, flags, argc, argv);
	x->j_box.z_box.b_firstin = (t_object *)x;
    
    dictionary_getlong(d, gensym("channels"), (t_atom_long *)&x->f_number_of_channels);
	if(x->f_number_of_channels < 1)
        x->f_number_of_channels = 1;
    
    x->f_angles_of_channels = new double[MAX_SPEAKER];
    x->f_peaks              = new t_atom[MAX_SPEAKER];
    x->f_overled            = new long[MAX_SPEAKER];
    x->f_signals            = new double[MAX_SPEAKER* SYS_MAXBLKSIZE];
    x->f_meter  = new Hoa2D::Meter(x->f_number_of_channels);
    x->f_vector = new Hoa2D::Vector(x->f_number_of_channels);
    dsp_setupjbox((t_pxjbox *)x, x->f_number_of_channels);
    x->f_outlet = listout(x);
    
    x->f_clock = clock_new(x,(method)meter_tick);
	x->f_startclock = 0;
    
	attr_dictionary_process(x, d);
	jbox_ready((t_jbox *)x);
	
	return (x);
}
コード例 #29
0
static void *featureMean_new(t_symbol *s, long argc, t_atom *argv)
{
    t_featureMean *x = NULL;
    int i,j;
    t_atom *ap;

	if ((x = (t_featureMean *)object_alloc(featureMean_class))) {
        
        x->featureLength = 2;
        x->numFrames = 2;
        x->currentFrame = 0;
        // increment ap each time to get to the next atom
        for (i = 0, ap = argv; i < argc; i++, ap++) 
        {
            if (atom_gettype(ap) == A_LONG) 
            {
                if (i==0) x->featureLength = atom_getlong(ap);
                if (i==1) x->numFrames = atom_getlong(ap);
            }
            else post("%ld: unknown atom type (%ld)", i+1, atom_gettype(ap));
        }
        
        
        x->featureList = listout(x);
     
        x->x_listOut = (t_atom *)t_getbytes_(x->featureLength*sizeof(t_atom));
        x->instances = (t_instance *)t_getbytes_(x->numFrames*sizeof(t_instance));
        
        for(i=0; i<x->featureLength; i++)
            atom_setfloat(x->x_listOut+i, 0.0);
        
        for(i=0; i<x->numFrames; i++)
            x->instances[i].instance = (float *)t_getbytes_(x->featureLength*sizeof(float));
        
        for(i=0; i<x->numFrames; i++)
            for(j=0; j<x->featureLength; j++)
                x->instances[i].instance[j] = 0.0;

    }
    
    return (x);
}
コード例 #30
0
ファイル: snapgrid.c プロジェクト: CNMAT/CNMAT-Externs
void *snapgrid_new(
	Symbol s, 
	short ac,
	Atom *av)
{

	t_TJMSnapGrid *x;
	
	// post("Running snapgrid new");

	x = (t_TJMSnapGrid*)newobject(snapgrid_class);
	
	x->t_TJMis_grid_set = 0;

	x->t_TJMout = listout(x);
	
	
	
	return(x);
}