void max_xray_jit_levelsetseg_mproc(t_max_xray_jit_levelsetseg *x, void *mop)
{
	t_jit_err err;
	t_jit_matrix_info tmpinfo;
	void *o;
	long changed=0;
	t_atom a;

	if (x->last==LSS_LAST_VAL) {
		tmpinfo = x->lastinfo;
		o = max_jit_mop_getinput(x,2);
		jit_object_method(o,_jit_sym_getinfo,&x->lastinfo);
		if (tmpinfo.type!=x->lastinfo.type)
			changed = TRUE;
		else if (tmpinfo.planecount!=x->lastinfo.planecount)
			changed = TRUE;

		if (changed)
			jit_object_method(o,_jit_sym_setall,0L,1,jit_atom_setfloat(&a,x->val));
	}

	if (err=(t_jit_err) jit_object_method(
		max_jit_obex_jitob_get(x),
		_jit_sym_matrix_calc,
		jit_object_method(mop,_jit_sym_getinputlist),
		jit_object_method(mop,_jit_sym_getoutputlist)))
	{
		jit_error_code(x,err);
	} else {
		max_jit_mop_outputmatrix(x);
	}
}
/*
 * Destructor
 */	
void max_jit_tml_DepthBG_delete(t_max_jit_tml_DepthBG *x)
{
	//only max object, no jit object
	max_jit_mop_free(x);
	jit_object_free(max_jit_obex_jitob_get(x));
	max_jit_obex_free(x);
}
void max_jit_openni_assist(t_max_jit_openni *x, void *b, long io, long index, char *s)
{
	t_jit_openni *pJit_OpenNI = (t_jit_openni *)max_jit_obex_jitob_get(x);

	// I acknowledge the code below is redundant
	switch (io)
	{
		case 1:
			strncpy_zero(s, "(text) read filename.xml only", 512);
			break;
		case 2:
			switch (index)
			{
			case DEPTHMAP_OUTPUT_INDEX:
				snprintf_zero(s, 512, "%s out%d", DEPTHMAP_ASSIST_TEXT, index+1);
				break;
			case IMAGEMAP_OUTPUT_INDEX:
				snprintf_zero(s, 512, "%s out%d", IMAGEMAP_ASSIST_TEXT, index+1);
				break;
			case IRMAP_OUTPUT_INDEX:
				snprintf_zero(s, 512, "%s out%d", IRMAP_ASSIST_TEXT, index+1);
				break;
			case USERPIXELMAP_OUTPUT_INDEX:
				snprintf_zero(s, 512, "%s out%d", USERPIXELMAP_ASSIST_TEXT, index+1);
				break;
			case SKELETON_OUTPUT_INDEX:
				snprintf_zero(s, 512, "%s out%d", SKELETON_ASSIST_TEXT, index+1);
				break;
			case NUM_JITOPENNI_OUTPUTS:
				strncpy_zero(s, "dumpout", 512);
			}
	}
}
Beispiel #4
0
t_jit_err max_jit_gradient_outputmatrix(t_max_jit_gradient *x)
{
	void *mop,*o,*p;
	long err=JIT_ERR_NONE;
	t_atom a;
	
	if (!(mop=max_jit_obex_adornment_get(x,_jit_sym_jit_mop)))
		return JIT_ERR_GENERIC;
	if (jit_attr_getlong(mop,_jit_sym_outputmode)) {
		if (err=(t_jit_err) jit_object_method(
			max_jit_obex_jitob_get(x),
			_jit_sym_matrix_calc,
			jit_object_method(mop,_jit_sym_getinputlist),
			jit_object_method(mop,_jit_sym_getoutputlist))) 
		{
			jit_error_code(x,err); 
		} else {

			if ((p=jit_object_method(mop,_jit_sym_getoutput,1)) &&
				(o=max_jit_mop_io_getoutlet(p))) 
			{
				jit_atom_setsym(&a,jit_attr_getsym(p,_jit_sym_matrixname)); 
				outlet_anything(o,_jit_sym_jit_matrix,1,&a);
			}
		}
	}
	return err;
}
void max_jit_tml_particleFlow_free(t_max_jit_tml_particleFlow *x)
{
	max_jit_mop_free(x);
	jit_object_free(max_jit_obex_jitob_get(x));
	
	max_jit_obex_free(x);
}
void max_jit_tml_fluid2_free(t_max_jit_tml_fluid2 *x)
{
	max_jit_mop_free(x);
	jit_object_free(max_jit_obex_jitob_get(x));
	
	max_jit_obex_free(x);
}
Beispiel #7
0
void max_jit_kinect2_outputmatrix(t_max_jit_kinect2 *x)
{
    long outputmode = max_jit_mop_getoutputmode(x);
    void *mop = max_jit_obex_adornment_get(x,_jit_sym_jit_mop);
    t_jit_err err;

    
    if (outputmode && mop)
    {
        //always output unless output mode is none
        if (outputmode==2) // pass input case, but since jit.kinect2 has no input then this means no output
        {
            return;
        }
        
        if (outputmode==1)
        {
            if ((err = (t_jit_err)jit_object_method(max_jit_obex_jitob_get(x), _jit_sym_matrix_calc,
                                                   jit_object_method(mop,_jit_sym_getinputlist),
                                                   jit_object_method(mop,_jit_sym_getoutputlist))))
            {
                if (err != JIT_ERR_HW_UNAVAILABLE) jit_error_code(x,err);
                return;
            }
        }
        max_jit_mop_outputmatrix(x);
    }
}
void max_jit_realsense_grab_outputmatrix(t_max_jit_realsense_grab *x)
{
//	post("%s", __FUNCTION__);
	t_atom a;
	long outputmode = max_jit_mop_getoutputmode(x);
	void *mop = max_jit_obex_adornment_get(x, _jit_sym_jit_mop);
	t_jit_err err;

	if (outputmode&&mop)
	{ //always output unless output mode is none
		if (outputmode == 1)
		{
			if (err = (t_jit_err)jit_object_method(
				max_jit_obex_jitob_get(x),
				_jit_sym_matrix_calc,
				jit_object_method(mop, _jit_sym_getinputlist),
				jit_object_method(mop, _jit_sym_getoutputlist)))
			{
				jit_error_code(x, err);
			}
			else {
				max_jit_mop_outputmatrix(x);
			}
		}
		else {
			max_jit_mop_outputmatrix(x);
		}
	}
}
Beispiel #9
0
void max_jit_leap_outputmatrix(t_max_jit_leap *x)
{
	long outputmode = max_jit_mop_getoutputmode(x);
	void *mop = max_jit_obex_adornment_get(x,_jit_sym_jit_mop);
	t_jit_err err;	
	
	if (outputmode && mop) //always output unless output mode is none
	{
		if (outputmode == 1)
		{
			if ((err=(t_jit_err)jit_object_method(max_jit_obex_jitob_get(x),	_jit_sym_matrix_calc, jit_object_method(mop,_jit_sym_getinputlist), jit_object_method(mop,_jit_sym_getoutputlist))))
			{
				jit_error_code(x,err); 
			}
			else
			{
				max_jit_mop_outputmatrix(x);
			}
		}
		else
		{
			max_jit_mop_outputmatrix(x);
		}
	}	
}
void max_jit_la_diagproduct_mproc(t_max_jit_la_diagproduct *x, void *mop)
{
	t_jit_err err;
	long ac;
	t_atom *av=NULL;
	void *o;
	
	o=max_jit_obex_jitob_get(x);
	if (err=(t_jit_err) jit_object_method(
		o,
		_jit_sym_matrix_calc,
		jit_object_method(mop,_jit_sym_getinputlist),
		jit_object_method(mop,_jit_sym_getoutputlist))) 
	{
		jit_error_code(x,err); 
	} else {
		jit_object_method(o,ps_getresult,&ac,&av);
		switch(ac) {
		case 1:
			outlet_float(x->valout,jit_atom_getfloat(av));
			break;
		case 2:
			outlet_anything(x->valout,_jit_sym_list,2,av);
			break;
		}
		if (av) jit_freebytes(av,(ac)*sizeof(t_atom));
	}
}
Beispiel #11
0
void max_jit_ys_timespace_free(t_max_jit_ys_timespace *x)
{
	max_jit_mop_free(x);
	jit_object_free(max_jit_obex_jitob_get(x));
	
	max_jit_obex_free(x);
}
Beispiel #12
0
void max_jit_3m_free(t_max_jit_3m *x)
{
	max_jit_mop_free(x);
	jit_object_free(max_jit_obex_jitob_get(x));
	if (x->av)
		jit_freebytes(x->av,sizeof(t_atom)*JIT_MATRIX_MAX_PLANECOUNT);
	max_jit_obex_free(x);
}
void max_jit_gl_spoutsender_free(t_max_jit_gl_spoutsender *x)
{
	// lookup our internal Jitter object instance and free
	jit_object_free(max_jit_obex_jitob_get(x));

	// free resources associated with our obex entry
	max_jit_object_free(x);
}
Beispiel #14
0
void max_jit_notify_free(t_max_jit_notify *x)
{

	//NOTIFY EXAMPLE: DETACH FROM JIT OBJECT(SERVER)
	jit_object_detach(x->servername,x);

	max_jit_mop_free(x);
	jit_object_free(max_jit_obex_jitob_get(x));
	max_jit_obex_free(x);
}
void max_jit_ys_pixelweightmat_free(t_max_jit_ys_pixelweightmat *x)
{
	max_jit_mop_free(x);
	jit_object_free(max_jit_obex_jitob_get(x));
	
	// free buffer for outlet
	//f(x->mapout_buff) jit_freebytes(x->mapout_buff, sizeof(long)*MAX_OUT);
	
	max_jit_obex_free(x);
}
Beispiel #16
0
static void
PenizeFreeMaxShell(
	msobPenize* me)
	
	{
	
	max_jit_mop_free(me);
	jit_object_free(max_jit_obex_jitob_get(me));
	max_jit_obex_free(me);
	
	}
Beispiel #17
0
void max_hoa_gl_scope_free(t_max_hoa_gl_scope *x)
{
	// lookup our internal Jitter object instance and free
	jit_object_free(max_jit_obex_jitob_get(x));
	
	dsp_free((t_pxobject *)x);
	delete x->f_scope;
    delete [] x->f_signals;
	
	// free resources associated with our obex entry
	max_jit_object_free(x);
}
Beispiel #18
0
void
PenizeBang(
	msobPenize* me)
	
	{
	
	if (max_jit_mop_getoutputmode(me) != 0) {
		jcobPenize* jitOb = (jcobPenize*) max_jit_obex_jitob_get(me);
		
		SendDataToOutlet(jitOb, gSymGetDiffs, me->coreObject.o_outlet);
		}

	}
Beispiel #19
0
void max_jit_3m_mproc(t_max_jit_3m *x, void *mop)
{
	t_jit_err err;
	
	if (err=(t_jit_err) jit_object_method(
		max_jit_obex_jitob_get(x),
		_jit_sym_matrix_calc,
		jit_object_method(mop,_jit_sym_getinputlist),
		jit_object_method(mop,_jit_sym_getoutputlist))) 
	{
		jit_error_code(x,err); 
	} else {
		max_jit_3m_bang(x);
	}
}
Beispiel #20
0
void max_jit_unpack_jit_matrix(t_max_jit_unpack *x, t_symbol *s, long argc, t_atom *argv)
{
	long i;
	long jump[JIT_MATRIX_MAX_PLANECOUNT];
	void *o, *p;

	o = max_jit_obex_jitob_get(x);
	jit_attr_getlong_array(o, gensym("jump"), JIT_MATRIX_MAX_PLANECOUNT, jump);
	
	for(i=0; i < x->outlets; i++) {
		p=max_jit_mop_getoutput(x,i+1);
		jit_attr_setlong(p,gensym("minplanecount"),jump[i]);
		jit_attr_setlong(p,gensym("maxplanecount"),jump[i]);
	}
	
	max_jit_mop_jit_matrix(x,s,argc,argv);
}
Beispiel #21
0
void
PenizeTattle(
	msobPenize* me)
	
	{
	jcobPenize* jitOb = (jcobPenize*) max_jit_obex_jitob_get(me);
	
	post("%s state", kMaxClassName);

#ifdef __DEBUG__
	post("  Max object lcoated at %p", me);
	post("  core Jitter object located at %p", jitOb);
#endif

	post("  Collecting statistics for %ld planes of data", (long) jitOb->planeCount);
	
	}
void max_jit_submatrix_mproc(t_max_jit_submatrix *x, void *mop)
{
	t_jit_err err;


	if (err=(t_jit_err) jit_object_method(
				max_jit_obex_jitob_get(x),
				_jit_sym_matrix_calc,
				jit_object_method(mop,_jit_sym_getinputlist),
				jit_object_method(mop,_jit_sym_getoutputlist)))
	{
		jit_error_code(x,err);
	} else {
		max_jit_mop_outputmatrix(x);
		jit_object_method(max_jit_mop_getoutput(x,1),_jit_sym_data,NULL);
	}
}
Beispiel #23
0
void
PenizeMaxMProc(
	msobPenize*	me,
	void*				mop)
	
	{
	t_jit_err err = (t_jit_err) jit_object_method(
										max_jit_obex_jitob_get(me),
										_jit_sym_matrix_calc,
										jit_object_method(mop, _jit_sym_getinputlist),
										jit_object_method(mop, _jit_sym_getoutputlist)
										);
	
	if (err == JIT_ERR_NONE)
		 PenizeBang(me);
	else jit_error_code(me, err); 
	
	}
void max_jit_ys_pixelweightmat_mproc(t_max_jit_ys_pixelweightmat *x, void *mop)
{
	t_jit_err err;
	void *o;
	
	o=max_jit_obex_jitob_get(x);
	if (err=(t_jit_err) jit_object_method(
		o,
		_jit_sym_matrix_calc,
		jit_object_method(mop,_jit_sym_getinputlist),
		jit_object_method(mop,_jit_sym_getoutputlist))) 
	{
		jit_error_code(x,err); 
	} else {
		// bang method
		max_jit_ys_pixelweightmat_bang(x);
	}
}
void max_ta_jit_kinect2_outputmatrix(t_max_ta_jit_kinect2 *x)
{
    void *mop=max_jit_obex_adornment_get(x,_jit_sym_jit_mop);
    t_jit_err err;
    
    if (mop) { //always output
        if (err=(t_jit_err)jit_object_method(max_jit_obex_jitob_get(x),
                                             _jit_sym_matrix_calc,
                                             jit_object_method(mop,_jit_sym_getinputlist),
                                             jit_object_method(mop,_jit_sym_getoutputlist)))
        {
            jit_error_code(x,err);
        }
        else {
            max_jit_mop_outputmatrix(x);
        }
    }
}
void max_jit_gl_spout_receiver_draw(t_max_jit_gl_spout_receiver *x, t_symbol *s, long argc, t_atom *argv)
{

	t_atom a;

	// get the jitter object
	t_jit_object *jitob = (t_jit_object*)max_jit_obex_jitob_get(x);
	
	// call the jitter object's draw method
	jit_object_method(jitob, s, s, argc, argv);
	
	// query the texture name and send out the texture output 
	jit_atom_setsym(&a,jit_attr_getsym(jitob, ps_out_name));

	outlet_anything(x->texout, ps_jit_gl_texture, 1, &a);


}
void max_jit_tml_particleFlow_mproc(t_max_jit_tml_particleFlow *x, void *mop)
{
	t_jit_err err;
	void *o;
	
	o=max_jit_obex_jitob_get(x);
	if (err=(t_jit_err) jit_object_method(
		o,
		_jit_sym_matrix_calc,
		jit_object_method(mop,_jit_sym_getinputlist),
		jit_object_method(mop,_jit_sym_getoutputlist))) 
	{
		jit_error_code(x,err); 
	} else {
		// bang method
		max_jit_tml_particleFlow_bang(x);
	}
}
Beispiel #28
0
void max_jit_op_mproc(t_max_jit_op *x, void *mop)
{
	t_jit_err err;
	t_jit_matrix_info tmpinfo;
	void *o;
	long changed=0,i;
	
	if (x->last==OP_LAST_VAL) {
		tmpinfo = x->lastinfo;
		o = max_jit_mop_getinput(x,2);
		jit_object_method(o,_jit_sym_getinfo,&x->lastinfo);
		if (tmpinfo.type!=x->lastinfo.type)
			changed = TRUE;
		else if (tmpinfo.planecount!=x->lastinfo.planecount)
			changed = TRUE;
		/* Already handled by resampling
		else if (tmpinfo.dimcount!=x->lastinfo.dimcount)
			changed = TRUE;
		else {
			for (i=0;i<tmpinfo.dimcount;i++) {
				if (tmpinfo.dim[i]!=x->lastinfo.dim[i])
					changed=TRUE;
			}
		}
		*/
		if (changed)
			jit_object_method(o,_jit_sym_setall,0L,x->valcount,x->val);		
	}
	
	if (err=(t_jit_err) jit_object_method(
		max_jit_obex_jitob_get(x),
		_jit_sym_matrix_calc,
		jit_object_method(mop,_jit_sym_getinputlist),
		jit_object_method(mop,_jit_sym_getoutputlist))) 
	{
		jit_error_code(x,err); 
	} else {
		max_jit_mop_outputmatrix(x);
	}
}
Beispiel #29
0
void max_jit_3m_bang(t_max_jit_3m *x)
{
	long ac;
	void *o;
	
	if (max_jit_mop_getoutputmode(x)&&x->av) {
		o=max_jit_obex_jitob_get(x);
		//passing in memory to attr function. be sure object knows how to handle this
		ac=JIT_MATRIX_MAX_PLANECOUNT;
		jit_object_method(o,ps_getmax,&ac,&(x->av));
		if (ac>1)
			outlet_anything(x->maxout,_jit_sym_list,ac,x->av);
		else {
			if (x->av->a_type==A_FLOAT)
				outlet_float(x->maxout,jit_atom_getfloat(x->av));
			else 
				outlet_int(x->maxout,jit_atom_getlong(x->av));
		}
		ac=JIT_MATRIX_MAX_PLANECOUNT;
		jit_object_method(o,ps_getmean,&ac,&(x->av));
		if (ac>1)
			outlet_anything(x->meanout,_jit_sym_list,ac,x->av);
		else {
			if (x->av->a_type==A_FLOAT)
				outlet_float(x->meanout,jit_atom_getfloat(x->av));
			else 
				outlet_int(x->meanout,jit_atom_getlong(x->av));
		}
		ac=JIT_MATRIX_MAX_PLANECOUNT;
		jit_object_method(o,ps_getmin,&ac,&(x->av));
		if (ac>1)
			outlet_anything(x->minout,_jit_sym_list,ac,x->av);
		else {
			if (x->av->a_type==A_FLOAT)
				outlet_float(x->minout,jit_atom_getfloat(x->av));
			else 
				outlet_int(x->minout,jit_atom_getlong(x->av));
		}
	}
}
void max_jit_SDIF_buffer_outputmatrix(t_max_jit_SDIF_buffer *x){
	t_atom a;
	long outputmode=max_jit_mop_getoutputmode(x);
	void *mop=max_jit_obex_adornment_get(x,_jit_sym_jit_mop);
	t_jit_err err;	
	
	if (outputmode&&mop) { //always output unless output mode is none
		if (outputmode==1) {
			if (err=(t_jit_err)jit_object_method(
				max_jit_obex_jitob_get(x), 
				_jit_sym_matrix_calc,
				jit_object_method(mop,_jit_sym_getinputlist),
				jit_object_method(mop,_jit_sym_getoutputlist),
				x->t_matrix))
			{
				jit_error_code(x,err); 
			} else {
				max_jit_mop_outputmatrix(x);
			}
		}
	}	
}