Пример #1
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);
}
Пример #2
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;
}
Пример #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);
}
Пример #4
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);
}
Пример #5
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_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);
}
Пример #7
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);
}
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);
}
Пример #9
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);
}
Пример #10
0
void *max_jit_dmxmap_new(t_symbol *s, long argc, t_atom *argv)
{
	t_max_jit_dmxmap *x;
	void *o,*m;
	t_jit_matrix_info info;
	long n;

	if (x = (t_max_jit_dmxmap *)max_jit_obex_new(class_max_jit_dmxmap,gensym("jit_dmxmap"))) {
		if (o=jit_object_new(gensym("jit_dmxmap"))) {
			
			attr_args_process(x, argc, argv);
			argc = attr_args_offset(argc, argv);

			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);
			
			if(argc == 1)
				n = jit_atom_getlong(&argv[0]);
			else
				n = 512;
			
			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		= 1;
			info.dim[0]			= n;
			info.dimstride[0]	= 1;
			info.dimstride[1]	= n;
			jit_object_method(m, _jit_sym_setinfo, &info);

			//max_jit_obex_jitob_set(x,o);
			//max_jit_attr_args(x,argc,argv);
		} else {	
			jit_object_error((t_object *)x,"jit.dmxmap: out of memory");
			freeobject((void *)x);
			x = NULL;
			goto out;
		}
	}

out:	
	return (x);
}
Пример #11
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);
}
Пример #12
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);
}
Пример #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);
}
Пример #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);
}
Пример #15
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);
}
Пример #16
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);
}
Пример #17
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;
	}
Пример #18
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);
}
Пример #19
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);
}
Пример #20
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);
}
Пример #21
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;
}
void *max_jit_gl_spout_receiver_new(t_symbol *s, long argc, t_atom *argv)
{
	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_obex_new(max_jit_gl_spout_receiver_class, gensym("jit_gl_spout_receiver")))) 
	{
		// get first normal arg, the destination name
		attrstart = max_jit_attr_args_offset(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, 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");
			
		} 
		else {
			error("jit_gl_spout_receiver : could not allocate object");
			freeobject((t_object *)x);
			x = NULL;
		}
	}
	return (x);
}
Пример #23
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);
}
Пример #24
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);
}
Пример #25
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);
}
Пример #26
0
void *max_jit_gl_cube_new(t_symbol *s, long argc, t_atom *argv)
{
	t_max_jit_gl_cube *x;
	void *jit_ob;
	long attrstart;
	t_symbol *dest_name_sym = _jit_sym_nothing;

	if (x = (t_max_jit_gl_cube *)max_jit_obex_new(max_jit_gl_cube_class, gensym("jit_gl_cube"))) 
	{
		//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_cube"), dest_name_sym)) 
		{
			max_jit_obex_jitob_set(x, jit_ob);
			max_jit_obex_dumpout_set(x, outlet_new(x,NULL));
			
			// get attribute args. 
			// typical but not strictly necessary because this sample object has no attributes.
			max_jit_attr_args(x, argc, argv);		
			
			// attach the jit object's ob3d to a new outlet for sending drawing messages.	
			// this outlet is used in matrixoutput mode.
			max_jit_ob3d_attach(x, jit_ob, outlet_new(x, "jit_matrix"));
		} 
		else 
		{
			error("jit.gl.cube: could not allocate object");
			freeobject((t_object *)x);
			x = NULL;
		}
	}
	return (x);
}
Пример #27
0
void *max_jit_3m_new(t_symbol *s, long argc, t_atom *argv)
{
	t_max_jit_3m *x;
	void *o;

	if (x=(t_max_jit_3m *)max_jit_obex_new(max_jit_3m_class,gensym("jit_3m"))) {
		x->av = NULL;
		if (o=jit_object_new(gensym("jit_3m"))) {
			max_jit_mop_setup_simple(x,o,argc,argv);			
			//add additional non-matrix outputs
			x->maxout 	= outlet_new(x,0L);	
			x->meanout 	= outlet_new(x,0L); 
			x->minout 	= outlet_new(x,0L);
			x->av		= jit_getbytes(sizeof(t_atom)*JIT_MATRIX_MAX_PLANECOUNT);
			max_jit_attr_args(x,argc,argv);
		} else {
			jit_object_error((t_object *)x,"jit.3m: could not allocate object");
			freeobject((t_object *)x);
			x=NULL;
		}
	}
	return (x);
}
void *max_jit_human_new(t_symbol *s, long argc, t_atom *argv)
{
	t_max_jit_human*x,*o;

	if (x=(t_max_jit_human*)max_jit_obex_new(max_jit_human_class,gensym("jit_human"))) {
		if (o=jit_object_new(gensym("jit_human"))) {
			max_jit_mop_setup_simple(x,o,argc,argv);			
			//add additional non-matrix output, right2left
			x->out_state 	= outlet_new(x,0L);	
			x->out_foot_right 	= outlet_new(x,0L);	
			x->out_foot_left 	= outlet_new(x,0L);	
			x->out_head 	= outlet_new(x,0L);	
			x->out_arm_right 	= outlet_new(x,0L);	
			x->out_arm_left 	= outlet_new(x,0L);	
			x->out_box_coords 	= outlet_new(x,0L);	
			max_jit_attr_args(x,argc,argv);
		} else {
			error("jit.human: could not allocate object");
			freeobject(x);
		}
	}
	return (x);
}
/* 
 * Constructor
 */
void *max_jit_tml_DepthBG_new(t_symbol *s, long argc, t_atom *argv)
{
	t_max_jit_tml_DepthBG *x;
	//long attrstart;
	void *o;

	//Allocate memory
	x = (t_max_jit_tml_DepthBG *)max_jit_obex_new(max_jit_tml_DepthBG_class,NULL); //only max object, no jit object
	
	o = jit_object_new(gensym(EXTERNAL_NAME));
	if (o)
	{
		max_jit_mop_setup_simple(x, o, argc, argv);
		max_jit_attr_args(x, argc, argv);
	}
	else
	{
		error("jit.tml.DepthBG: unable to allocate object");
		freeobject((struct object *)x);
	}
	

	return (x);
}
Пример #30
0
void *max_jit_openni_new(t_symbol *s, long argc, t_atom *argv)
{
	t_max_jit_openni	*x;
	void				*o;
	long				i;
	
	x = (t_max_jit_openni*)max_jit_obex_new(max_jit_openni_class, gensym("jit_openni"));
	if (x)
	{
		o = jit_object_new(gensym("jit_openni"), x);	// instantiate jit.openni jitter object
		if (o)
		{
			// typically, max_jit_mop_setup_simple(x, o, argc, argv) is called here to handle standard MOP max wrapper setup tasks
			// however, I need to create a max only outlet between the MOP outlets and dumpout, so will use the code from MAx SDK 21.6.
			max_jit_obex_jitob_set(x,o);
			max_jit_obex_dumpout_set(x,outlet_new(x,NULL));
			x->osc_outlet = (t_object *)outlet_new(x, NULL);
			max_jit_mop_setup(x);
			max_jit_mop_inputs(x);
			max_jit_mop_outputs(x);
			x->chrSkeletonOutputFormat = 0;
			max_jit_mop_matrix_args(x,argc,argv);

			max_jit_attr_args(x, argc, argv); // process attribute arguments, like auto handling of @attribute's
#ifdef _DEBUG
			for (i = 0; i < argc; i++)
			{
				switch (atom_gettype(&(argv[i])))
				{
					case A_LONG:
						LOG_COMMENT3("arg %ld: long (%ld)", i, atom_getlong(&(argv[i])));
						break;
					case A_FLOAT:
						LOG_COMMENT3("arg %ld: float (%f)", i, atom_getfloat(&(argv[i])));
						break;
					case A_SYM:
						LOG_COMMENT3("arg %ld: symbol (%s)", i, atom_getsym(&(argv[i]))->s_name);
						break;
					default:
						LOG_WARNING2("arg %ld: forbidden argument", i); 
				}
			}
#endif
			if(RegisterJitOpenNIEventCallbacks((t_jit_openni *)max_jit_obex_jitob_get(x), max_jit_openni_post_events, &(x->pRegistrationForEvents)))
			{
				LOG_ERROR("jit.openni: could not register for jit.openni event callbacks");
				max_jit_openni_free(x);
				freeobject((t_object*)x);
				x = NULL;
			}
			else
			{
				LOG_DEBUG2("jit.openni: successfully registered for jit.openni event callbacks w/ regID=%x", x->pRegistrationForEvents);
			}
		}
		else
		{
			LOG_ERROR("jit.openni: could not allocate object");
			max_jit_obex_free(x);
			freeobject((t_object*)x);
			x = NULL;
		}
	}
	return(x);
}