예제 #1
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;
}
예제 #2
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);
}
예제 #3
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);
}
예제 #4
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);
}
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);
}
예제 #6
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);
}
예제 #7
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);
}
예제 #8
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);
}
예제 #9
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);
}
예제 #10
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);
}
예제 #11
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;
	}
예제 #12
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);
}
예제 #13
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);
}
예제 #14
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;
}
예제 #15
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);
}
예제 #16
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);
}
예제 #17
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);
}
예제 #18
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);
}
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);
}
예제 #20
0
파일: max.jit.3m.c 프로젝트: CICM/max6-sdk
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);
}
/* 
 * 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);
}