Beispiel #1
0
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);
}			
Beispiel #2
0
t_uisimp* uisimp_new(t_symbol *s, long argc, t_atom *argv)
{
	t_uisimp* x = NULL;
	t_max_err err = MAX_ERR_GENERIC;
	t_dictionary *d;
	long flags;
	
	if (!(d=object_dictionaryarg(argc,argv)))
		return NULL;

	x = (t_uisimp*) object_alloc(s_uisimp_class);
	flags = 0 
			| JBOX_DRAWFIRSTIN 
	//		| JBOX_NODRAWBOX
			| JBOX_DRAWINLAST
			| JBOX_TRANSPARENT	
	//		| JBOX_NOGROW
	//		| JBOX_GROWY
			| JBOX_GROWBOTH
	//		| JBOX_HILITE
	//		| JBOX_BACKGROUND
	//		| JBOX_TEXTFIELD
			| JBOX_DRAWBACKGROUND
			;

	err = jbox_new(&x->j_box, flags, argc, argv); 

	x->j_box.b_firstin = (t_object*) x;

	attr_dictionary_process(x, d);
	jbox_ready(&x->j_box);

	return x;
}
Beispiel #3
0
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);
}			
Beispiel #4
0
void *uisimp_new(t_symbol *s, long argc, t_atom *argv)
{
	t_uisimp *x = NULL;
	t_dictionary *d = NULL;
	long boxflags;

	if (!(d = object_dictionaryarg(argc,argv)))
		return NULL;

	x = (t_uisimp *)object_alloc(s_uisimp_class);
	boxflags = 0
			   | JBOX_DRAWFIRSTIN
			   | JBOX_NODRAWBOX
			   | JBOX_DRAWINLAST
			   | JBOX_TRANSPARENT
			   //		| JBOX_NOGROW
			   | JBOX_GROWY
			   //		| JBOX_GROWBOTH
			   //		| JBOX_HILITE
			   //		| JBOX_BACKGROUND
			   | JBOX_DRAWBACKGROUND
			   //		| JBOX_NOFLOATINSPECTOR
			   //		| JBOX_TEXTFIELD
			   //		| JBOX_MOUSEDRAGDELTA
			   //		| JBOX_TEXTFIELD
			   ;

	jbox_new((t_jbox *)x, boxflags, argc, argv);
	x->u_box.b_firstin = (void *)x;
	x->u_mousedowninside = x->u_mouseover = x->u_state = 0;
	x->u_out = intout((t_object *)x);
	attr_dictionary_process(x,d);
	jbox_ready((t_jbox *)x);
	return x;
}
Beispiel #5
0
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);
}
Beispiel #6
0
void *hoa_meter_new(t_symbol *s, long argc, t_atom *argv)
{
	t_hoa_meter *x    = NULL;
 	t_dictionary *d = NULL;
	long flags;
    
	if (!(d = object_dictionaryarg(argc,argv)))
		return NULL;
    
	x = (t_hoa_meter *)object_alloc(hoa_meter_class);
	flags = 0
    | JBOX_DRAWFIRSTIN
    | JBOX_NODRAWBOX
    | JBOX_DRAWINLAST
    | JBOX_TRANSPARENT
    | JBOX_GROWY
    | JBOX_DRAWBACKGROUND
    ;
    
	jbox_new((t_jbox *)x, flags, argc, argv);
    x->j_box.j_box.z_box.b_firstin = (t_object *)x;
    
    dictionary_getlong(d, gensym("loudspeakers"), (t_atom_long *)&x->f_number_of_loudspeakers);
    x->f_meter      = new Hoa3D::Meter(x->f_number_of_loudspeakers, 100, 199);
    x->f_number_of_loudspeakers      = x->f_meter->getNumberOfLoudspeakers();
    x->f_signals    = new double[x->f_meter->getNumberOfLoudspeakers() * SYS_MAXBLKSIZE];
    x->f_clock      = clock_new((void *)x, (method)hoa_meter_tick);
    x->f_startclock = 0;
    x->f_number_of_leds = 13;
    x->f_leds_coordinates = new double***[100];

    double azimuth, elevation, radius;
    for(int i = 0; i < 100; i++)
    {
        elevation = (double)i / 100. * CICM_PI - CICM_PI2;
        x->f_leds_coordinates[i] = new double**[199];
        for(int j = 0; j < 199; j++)
        {
            azimuth = (double)j / 199. * CICM_2PI;
            x->f_leds_coordinates[i][j] = new double*[x->f_number_of_leds];
            for(int k = 0; k < x->f_number_of_leds; k++)
            {
                radius = (k + 1) / (double)x->f_number_of_leds;
                x->f_leds_coordinates[i][j][k] = new double[3];
                x->f_leds_coordinates[i][j][k][0] = Hoa3D::abscissa(radius, azimuth, elevation);
                x->f_leds_coordinates[i][j][k][1] = Hoa3D::ordinate(radius, azimuth, elevation);
                x->f_leds_coordinates[i][j][k][2] = Hoa3D::height(radius, azimuth, elevation);
            }
        }
    }
    
    dsp_setupjbox((t_pxjbox *)x, x->f_meter->getNumberOfLoudspeakers());
	jucebox_new((t_jucebox *) x);
    
	attr_dictionary_process(x,d);
	jbox_ready((t_jbox *)x);
	return x;
}
void *hoa_gain_new(t_symbol *s, short argc, t_atom *argv)
{
    t_hoa_gain *x = NULL;
    t_dictionary *d = NULL;
    
    x = (t_hoa_gain *) object_alloc(s_hoa_gain_class);
    d = object_dictionaryarg(argc, argv);
    
    if (x && d)
    {
        long flags = 0
        | JBOX_DRAWFIRSTIN
        | JBOX_NODRAWBOX
        | JBOX_DRAWINLAST
        | JBOX_GROWBOTH
        | JBOX_DRAWBACKGROUND
        | JBOX_MOUSEDRAGDELTA
        ;
        
        x->j_val = 0;
        x->j_defaultValuedB = 0;
        x->j_valdB = x->j_defaultValuedB;
        x->f_interp = 20;
        x->f_number_of_channels = 8;
        
        jbox_new((t_jbox *)x, flags, argc, argv);
        x->j_box.z_box.b_firstin = (t_object *)x;
        
        x->f_amp = new Line<t_sample>();
        x->f_amp->setRamp((const ulong)(0.1 * sys_getsr()));
        x->f_amp->setValueDirect(1.f);
        
        // inputs
        dsp_setupjbox((t_pxjbox *)x, x->f_number_of_channels + 1);
        
        // outputs
        x->f_outlet_infos = outlet_new(x, NULL);
        for (int i=0; i < x->f_number_of_channels; i++)
            outlet_new(x,"signal");
        
        x->j_box.z_misc = Z_NO_INPLACE;
        
        attr_dictionary_process(x,d); // handle attribute args
        
        hoa_gain_set_dB(x, x->j_defaultValuedB);
        
        jbox_ready((t_jbox *)x);
    }
    
    return x;
}
Beispiel #8
0
void *rd_new(t_symbol *msg, int argc, t_atom *argv){
	t_rd *x;
    
 	t_dictionary *d = NULL; 
 	long boxflags; 
    
	// box setup 
	if(!(d = object_dictionaryarg(argc, argv))){ 
		return NULL; 
	} 
    
	boxflags = 0 
		| JBOX_DRAWFIRSTIN 
		//| JBOX_NODRAWBOX
		| JBOX_DRAWINLAST
		//| JBOX_TRANSPARENT  
		//      | JBOX_NOGROW
		//| JBOX_GROWY
		| JBOX_GROWBOTH
		//      | JBOX_HILITE
		| JBOX_BACKGROUND
		| JBOX_DRAWBACKGROUND
		//      | JBOX_NOFLOATINSPECTOR
		//      | JBOX_MOUSEDRAGDELTA
		//      | JBOX_TEXTFIELD
		;

	if((x = (t_rd *)object_alloc(rd_class))){
		jbox_new((t_jbox *)x, boxflags, argc, argv); 
 		x->ob.b_firstin = (void *)x; 

		x->outlet = outlet_new(x, NULL);

		critical_new(&(x->lock));

		x->buffer_size = 1024 * 3;
		x->n = 0;
		x->buffer = (double *)calloc(x->buffer_size, sizeof(double));
		x->num_partials_selected = 0;
        
		attr_dictionary_process(x, d); 
		x->selection = (t_range){x->freqmin, x->freqmax};
 		jbox_ready((t_jbox *)x); 
        
		return x;
	}
	return NULL;
}
void *hoa_3d_scope_new(t_symbol *s, int argc, t_atom *argv)
{
    t_hoa_3d_scope *x =  NULL;
    t_dictionary *d;
    long flags;
    
    if(!(d = object_dictionaryarg(argc,argv)))
        return NULL;
    
    x = (t_hoa_3d_scope *)object_alloc(hoa_3d_scope_class);
    if (x && d)
    {
        flags = 0
        | JBOX_DRAWFIRSTIN
        | JBOX_DRAWINLAST
        | JBOX_NODRAWBOX
        | JBOX_DRAWBACKGROUND
        | JBOX_TRANSPARENT
        | JBOX_GROWY
        ;
        
        jbox_new((t_jbox *)x, flags, argc, argv);
        x->j_box.z_box.b_firstin = (t_object *)x;
        
        dictionary_getlong(d, gensym("order"), (t_atom_long *)&x->f_order);
        if(x->f_order < 1)
            x->f_order = 1;
        
        x->f_order      = 1;
        x->f_startclock = 0;
        x->f_scope      = new Scope<Hoa3d, t_sample>(x->f_order, (ulong)(HOA_DISPLAY_NPOINTS * 0.25), (ulong)(HOA_DISPLAY_NPOINTS * 0.5));
        x->f_order      = x->f_scope->getDecompositionOrder();
        x->f_signals    = new t_sample[x->f_scope->getNumberOfHarmonics() * HOA_MAXBLKSIZE];
        x->f_view[0] = x->f_view[1] = x->f_view[2] = 0.;
        
        dsp_setupjbox((t_pxjbox *)x, x->f_scope->getNumberOfHarmonics());
        
        x->f_clock = (t_clock*)clock_new(x,(method)hoa_3d_scope_tick);
        x->f_startclock = 0;
        
        attr_dictionary_process(x, d);
        jbox_ready((t_jbox *)x);
    }
    
    return (x);
}
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_NODRAWBOX
    | JBOX_DRAWINLAST
    | JBOX_TRANSPARENT
    | JBOX_DRAWBACKGROUND
    | JBOX_GROWY
    ;
    
    jbox_new((t_jbox *)x, flags, argc, argv);
    x->j_box.z_box.b_firstin = (t_object *)x;
    
    ulong channels = 4;
    dictionary_getlong(d, hoa_sym_channels, (t_atom_long *)&channels);
    if(channels < 1)
        channels = 1;
    
    x->f_meter  = new Meter<Hoa2d, t_sample>(channels);
    x->f_vector = new Vector<Hoa2d, t_sample>(channels);
    
    x->f_signals  = new t_sample[MAX_UI_CHANNELS * HOA_MAXBLKSIZE];
    x->f_meter->computeRendering();
    x->f_vector->computeRendering();
    
    dsp_setupjbox((t_pxjbox *)x, x->f_meter->getNumberOfPlanewaves());
    x->f_clock = (t_clock*)clock_new(x,(method)meter_tick);
    x->f_startclock = 0;
    
    attr_dictionary_process(x, d);
    jbox_ready((t_jbox *)x);
    
    return (x);
}
Beispiel #11
0
void *scope_new(t_symbol *s, int argc, t_atom *argv)
{
	t_scope *x =  NULL; 
	t_dictionary *d;
	long flags;
	
	if (!(d = object_dictionaryarg(argc,argv)))
		return NULL;

	x = (t_scope *)object_alloc(scope_class);
	flags = 0 
			| JBOX_DRAWFIRSTIN 
			| JBOX_DRAWINLAST
            | JBOX_DRAWBACKGROUND
			| JBOX_TRANSPARENT	
			| JBOX_GROWY
			;
	jbox_new((t_jbox *)x, flags, argc, argv);
    
    x->f_order = 1;
    x->f_sampleCounter = 0;
    x->f_normalize = 1.;
	x->j_box.b_firstin = (t_object *)x;

	dsp_setupjbox((t_jbox *)x, x->f_order * 2 + 1, 0);
    
	x->f_clock              = clock_new(x, (t_method)scope_tick);
	x->f_startclock         = 0;
    
	x->f_viewer             = new AmbisonicViewer(x->f_order);
	x->f_harmonicsValues    = new double[x->f_order * 2 + 1];
    x->f_averageHarmo       = new double[x->f_order * 2 + 1];
    for (int i = 0; i < x->f_order * 2 + 1; i++)
    {
        x->f_harmonicsValues[i] = 0.;
        x->f_averageHarmo[i]    = 0.;
    }

    attr_dictionary_process(x, d);
	jbox_ready((t_jbox *)x);
	
	return (x);
}
Beispiel #12
0
void *dbviewer_new(t_symbol *s, short argc, t_atom *argv)
{
	t_dbviewer		*x;
	long			flags;
	t_dictionary	*d = NULL;

	if (!(d=object_dictionaryarg(argc, argv)))
		return NULL;

	x = (t_dbviewer*)object_alloc(s_dbviewer_class);
	if(x){
		flags = 0 
		| JBOX_DRAWFIRSTIN		
		| JBOX_NODRAWBOX
		| JBOX_DRAWINLAST
		//		| JBOX_TRANSPARENT	
		//		| JBOX_NOGROW
		//		| JBOX_GROWY
		| JBOX_GROWBOTH
		//		| JBOX_IGNORELOCKCLICK
		| JBOX_HILITE				
		//		| JBOX_BACKGROUND
		//		| JBOX_NOFLOATINSPECTOR
		//		| JBOX_TEXTFIELD
		;
		
		jbox_new(&x->d_box, flags, argc, argv);
		x->d_box.b_firstin = (t_object*)x;
		object_obex_store((void *)x, _sym_dumpout, (t_object*)outlet_new(x, NULL));

		x->d_columns = hashtab_new(13);
		hashtab_flags(x->d_columns, OBJ_FLAG_DATA);
		x->d_query = _sym_nothing;

		dbviewer_initdataview(x);
		attr_dictionary_process(x, d);

		jbox_ready(&x->d_box);
//		object_notify(x->d_view, ps_dbview_update, NULL);
	}
	return(x);
}
Beispiel #13
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);
}
Beispiel #14
0
void *meter_new(t_symbol *s, long argc, t_atom *argv)
{
	t_meter*	x;
	t_jbox*		box;
	long		flags;
	
	t_dictionary *d=NULL;
	
	if (!(d=object_dictionaryarg(argc,argv)))
		return NULL;
	
	x = (t_meter *)object_alloc(s_meter_class);
	
	flags = 0 
		| JBOX_DRAWFIRSTIN 
		| JBOX_NODRAWBOX
		| JBOX_DRAWINLAST
	//	| JBOX_TRANSPARENT	
	//	| JBOX_NOGROW
	//	| JBOX_GROWY
		| JBOX_GROWBOTH
	//	| JBOX_HILITE
	//	| JBOX_BACKGROUND
	//	| JBOX_DRAWBACKGROUND
	//	| JBOX_NOFLOATINSPECTOR
	//	| JBOX_TEXTFIELD
	//	| JBOX_MOUSEDRAGDELTA
	//	| JBOX_TEXTFIELD
	;
	
	box = (t_jbox *)x;
	jbox_new(box, flags, argc, argv);
	x->obj.z_box.b_firstin = (t_object*)x;
	dsp_setupjbox((t_pxjbox *)x, 1);
	x->clock = clock_new(x, (method)meter_clock);
	meterEffectOrientation(x);
	x->outlet = outlet_new(x, 0); //adding a outlet 		
	attr_dictionary_process(x,d);
	jbox_ready((t_jbox *)x);
	return x;
}
Beispiel #15
0
void *hoa_scope_new(t_symbol *s, int argc, t_atom *argv)
{
	t_hoa_scope *x =  NULL; 
	t_dictionary *d;
	long flags;
	
	if(!(d = object_dictionaryarg(argc,argv)))
		return NULL;

	x = (t_hoa_scope *)object_alloc(hoa_scope_class);
	flags = 0 
			| JBOX_DRAWFIRSTIN 
			| JBOX_DRAWINLAST
            | JBOX_DRAWBACKGROUND
			| JBOX_TRANSPARENT	
			| JBOX_GROWY
			;
    
	jbox_new((t_jbox *)x, flags, argc, argv);
	x->j_box.z_box.b_firstin = (t_object *)x;
    
    dictionary_getlong(d, gensym("order"), (t_atom_long *)&x->f_order);
    if(x->f_order < 1)
        x->f_order = 1;
    
	x->f_scope = new Hoa2D::Scope(x->f_order, NUMBEROFCIRCLEPOINTS_UI);
    x->f_order      = x->f_scope->getOrder();
    x->f_signals    = new double[x->f_scope->getNumberOfHarmonics() * SYS_MAXBLKSIZE];
    x->f_index      = 0;
    
    dsp_setupjbox((t_pxjbox *)x, x->f_scope->getNumberOfHarmonics());
    
    x->f_clock = clock_new(x,(method)hoa_scope_tick);
	x->f_startclock = 0;
    
    attr_dictionary_process(x, d);
	jbox_ready((t_jbox *)x);
	
	return (x);
}
Beispiel #16
0
void *pictmeter_new(t_symbol *s, long argc, t_atom *argv)
{
	t_pictmeter *x = NULL;
	t_dictionary *d=NULL;
	long boxflags;

	if (!(d=object_dictionaryarg(argc,argv)))
		return NULL;

	x = (t_pictmeter *)object_alloc(s_pictmeter_class);
	boxflags = 0
			   | JBOX_DRAWFIRSTIN
			   | JBOX_NODRAWBOX
			   | JBOX_DRAWINLAST
			   | JBOX_TRANSPARENT
			   //		| JBOX_NOGROW
			   //		| JBOX_GROWY
			   | JBOX_GROWBOTH
			   //		| JBOX_HILITE
			   //		| JBOX_BACKGROUND
			   //		| JBOX_DRAWBACKGROUND
			   //		| JBOX_NOFLOATINSPECTOR
			   //		| JBOX_TEXTFIELD
			   //		| JBOX_MOUSEDRAGDELTA
			   //		| JBOX_TEXTFIELD
			   ;

	jbox_new((t_jbox *)x, boxflags, argc, argv);
	x->p_obj.z_box.b_firstin = (void *)x;
	dsp_setupjbox((t_pxjbox *)x,1);
	x->p_clock = clock_new(x,(method)pictmeter_tick);
	x->p_value = x->p_max = 0;
	x->p_startclock = false;
	jbox_ready((t_jbox *)x);
	return x;
}
Beispiel #17
0
void *cc_new(t_symbol *msg, short argc, t_atom *argv){
	t_cc *x;

	if(x = (t_cc *)object_alloc(cc_class)){
#if defined(CC_JBOX)
		t_dictionary *d = NULL; 
		long boxflags; 

		if(!(d = object_dictionaryarg(argc, argv))){ 
			return NULL; 
		} 
    
		boxflags = 0 
			| JBOX_DRAWFIRSTIN 
			//| JBOX_NODRAWBOX
			| JBOX_DRAWINLAST
			//| JBOX_TRANSPARENT  
			//      | JBOX_NOGROW
			//| JBOX_GROWY
			| JBOX_GROWBOTH
			//      | JBOX_HILITE
			| JBOX_BACKGROUND
			| JBOX_DRAWBACKGROUND
			//      | JBOX_NOFLOATINSPECTOR
			//      | JBOX_MOUSEDRAGDELTA
			//      | JBOX_TEXTFIELD
			;
		jbox_new((t_jbox *)x, boxflags, argc, argv); 
#if defined(CC_MSP)
		x->ob.z_box.b_firstin = (void *)x;
#else
 		x->ob.b_firstin = (void *)x; 
#endif
#endif
		x->ht = (t_hashtab *)hashtab_new(0);
		hashtab_flags(x->ht, OBJ_FLAG_DATA);

		x->ok_to_compile = 1;
		x->compiling = 0;
		x->have_valid_filename = 0;

		x->build_path_is_tmp = 1;

		x->ed = NULL;
		x->code_buf_len = BUFSIZE;
		x->code_buf = (char *)calloc(BUFSIZE, sizeof(char));

		x->cfile_path = (char *)calloc(MAX_FILENAME_CHARS, sizeof(char));
		x->build_path = (char *)calloc(MAX_FILENAME_CHARS, sizeof(char));
		x->basename = (char *)calloc(MAX_FILENAME_CHARS, sizeof(char));

		x->cfile_fullpath = (char *)calloc(MAX_PATH_CHARS, sizeof(char));
		x->ofile_fullpath = (char *)calloc(MAX_PATH_CHARS, sizeof(char));
		x->dfile_fullpath = (char *)calloc(MAX_PATH_CHARS, sizeof(char));
		x->logfile_fullpath = (char *)calloc(MAX_PATH_CHARS, sizeof(char));

		x->path_to_maxsdk = gensym("");
		x->user_obj = (char *)calloc(OBJSIZE, sizeof(char));

		x->verbose = 0;

		long ic = (long)(ps_cc_instance_count->s_thing);
		ic += 1;
		ps_cc_instance_count->s_thing = (void *)ic;

#if defined(CC_MSP) && defined(CC_JBOX)
		sprintf(x->basename, "cc_jbox~_%ld", (long)ps_cc_instance_count->s_thing);
#elif defined(CC_MSP)
		sprintf(x->basename, "cc~_%ld", (long)ps_cc_instance_count->s_thing);
#elif defined(CC_JBOX)
		sprintf(x->basename, "cc_jbox_%ld", (long)ps_cc_instance_count->s_thing);
#else
		sprintf(x->basename, "cc_%ld", (long)ps_cc_instance_count->s_thing);
#endif

		short tmpdir;
		sprintf(x->build_path, "/private/var/tmp");
		char fn[512];
		path_frompathname(x->build_path, &tmpdir, fn);
		x->build_path_id = tmpdir;

		//sprintf(x->cfile_fullpath, "%s/%s.c", x->build_path, x->basename);
		sprintf(x->ofile_fullpath, "%s/%s.o", x->build_path, x->basename);
		sprintf(x->dfile_fullpath, "%s/%s.dylib", x->build_path, x->basename);
		sprintf(x->logfile_fullpath, "%s/%s.log", x->build_path, x->basename);

		x->code_len = cc_write_template(x, x->code_buf);

		x->function_names = (t_symbol **)calloc(128, sizeof(t_symbol *));

		x->ninlets = 1;
		x->noutlets = 1;

		x->def_cflags = (char *)calloc(4096, sizeof(char));
		x->def_ldflags = (char *)calloc(4096, sizeof(char));

		char *sdk = x->path_to_maxsdk->s_name;

#if defined(CC_MSP)
		sprintf(x->def_cflags, CFLAGS, sdk, sdk, sdk, sdk, sdk);
		sprintf(x->def_ldflags, LDFLAGS, sdk, sdk);
#else
		sprintf(x->def_cflags, CFLAGS, sdk, sdk, sdk);
		sprintf(x->def_ldflags, LDFLAGS, sdk);
#endif

		x->user_cflags = gensym("");
		x->user_ldflags = gensym("");

#ifdef CC_JBOX
		x->user_paint = NULL;
#endif

#if !defined(CC_JBOX)
		attr_args_process(x, argc, argv);
#else
		attr_dictionary_process(x, d);
#endif

		int i;
#if defined(CC_MSP)
#if defined(CC_JBOX)
		dsp_setupjbox((t_pxjbox *)x, x->nsiginlets);
#else
		dsp_setup((t_pxobject *)x, x->nsiginlets);
#endif
		for(i = 0; i < x->nsigoutlets; i++){
			outlet_new((t_object *)x, "signal");
		}
		x->svin = (t_float **)calloc(x->nsiginlets, sizeof(t_float *));
		x->svout = (t_float **)calloc(x->nsigoutlets, sizeof(t_float *));
#endif
		x->proxies = (void **)calloc(x->ninlets - 1, sizeof(void *));
		for(i = 0; i < x->ninlets - 1; i++){
			x->proxies[0] = proxy_new((t_object *)x, x->ninlets - (i + 1), &(x->inlet));
		}
#if !defined(CC_MSP)
		x->outlets = (void **)calloc(x->noutlets, sizeof(void *));
		for(i = x->noutlets - 1; i >= 0; i--){
			x->outlets[i] = outlet_new((t_object *)x, NULL);
		}
#endif

		x->handle = NULL;

		object_attach_byptr_register(x, x, CLASS_BOX);

#ifdef CC_JBOX
		jbox_ready((t_jbox *)x);
#endif
		return x;
	}
	return NULL;
}
Beispiel #18
0
t_paramui* paramui_new(t_symbol *s, long argc, t_atom *argv)
{
	t_paramui		*x = NULL;
	t_dictionary 	*d = NULL;
	long 			flags;
	t_atom			a[LISTSIZE+34];
	long			argLen;
	//t_max_err		err = MAX_ERR_NONE;

	if(!(d=object_dictionaryarg(argc, argv)))
		return NULL;	

	if(x = (t_paramui*)object_alloc(s_ui_class)){
		flags = 0 
				| JBOX_DRAWFIRSTIN
				| JBOX_NODRAWBOX
		//		| JBOX_DRAWINLAST
				| JBOX_TRANSPARENT	
		//		| JBOX_NOGROW
		//		| JBOX_GROWY
		//		| JBOX_GROWBOTH
		//		| JBOX_IGNORELOCKCLICK
				| JBOX_HILITE
		//		| JBOX_BACKGROUND
		//		| JBOX_NOFLOATINSPECTOR
				| JBOX_TEXTFIELD
				;

		jbox_new(&x->box, flags, argc, argv);
		x->box.b_firstin = (t_object *)x;
		x->outlet = outlet_new(x, 0L);
		x->menu_items = NULL;
				
		attr_dictionary_process(x, d); 					// handle attribute args
		
		// a textlayout is used for the displaying the value and the unit
		x->layout_value = jtextlayout_create();
		x->layout_unit = jtextlayout_create();

		jbox_ready(&x->box);

		x = (t_paramui *)object_register(CLASS_BOX, symbol_unique(), x);

		x->menu_items = (t_linklist *)linklist_new();
		paramui_menu_build(x);
		x->menu_qelem = qelem_new(x, (method)paramui_menu_qfn);
		
		// here we create our internal instance of jcom.parameter
		atom_setsym(a+0, x->attr_name);
		atom_setsym(a+1, gensym("@type"));
		atom_setsym(a+2, x->attr_type);
		atom_setsym(a+3, gensym("@ramp/drive"));
		atom_setsym(a+4, x->attr_rampDrive);
		atom_setsym(a+5, gensym("@ramp/function"));
		atom_setsym(a+6, x->attr_rampFunction);
		atom_setsym(a+7, gensym("@view/freeze"));
		atom_setlong(a+8, x->attr_uiFreeze);
		atom_setsym(a+9, gensym("@value/stepsize"));
		atom_setfloat(a+10, x->attr_stepsize);
		atom_setsym(a+11, gensym("@priority"));
		atom_setlong(a+12, x->attr_priority);
		atom_setsym(a+13, gensym("@range/bounds"));
		atom_setfloat(a+14, x->attr_range[0]);
		atom_setfloat(a+15, x->attr_range[1]);
		atom_setsym(a+16, gensym("@repetitions/allow"));
		atom_setlong(a+17, x->attr_repetitions);
		atom_setsym(a+18, gensym("@range/clipmode"));
		atom_setsym(a+19, x->attr_clipmode);
		atom_setsym(a+20, gensym("@description"));
		atom_setsym(a+21, x->attr_description);
		atom_setsym(a+22, gensym("@dataspace"));
		atom_setsym(a+23, x->attr_dataspace);
		atom_setsym(a+24, gensym("@dataspace/unit/active"));
		atom_setsym(a+25, x->attr_unitActive);
		atom_setsym(a+26, gensym("@dataspace/unit/native"));
		atom_setsym(a+27, x->attr_unitNative);
		if(x->attr_defaultSize){
			atom_setsym(a+28, gensym("@value/default"));
			sysmem_copyptr(x->attr_default, a+29, sizeof(t_atom) * x->attr_defaultSize);
			argLen = 29 + x->attr_defaultSize;
		}
		else
			argLen = 28;

		jcom_core_loadextern(gensym("jcom.parameter"), argLen, a, &x->obj_parameter);
	}
	return x;
}
Beispiel #19
0
void *odisplay_new(t_symbol *msg, short argc, t_atom *argv){
	t_odisplay *x;
    
	t_dictionary *d = NULL;
 	long boxflags;
    
	// box setup
	if(!(d = object_dictionaryarg(argc, argv))){
		return NULL;
	}
    
	boxflags = 0
    | JBOX_DRAWFIRSTIN
    | JBOX_NODRAWBOX
    | JBOX_DRAWINLAST
    | JBOX_TRANSPARENT
    //| JBOX_NOGROW
    //| JBOX_GROWY
    //| JBOX_GROWBOTH
    //| JBOX_HILITE
    //| JBOX_BACKGROUND
    //| JBOX_DRAWBACKGROUND
    //| JBOX_NOFLOATINSPECTOR
    //| JBOX_MOUSEDRAGDELTA
    | JBOX_TEXTFIELD
    ;
    
	if((x = (t_odisplay *)object_alloc(odisplay_class))){
		jbox_new((t_jbox *)x, boxflags, argc, argv);
 		x->ob.b_firstin = (void *)x;
		x->outlet = outlet_new(x, NULL);
		//x->proxy = proxy_new(x, 1, &(x->inlet));
		x->bndl_u = NULL;
		x->bndl_s = NULL;
		x->newbndl = 0;
		x->textlen = 0;
		x->text = NULL;
		//x->bndl_has_been_checked_for_subs = 0;
		//x->bndl_has_subs = 0;
		critical_new(&(x->lock));
		x->qelem = qelem_new((t_object *)x, (method)odisplay_refresh);
		x->new_data_indicator_clock = clock_new((t_object *)x, (method)odisplay_refresh);
		x->have_new_data = 1;
		x->draw_new_data_indicator = 0;
		attr_dictionary_process(x, d);
        
		t_object *textfield = jbox_get_textfield((t_object *)x);
		if(textfield){
			object_attr_setchar(textfield, gensym("editwhenunlocked"), 0);
            textfield_set_readonly(textfield, '1');
            textfield_set_selectallonedit(textfield, '1');
			textfield_set_textmargins(textfield, 5, 5, 5, 15);
			textfield_set_textcolor(textfield, &(x->text_color));
		}
        
 		jbox_ready((t_jbox *)x);
		//odisplay_gettext(x);
        odisplay_clear(x);
		return x;
	}
	return NULL;
}