void *max_jit_gl_videoplane_new(t_symbol *s, long argc, t_atom *argv)
{
	t_max_jit_gl_videoplane *x;
	void *jit_ob;
	long attrstart;
	t_symbol *dest_name_sym = _jit_sym_nothing;

	if (x = (t_max_jit_gl_videoplane *)max_jit_obex_new(max_jit_gl_videoplane_class, gensym("jit_gl_videoplane")))
	{
		//get normal args
		attrstart = max_jit_attr_args_offset(argc,argv);
		if (attrstart&&argv)
		{
			jit_atom_arg_getsym(&dest_name_sym, 0, attrstart, argv);
		}

		if (jit_ob = jit_object_new(gensym("jit_gl_videoplane"), dest_name_sym))
		{
			max_jit_obex_jitob_set(x, jit_ob);
			max_jit_obex_dumpout_set(x, outlet_new(x,NULL));
			max_jit_attr_args(x, argc, argv);

			// attach the jit object's ob3d to a new outlet for sending drawing messages.
			max_jit_ob3d_attach(x, jit_ob, outlet_new(x, "jit_matrix"));
		}
		else
		{
			jit_object_error((t_object *)x,"jit.gl.videoplane: could not allocate object");
			freeobject((t_object *)x);
			x = NULL;
		}
	}
	return (x);
}
Exemplo n.º 2
0
void *max_jit_turtle_new(t_symbol *s, long argc, t_atom *argv)
{
	t_max_jit_turtle *x;
	t_jit_matrix_info info;
	long attrstart,i,j;
	jit_matrix_info_default(&info);

	if (x = (t_max_jit_turtle *)max_jit_obex_new(max_jit_turtle_class,gensym("jit_turtle"))) {
		max_jit_obex_dumpout_set(x, outlet_new(x,0L)); //general purpose outlet(rightmost)
		x->turtleout = outlet_new(x,0L); // outlet for the LCD commands
		
		x->clearmode = 1;
		
		x->scale = 10;
		x->angle = 30;
		x->origin[0] = 80; // kind of arbitrary, but i think the default jit.lcd matrix size is 160x120.
		x->origin[1] = 120;
		x->origincount = 2;
		x->curstack=0;
		x->stacknew=1;
		for(i=0;i<MAXSTACK;i++) {
			x->thisangle[i] = -PI2/4.; // start facing north (upwards)
			x->stack_x[i] = x->origin[0];
			x->stack_y[i] = x->origin[1];
			x->pensize[i] = 1;
		}
		
		max_jit_attr_args(x,argc,argv); //handle attribute args
	}
	return (x);
}
Exemplo n.º 3
0
void *max_jit_histogram_new(t_symbol *s, long argc, t_atom *argv)
{
	t_max_jit_histogram *x;
	void *o,*m;
	t_jit_matrix_info info;
	long dim=256;
	t_symbol *type=_jit_sym_long;

	if (x=(t_max_jit_histogram *)max_jit_obex_new(max_jit_histogram_class,gensym("jit_histogram"))) {
		if (o=jit_object_new(gensym("jit_histogram"))) {
			max_jit_mop_setup_simple(x,o,argc,argv);
			//default long 256 output(plane is linked)
			if (argc>=3) {
				if ((argv[0].a_type==A_LONG)&&(argv[1].a_type==A_SYM)&&(argv[2].a_type==A_LONG)) {
					type = jit_atom_getsym(argv+1);
					if (type!=_jit_sym_char)
						type = _jit_sym_long;
					dim = jit_atom_getlong(argv+2);
				}
			}
			m = max_jit_mop_getoutput(x,1);
			jit_object_method(m,_jit_sym_getinfo,&info);
			info.type 		= type;
			info.dimcount 	= 1;
			info.dim[0] 	= dim;
			jit_object_method(m,_jit_sym_setinfo,&info);
			max_jit_attr_args(x,argc,argv);
		} else {
			jit_object_error((t_object *)x,"jit.histogram: could not allocate object");
			freeobject((t_object *) x);
			x = NULL;
		}
	}
	return (x);
}
Exemplo n.º 4
0
void *max_jit_scissors_new(t_symbol *s, long argc, t_atom *argv)
{
	t_max_jit_scissors *x;
	void *o, *p, *mop;
	t_jit_matrix_info info;
	long i;

	if (x=(t_max_jit_scissors *)max_jit_obex_new(max_jit_scissors_class, gensym("jit_scissors"))) {
		if (o=jit_object_new(gensym("jit_scissors"))) {
			max_jit_obex_jitob_set(x, o);
			max_jit_obex_dumpout_set(x, outlet_new(x, NULL));
			max_jit_mop_setup(x);
			max_jit_mop_inputs(x);

			max_jit_attr_args(x, argc, argv); // get attr args to know rows and cols
			x->maxn = jit_attr_getlong(o, ps_rows) * jit_attr_getlong(o, ps_columns);
			max_jit_mop_variable_addoutputs(x, x->maxn);
			max_jit_mop_outputs(x);
			// don't forget the nolink!
			mop = max_jit_obex_adornment_get(x, _jit_sym_jit_mop);
			for (i = 1; i <= x->maxn; i++)
				jit_mop_output_nolink(mop, i);

			jit_attr_setlong(o, gensym("max"), x->maxn);
			max_jit_mop_matrix_args(x, argc, argv); // now set matrix info
		} else {
			jit_object_error((t_object *)x,"jit.scissors: could not allocate object");
			freeobject((t_object *) x);
			x = NULL;
		}
	}
	return (x);
}
Exemplo n.º 5
0
void *max_jit_SDIF_buffer_new(t_symbol *s, long argc, t_atom *argv){
	t_max_jit_SDIF_buffer *x;
	void *o;

	CNMAT_MMJ_SDIF_init(max_jit_SDIF_buffer_error);

	if (x=(t_max_jit_SDIF_buffer *)max_jit_obex_new(max_jit_SDIF_buffer_class,gensym("jit_SDIF_buffer"))) {
		if (o=jit_object_new(gensym("jit_SDIF_buffer"))) {
			if(!argc){
				error("jit.SDIF-buffer: you must specify the name of an SDIF-buffer");
				return NULL;
			}
			if(argv[0].a_type != A_SYM){
				error("jit.SDIF-buffer: the first argument to jit.SDIF-buffer must be the name of an SDIF-buffer");
				return NULL;
			}
			x->t_b.t_bufferSym = argv[0].a_w.w_sym;
			max_jit_mop_setup_simple(x,o,argc - 1,argv + 1);
			max_jit_attr_args(x,argc,argv);
		} else {
			error("jit.noise: could not allocate object");
			freeobject(x);
		}
	}
	return x;
}
Exemplo n.º 6
0
void *max_jit_rgb2luma_new(t_symbol *s, long argc, t_atom *argv)
{
	t_max_jit_rgb2luma *x;
	void *o,*m;
	t_jit_matrix_info info;

	if (x=(t_max_jit_rgb2luma *)max_jit_obex_new(max_jit_rgb2luma_class,gensym("jit_rgb2luma"))) {
		if (o=jit_object_new(gensym("jit_rgb2luma"))) {
			max_jit_mop_setup_simple(x,o,argc,argv);			
			//1-plane char out
			m = max_jit_mop_getoutput(x,1);			
			jit_object_method(m,_jit_sym_getinfo,&info);			
			info.type 		= _jit_sym_char;
			info.planecount = 1;
			info.dimcount 	= 2;
//			info.dim[0] 	= 160;
//			info.dim[1] 	= 120;
			jit_object_method(m,_jit_sym_setinfo,&info);			
			max_jit_attr_args(x,argc,argv);
		} else {
			jit_object_error((t_object *)x,"jit.rgb2luma: could not allocate object");
			freeobject((t_object *) x);
			x = NULL;
		}
	}
	return (x);
}
void *max_jit_ys_pixelweightmat_new(t_symbol *s, long argc, t_atom *argv)
{
	t_max_jit_ys_pixelweightmat *x;
	void *o;

	if (x=(t_max_jit_ys_pixelweightmat *)max_jit_obex_new(max_jit_ys_pixelweightmat_class,gensym("jit_ys_pixelweightmat"))) {
		if (o=jit_object_new(gensym("jit_ys_pixelweightmat"))) {
			
			// add aditional non-matrix output
			//x->mapout = outlet_new(x, 0L);
			
			// alocate buffer for outlet
			//x->mapout_buff = jit_getbytes(sizeof(long)*MAX_OUT);
			
			// create matrix outlet?
			max_jit_mop_setup_simple(x,o,argc,argv);
			
			max_jit_attr_args(x,argc,argv);
		} else {
			error("jit.change: could not allocate object");
			freeobject(x);
		}
	}
	return (x);
}
Exemplo n.º 8
0
void *max_ta_jit_kinect2_new(t_symbol *s, long argc, t_atom *argv)
{
    t_max_ta_jit_kinect2	*x;
    void			*o;
    
    x = (t_max_ta_jit_kinect2 *)max_jit_object_alloc(max_ta_jit_kinect2_class, gensym("ta_jit_kinect2"));
    if (x) {
        o = jit_object_new(gensym("ta_jit_kinect2"));
        if (o) {
            max_jit_mop_setup_simple(x, o, argc, argv);
            max_jit_attr_args(x, argc, argv);
            t_atom_long depthdim[2] = {DEPTH_WIDTH, DEPTH_HEIGHT};
            t_atom_long rgbdim[2] = {RGB_WIDTH, RGB_HEIGHT};
            
            //TA: set depth matrix initial attributes
            void *output = max_jit_mop_getoutput(x, 1);
            jit_attr_setsym(output, _jit_sym_type, _jit_sym_float32);
            jit_attr_setlong_array(output, _jit_sym_dim, 2, depthdim);
            jit_attr_setlong(output, _jit_sym_planecount, 1);
            
            //TA: set rgb matrix initial attributes
            output = max_jit_mop_getoutput(x, 2);
            jit_attr_setsym(output, _jit_sym_type, _jit_sym_char);
            jit_attr_setlong_array(output, _jit_sym_dim, 2, rgbdim);
            jit_attr_setlong(output, _jit_sym_planecount, 4);

        }
        else {
            jit_object_error((t_object *)x, "ta.jit.kinect2: could not allocate object");
            object_free((t_object *)x);
            x = NULL;
        }
    }
    return (x);
}
Exemplo n.º 9
0
void *max_jit_submatrix_new(t_symbol *s, long argc, t_atom *argv)
{
	t_max_jit_submatrix *x;
	void *o,*m,*mop,*p;
	t_jit_matrix_info info;

	if (x=(t_max_jit_submatrix *)max_jit_obex_new(max_jit_submatrix_class,gensym("jit_submatrix"))) {
		if (o=jit_object_new(gensym("jit_submatrix"))) {
			max_jit_obex_jitob_set(x,o);
			max_jit_obex_dumpout_set(x,outlet_new(x,NULL));
			max_jit_mop_setup(x);
			max_jit_mop_inputs(x);
			max_jit_mop_outputs(x);
			mop=max_jit_obex_adornment_get(x,_jit_sym_jit_mop);
			jit_attr_setlong(mop,gensym("adapt"),0);
			jit_attr_setlong(mop,gensym("caninplace"),0);
			jit_attr_setlong(mop,gensym("outputmode"),1);
			//make the output matrix a data reference w/NULL data pointer
			m = max_jit_mop_getoutput(x,1);
			jit_object_method(m,_jit_sym_getinfo,&info);
			jit_object_method(m,gensym("freedata"));
			info.flags = JIT_MATRIX_DATA_REFERENCE;
			info.size = 0;
			p = NULL;
			jit_object_method(m,_jit_sym_setinfo_ex,&info);
			jit_object_method(m,_jit_sym_data,p);
			max_jit_attr_args(x,argc,argv);
		} else {
			jit_object_error((t_object *)x,"jit.submatrix: could not allocate object");
			freeobject((t_object *) x);
			x = NULL;
		}
	}
	return (x);
}
Exemplo n.º 10
0
void *max_jit_str_op_new(t_symbol *s, long argc, t_atom *argv)
{
	t_max_jit_str_op *x;
	void *o, *m;
	t_jit_matrix_info info;

	if (x=(t_max_jit_str_op *)max_jit_obex_new(max_jit_str_op_class,gensym("jit_str_op"))) {
		if (o=jit_object_new(gensym("jit_str_op"))) {
			max_jit_mop_setup_simple(x,o,argc,argv);
			m = max_jit_mop_getinput(x, 2);
			jit_object_method(m, _jit_sym_getinfo, &info);
			info.type = _jit_sym_char;
			info.planecount = 1;
			info.dimcount = 1;
			info.dim[0] = 1;
			jit_object_method(m, _jit_sym_setinfo, &info);	
			max_jit_attr_args(x,argc,argv);
		} else {
			jit_object_error((t_object *)x,"jit.str.op: could not allocate object");
			freeobject(x);
			x = NULL;
		}
	}
	return (x);
}
Exemplo n.º 11
0
void *max_hoa_gl_scope_new(t_symbol *s, long argc, t_atom *argv)
{
	t_max_hoa_gl_scope* x = NULL;
	t_jit_object *jit_ob = NULL;
	long attrstart;
	t_symbol *dest_name_sym = _jit_sym_nothing;
	t_atom_long order = 1;

	if ((x = (t_max_hoa_gl_scope *)max_jit_object_alloc(max_hoa_gl_scope_class, gensym("hoa_gl_scope"))))
	{
		// get first normal arg, the destination name
		attrstart = max_jit_attr_args_offset(argc,argv);
		
		if (argc >= 1 && argv)
		{
			if (atom_gettype(argv) == A_LONG)
			{
				order = jit_atom_getlong(argv);
			}
			if (argc >= 2)
			{
				jit_atom_arg_getsym(&dest_name_sym, 1, attrstart, argv);
			}
		}
		
		jit_ob = (t_jit_object*)jit_object_new(gensym("hoa_gl_scope"), dest_name_sym, x);

		// instantiate Jitter object with dest_name arg
		//if ((jit_ob = (t_jit_object*)jit_object_new(gensym("hoa_gl_scope"), dest_name_sym)))
		if (jit_ob)
		{
			// set internal jitter object instance
			max_jit_obex_jitob_set(x, jit_ob);
			
			x->f_scope = new Hoa3D::Scope(order, 100, 199);
			dsp_setup((t_pxobject *)x, x->f_scope->getNumberOfHarmonics());
			
			x->f_signals = new double[x->f_scope->getNumberOfHarmonics() * SYS_MAXBLKSIZE];
			x->f_index = 0;
			
			max_jit_attr_args(x, argc, argv);
		} 
		else 
		{
			error("hoa.gl.scope3D~: could not allocate object");
			freeobject((t_object *)x);
			x = NULL;
		}
	}
	return (x);
}
Exemplo n.º 12
0
void *max_jit_unpack_new(t_symbol *s, long argc, t_atom *argv)
{
	t_max_jit_unpack *x;
	void *o,*m,*p,*mop;
	t_jit_matrix_info info;
	long i;

	if (x=(t_max_jit_unpack *)max_jit_obex_new(max_jit_unpack_class,gensym("jit_unpack"))) {
		if (o=jit_object_new(gensym("jit_unpack"))) {
			max_jit_obex_jitob_set(x,o);
			max_jit_obex_dumpout_set(x,outlet_new(x,NULL));
			max_jit_mop_setup(x);
			max_jit_mop_inputs(x);
			
			if (argc&&(i=jit_atom_getlong(argv))) {
				CLIP(i,1,JIT_MATRIX_MAX_PLANECOUNT);
			} else {
				i=4;
			}
			
			x->outlets = i;
			max_jit_mop_variable_addoutputs(x,i);
			
			while (i) {
				p=max_jit_mop_getoutput(x,i);
				jit_attr_setlong(p,gensym("minplanecount"),1);
				jit_attr_setlong(p,gensym("maxplanecount"),1);
				i--;
			}
		
			max_jit_mop_outputs(x);
			max_jit_mop_matrix_args(x,argc,argv);
			//set adapt true if only plane argument(should come after matrix_args call)
			if ((max_jit_attr_args_offset(argc,argv)<=1) &&
				(mop=max_jit_obex_adornment_get(x,_jit_sym_jit_mop)))
			{		
				jit_attr_setlong(mop,_jit_sym_adapt,1);
			}
			
			max_jit_attr_args(x,argc,argv);
		} else {
			jit_object_error((t_object *)x,"jit.unpack: could not allocate object");
			freeobject(x);
			x = NULL;
		}
	}
	return (x);
}
Exemplo n.º 13
0
void *max_cv_jit_canny_new(t_symbol *s, long argc, t_atom *argv)
{
	t_max_cv_jit_canny *x;
	void *o;

	if (x=(t_max_cv_jit_canny *)max_jit_obex_new(max_cv_jit_canny_class,gensym("cv_jit_canny"))) {
		if (o=jit_object_new(gensym("cv_jit_canny"))) {
			max_jit_mop_setup_simple(x,o,argc,argv);			
			max_jit_attr_args(x,argc,argv);
		} else {
			error("cv.jit.canny: could not allocate object");
			freeobject((t_object *)x);
		}
	}
	return (x);
}
Exemplo n.º 14
0
void *max_jit_gradient_new(t_symbol *s, long argc, t_atom *argv)
{
	t_max_jit_gradient *x,*o;

	if (x=(t_max_jit_gradient *)max_jit_obex_new(max_jit_gradient_class,gensym("jit_gradient"))) {
		if (o=jit_object_new(gensym("jit_gradient"))) {
			max_jit_mop_setup_simple(x,o,argc,argv);
			max_jit_attr_args(x,argc,argv);
		} else {
			jit_object_error((t_object *)x,"jit.gradient: could not allocate object");
			freeobject((t_object *) x);
			x = NULL;
		}
	}
	return (x);
}
Exemplo n.º 15
0
void *max_cv_jit_binedge_new(t_symbol *s, long argc, t_atom *argv)
{
	t_max_cv_jit_binedge *x;
	void *o;

	if (x=(t_max_cv_jit_binedge *)max_jit_obex_new(max_cv_jit_binedge_class,gensym("cv_jit_binedge"))) {  //Create a new instance of Jitter object class
		if (o=jit_object_new(gensym("cv_jit_binedge"))) { //Create a new binedge object
			max_jit_mop_setup_simple(x,o,argc,argv);  //Matrix operator setup
			max_jit_attr_args(x,argc,argv); //Arguments and attributes
		} else {
			error("cv.jit.binedge: could not allocate object");
			freeobject((t_object *)x);
		}
	}
	return (x);
}
Exemplo n.º 16
0
void *max_xray_jit_kmeans_new(t_symbol *s, long argc, t_atom *argv)
{
	t_max_xray_jit_kmeans *x;
	void *o;

	if (x=(t_max_xray_jit_kmeans *)max_jit_obex_new(max_xray_jit_kmeans_class,gensym("xray_jit_kmeans"))) {
		if (o=jit_object_new(gensym("xray_jit_kmeans"))) {
			max_jit_mop_setup_simple(x,o,argc,argv);
			max_jit_attr_args(x,argc,argv);
		} else {
			error("xray.jit.kmeans: could not allocate object");
			freeobject((t_object *)x);
		}
	}
	return (x);
}
Exemplo n.º 17
0
void *max_jit_peek_new(t_symbol *s, long argc, t_atom *argv)
{
	t_max_jit_peek *x;
	long attrstart,i;
	t_atom a;

	if (x = (t_max_jit_peek *)max_jit_obex_new(max_jit_peek_class,NULL)) { //only max object, no jit object
		for (i=0; i<=JIT_MATRIX_MAX_DIMCOUNT+1; i++)
			x->vectors[i] = NULL;

		x->matrix_name = _jit_sym_nothing;
		x->dimcount = 2;
		x->plane = 0;
		x->interp = 0;
		x->normalize = 0;

		x->inperform = 0;
		x->mvalid = 0;
		x->mdata = 0;

		attrstart = max_jit_attr_args_offset(argc,argv);
		if (attrstart&&argv) {
			t_atom_long al;
			jit_atom_arg_getsym(&x->matrix_name, 0, attrstart, argv);
			if (!jit_atom_arg_getlong(&al, 1, attrstart, argv)) {
				C74_ASSERT_FITS_LONG(al);
				x->dimcount = (long) al;
			}
			if (!jit_atom_arg_getlong(&al, 2, attrstart, argv)) {
				C74_ASSERT_FITS_LONG(al);
				x->plane = (long) al;
			}
			jit_atom_setsym(&a,x->matrix_name);
			max_jit_peek_matrix_name(x,NULL,1,&a);
		}

		CLIP_ASSIGN(x->dimcount,0,JIT_MATRIX_MAX_DIMCOUNT);
		CLIP_ASSIGN(x->dimcount,0,32); //maximum signal inputs

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

		dsp_setup((t_pxobject *)x,x->dimcount);
		max_jit_obex_dumpout_set(x, outlet_new(x,0L)); //general purpose outlet(rightmost)
		outlet_new((t_object *)x, "signal"); //signal output
	}
	return (x);
}
Exemplo n.º 18
0
void *max_jit_gl_spout_receiver_new(t_symbol *s, long argc, t_atom *argv)
{
	UNREFERENCED_PARAMETER(s);

	t_max_jit_gl_spout_receiver *x;
	void *jit_ob;
	long attrstart;
	t_symbol *dest_name_sym = _jit_sym_nothing;

	if ((x = (t_max_jit_gl_spout_receiver *)max_jit_object_alloc(max_jit_gl_spout_receiver_class, gensym("jit_gl_spout_receiver"))))
	{
		// get first normal arg, the destination name
		attrstart = max_jit_attr_args_offset((short)argc,argv);
		if (attrstart&&argv) {
			jit_atom_arg_getsym(&dest_name_sym, 0, attrstart, argv);

		}
		
		// instantiate Jitter object with dest_name arg
		if ((jit_ob = jit_object_new(gensym("jit_gl_spout_receiver"), dest_name_sym))) {

			// set internal jitter object instance
			max_jit_obex_jitob_set(x, jit_ob);
			
			// process attribute arguments 
			max_jit_attr_args(x, (short)argc, argv);		

			// add a general purpose outlet (rightmost)
			x->dumpout = outlet_new(x,NULL);
			max_jit_obex_dumpout_set(x, x->dumpout);

			// Texture outlet
			x->texout = outlet_new(x, "jit_gl_texture");

			// For first sender detection
			x->b_Started = false;

		} 
		else {
			error("jit_gl_spout_receiver : could not allocate object");
			freeobject((t_object *)x);
			x = NULL;
		}
	}
	return (x);
}
Exemplo n.º 19
0
void *max_jit_coerce_new(t_symbol *s, long argc, t_atom *argv)
{
	t_max_jit_coerce *x;
	void *o,*m,*mop,*p;
	t_jit_matrix_info info;
	long attrstart;
	t_atom_long planecount=4;
	t_symbol *type=_jit_sym_char;

	if (x=(t_max_jit_coerce *)max_jit_obex_new(max_jit_coerce_class,gensym("jit_coerce"))) {
		if (o=jit_object_new(gensym("jit_coerce"))) {
			max_jit_obex_jitob_set(x,o);
			max_jit_obex_dumpout_set(x,outlet_new(x,NULL));
			max_jit_mop_setup(x);
			max_jit_mop_inputs(x);
			max_jit_mop_outputs(x);
			mop=max_jit_obex_adornment_get(x,_jit_sym_jit_mop);
			jit_attr_setlong(mop,gensym("adapt"),0);
			jit_attr_setlong(mop,gensym("caninplace"),0);
			jit_attr_setlong(mop,gensym("outputmode"),1);
			//make the output matrix a data reference w/NULL data pointer
			attrstart = max_jit_attr_args_offset(argc,argv);
			if (attrstart&&argv) {
				jit_atom_arg_getlong(&planecount, 0, attrstart, argv);
				jit_atom_arg_getsym(&type, 1, attrstart, argv);
				jit_attr_setlong(o,_jit_sym_planecount,planecount);
				jit_attr_setsym(o,_jit_sym_type,type);
			}
			m = max_jit_mop_getoutput(x,1);
			jit_object_method(m,_jit_sym_getinfo,&info);
			jit_object_method(m,gensym("freedata"));
			info.flags = JIT_MATRIX_DATA_REFERENCE;
			info.size = 0;
			p = NULL;
			jit_object_method(m,_jit_sym_setinfo_ex,&info);
			jit_object_method(m,_jit_sym_data,p);
			max_jit_attr_args(x,argc,argv);
		} else {
			jit_object_error((t_object *)x,"jit.coerce: could not allocate object");
			freeobject((t_object *) x);
			x = NULL;
		}
	}
	return (x);
}
Exemplo n.º 20
0
static void*
PenizeNewMaxShell(
	SymbolPtr,
	long		iArgC,
	Atom		iArgV[])
	
	{
	msobPenize*		me			= NIL;
	voidPtr			jitObj		= NIL;
	Symbol*			classSym	= gensym((char*) kMaxClassName);
	
	// In the 1.0 SDK max_jit_obex_new() is prototyped to expect a Maxclass* instead of
	// a Messlist*. JKC said the next release of header files would be corrected to
	// use Messlist* and in the interim users can edit the file accordingly.
	// If we get a compiler "illegal implicit typecast" error, it means Josh forgot to
	// make the change; go to jit.max.h and do it again.
	me = (msobPenize*) max_jit_obex_new(gPenizeMaxClass, classSym);
		if (me == NIL) goto punt;
		
	jitObj = jit_object_new(classSym);
		if (jitObj == NIL) goto punt;
	
	
		// If we make it here, we should be able to set up a new object
		// Jitter voodoo
	max_jit_mop_setup_simple(me, jitObj, iArgC, iArgV);			
	max_jit_attr_args(me, iArgC, iArgV);
	
		// Create standard Max outlets, from right to left
		// Access through core Max object
	outlet_new(me, NIL);
	
	return me;
	// End of normal processing
	// ------------------------------------------------------------------------
	
	// ------------------------------------------------------------------------
	// Poor man's exception handling
punt:
	error("%s: could not allocate object", kMaxClassName);
	if (me != NIL)
		freeobject(&me->coreObject);
		
	return NIL;
	}
Exemplo n.º 21
0
void *max_jit_la_diagproduct_new(t_symbol *s, long argc, t_atom *argv)
{
	t_max_jit_la_diagproduct *x;
	void *o;

	if (x=(t_max_jit_la_diagproduct *)max_jit_obex_new(max_jit_la_diagproduct_class,gensym("jit_la_diagproduct"))) {
		if (o=jit_object_new(gensym("jit_la_diagproduct"))) {
			max_jit_mop_setup_simple(x,o,argc,argv);			
			//add additional non-matrix output
			x->valout 	= outlet_new(x,0L);	
			max_jit_attr_args(x,argc,argv);
		} else {
			jit_object_error((t_object *)x,"jit.la.diagproduct: could not allocate object");
			freeobject((t_object *) x);
			x = NULL;
		}
	}
	return (x);
}
Exemplo n.º 22
0
void *max_jit_ys_timespace_new(t_symbol *s, long argc, t_atom *argv)
{
	t_max_jit_ys_timespace *x;
	void *o;

	if (x=(t_max_jit_ys_timespace *)max_jit_obex_new(max_jit_ys_timespace_class,gensym("jit_ys_timespace"))) {
		if (o=jit_object_new(gensym("jit_ys_timespace"))) {
			
			// create matrix outlet?
			max_jit_mop_setup_simple(x,o,argc,argv);
			
			max_jit_attr_args(x,argc,argv);
		} else {
			error("jit.change: could not allocate object");
			freeobject((void*)x);
		}
	}
	return (x);
}
Exemplo n.º 23
0
void *max_jit_gl_spoutsender_new(t_symbol *s, long argc, t_atom *argv)
{
	// Sender
	t_max_jit_gl_spoutsender *x;
	void *jit_ob;
	long attrstart;
	t_symbol *dest_name_sym = _jit_sym_nothing;

	if ((x = (t_max_jit_gl_spoutsender *)max_jit_object_alloc(max_jit_gl_spoutsender_class, gensym("jit_gl_spoutsender"))))
	{
		// get first normal arg, the destination name
		attrstart = max_jit_attr_args_offset((SHORT)argc, argv);
		if (attrstart&&argv) 
		{
			jit_atom_arg_getsym(&dest_name_sym, 0, attrstart, argv);
		}
		
		// instantiate Jitter object with dest_name arg
		if ((jit_ob = jit_object_new(gensym("jit_gl_spoutsender"), dest_name_sym)))
		{
			// set internal jitter object instance
			max_jit_obex_jitob_set(x, jit_ob);
			
			// add a general purpose outlet (rightmost)
			max_jit_obex_dumpout_set(x, outlet_new(x,NULL));
			
			// process attribute arguments 
			max_jit_attr_args(x, (SHORT)argc, argv);
			
			// create new proxy inlet.
			max_jit_obex_proxy_new(x, 0);
		} 
		else {
			error("jit.gl.spout_sender: could not allocate object");
			freeobject((t_object *)x);
			x = NULL;
		}
	}


	return (x);
}
Exemplo n.º 24
0
void *max_jit_kinect2_new(t_symbol *s, long argc, t_atom *argv)
{
	t_max_jit_kinect2	*x;
	void                *o;

	x = (t_max_jit_kinect2 *)max_jit_object_alloc(max_jit_kinect2_class, gensym("jit_kinect2"));
	if (x) {
		o = jit_object_new(gensym("jit_kinect2"));
		if (o) {
			max_jit_mop_setup_simple(x, o, argc, argv);
			max_jit_attr_args(x, argc, argv);
		}
		else {
			jit_object_error((t_object *)x, "jit.kinect2: could not allocate object");
			object_free((t_object *)x);
			x = NULL;
		}
	}
	return (x);
}
Exemplo n.º 25
0
void *MaxStencilNew(t_symbol *s, long argc, t_atom *argv)
{
	MaxStencilObjectPtr	self;
	void				*o;
	
	self = (MaxStencilObjectPtr)max_jit_obex_new(sMaxStencilClass, gensym("jcom_stencil"));
	if (self) {
		o = jit_object_new(gensym("jcom_stencil"));
		if (o) {
			max_jit_mop_setup_simple(self, o, argc, argv);			
			max_jit_attr_args(self, argc, argv);
		} 
		else {
			jit_object_error(SELF, (char*)"could not allocate object");
			object_free(SELF);
			self = NULL;
		}
	}
	return self;
}
Exemplo n.º 26
0
void *max_jit_print_new(t_symbol *s, long argc, t_atom *argv)
{
	t_max_jit_print *x;
	void *o;

	if (x = (t_max_jit_print *)max_jit_obex_new(max_jit_print_class,gensym("jit_print"))) {
		max_jit_obex_dumpout_set(x,outlet_new(x,NULL));	
		x->matrixout = outlet_new(x,"jit_matrix");

		if (o = jit_object_new(gensym("jit_print"))) {
			max_jit_obex_jitob_set(x,o);
			max_jit_attr_args(x,argc,argv);
		}
		else {
			jit_object_error((t_object *)x,"jit.print: could not allocate object");
			freeobject(x);
			x=NULL;
		}
	}
	return (x);
}
Exemplo n.º 27
0
void *max_jit_notify_new(t_symbol *s, long argc, t_atom *argv)
{
	t_max_jit_notify *x;
	void *o;

	if (x=(t_max_jit_notify *)max_jit_obex_new(max_jit_notify_class,gensym("jit_notify"))) {
		if (o=jit_object_new(gensym("jit_notify"))) {
			max_jit_mop_setup_simple(x,o,argc,argv);			
			max_jit_attr_args(x,argc,argv);
			
			//NOTIFY EXAMPLE: GENERATING A UNIQUE NAME + ASSOCIATING WITH JIT OBJECT(SERVER)
			x->servername = jit_symbol_unique(); 
			jit_object_method(o,_jit_sym_register,x->servername); //this registers w/ the name
			jit_object_attach(x->servername,x);	//this attaches max object(client) with jit object(server)
		} else {
			error("jit.notify: could not allocate object");
			freeobject(x);
		}
	}
	return (x);
}
Exemplo n.º 28
0
void *max_jit_leap_new(t_symbol *s, long argc, t_atom *argv)
{
	t_max_jit_leap *x;
	void *o;

	if ((x = (t_max_jit_leap *)max_jit_object_alloc(max_jit_leap_class,gensym("jit_leap"))))
	{
		if ((o = jit_object_new(gensym("jit_leap"))))
		{
			max_jit_mop_setup_simple(x,o,argc,argv);			
			max_jit_attr_args(x,argc,argv);
		}
		else
		{
			jit_object_error((t_object *)x, (char*)"jit.noise: could not allocate object");
			freeobject((t_object *) x);
			x = NULL;
		}
	}
	return (x);
}
void *o_jit_pcl_supervoxel_new(t_symbol *s, long argc, t_atom *argv)
{
    t_o_jit_pcl_supervoxel	*x;
    
    x = (t_o_jit_pcl_supervoxel *)max_jit_object_alloc((t_class *)o_jit_pcl_supervoxel_class, NULL);
    if (x)
    {
        x->disable_transform = 1;
        x->voxel_resolution = 0.008f;
        x->seed_resolution = 0.1f;
        x->color_importance = 0.2f;
        x->spatial_importance = 0.4f;
        x->normal_importance = 1.0f;

        x->outlet = outlet_new(x, "FullPacket");
        
        //no normal args, no matrices
        max_jit_attr_args(x,argc,argv); //handle attribute args
        
    }
    return (x);
}
Exemplo n.º 30
0
void *max_jit_op_new(t_symbol *s, long argc, t_atom *argv)
{
	t_max_jit_op *x;
	void *o;
	long i;

	if (x=(t_max_jit_op *)max_jit_obex_new(max_jit_op_class,gensym("jit_op"))) {
		if (o=jit_object_new(gensym("jit_op"))) {
			max_jit_mop_setup_simple(x,o,argc,argv);			
			x->last = OP_LAST_MATRIX;
			x->valcount = 0;
			for (i=0;i<JIT_MATRIX_MAX_PLANECOUNT;i++) 
				jit_atom_setlong(&x->val[i],0);
			max_jit_attr_args(x,argc,argv);
		} else {
			jit_object_error((t_object *)x,"jit.op: could not allocate object");
			freeobject(x);
			x = NULL;
		}
	}
	return (x);
}