Пример #1
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);
}
Пример #2
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);
}
Пример #3
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);
}
Пример #4
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);
}
Пример #5
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);
}
Пример #6
0
/*------------------------------------ listTypeCreate ---*/
static void *
listTypeCreate(void)
{
    ListTypeData * xx = static_cast<ListTypeData *>(object_alloc(gClass));
    
    if (xx)
    {
        xx->fResultOut = static_cast<t_outlet *>(intout(xx));
        if (! xx->fResultOut)
        {
            LOG_ERROR_1(xx, OUTPUT_PREFIX "unable to create port for object")
            freeobject(reinterpret_cast<t_object *>(xx));
            xx = NULL;
        }
    }
    return xx;
} // listTypeCreate
Пример #7
0
// Destroy
void out_free(t_out *x)
{
#ifdef JCOM_OUT_TILDE
	dsp_free((t_pxobject *)x);			// Always call dsp_free first in this routine
	freeobject((t_object *)x->clock);	// delete our clock
	
	TTObjectRelease(&x->audioIn);
	TTObjectRelease(&x->audioOut);
	TTObjectRelease(&x->audioTemp);
	TTObjectRelease(&x->zeroSignal);
	TTObjectRelease(&x->xfade);
	TTObjectRelease(&x->gain);
	TTObjectRelease(&x->ramp_gain);
	TTObjectRelease(&x->ramp_xfade);
#endif
	jcom_core_subscriber_common_free(&x->common);
}
Пример #8
0
void jit_gl_hap_notify_atomarray_prep(t_jit_gl_hap *x, t_symbol *s, long ac, t_atom *av)
{
	if (ac && av) {
		t_object *arr;
		t_atom *a;
		
		if (a = (t_atom *)sysmem_newptr(sizeof(t_atom) * (ac + 1))) {
			jit_atom_setsym(a, s);
			sysmem_copyptr(av, a + 1, sizeof(t_atom) * ac);
			arr = (t_object *)object_new(gensym("nobox"), gensym("atomarray"), ac + 1, a);
			jit_object_notify(x, gensym("typedmess"), arr);
			freeobject(arr);
			sysmem_freeptr(a);
		}
	}
	else jit_object_notify(x, s, NULL);
}
Пример #9
0
/*------------------------------------ senseXCreate ---*/
static void *
senseXCreate(const long onDelay,
             const long offDelay)
{
    SenseXData * xx = static_cast<SenseXData *>(object_alloc(gClass));
    
    if (xx)
    {
        long actOffDelay;
        long actOnDelay;
        
        if (0 > offDelay)
        {
            LOG_ERROR_1(xx, OUTPUT_PREFIX "off delay is not valid")
            actOffDelay = 0;
        }
        else
        {
            actOffDelay = offDelay;
        }
        if (0 > onDelay)
        {
            LOG_ERROR_1(xx, OUTPUT_PREFIX "on delay is not valid")
            actOnDelay = 0;
        }
        else
        {
            actOnDelay = onDelay;
        }
        xx->fOffDelay = actOffDelay;
        xx->fOnDelay = actOnDelay;
        xx->fStopping = false;
        xx->fPollClock = MAKE_CLOCK(xx, senseXProcessClock);
        xx->fPollQueue = MAKE_QELEM(xx, senseXProcessQueue);
        xx->fResultOut = static_cast<t_outlet *>(intout(xx));
        xx->fProxy = proxy_new(xx, 1L, &xx->fInletNumber);
        xx->fState = kAwaitingFirstMessage;
        if (! (xx->fResultOut && xx->fProxy))
        {
            LOG_ERROR_1(xx, OUTPUT_PREFIX "unable to create port for object")
            freeobject(reinterpret_cast<t_object *>(xx));
            xx = NULL;
        }
    }
    return xx;
} // senseXCreate
Пример #10
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;
	}
Пример #11
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);
}
Пример #12
0
void isomorph::setup_and_create_solution_database(INT verbose_level)
{
	INT f_v = (verbose_level >= 1);

	if (f_v) {
		cout << "isomorph::setup_and_create_solution_database" << endl;
		}
	if (DB_sol) {
		freeobject(DB_sol);
		DB_sol = NULL;
		}
	DB_sol = (database *)callocobject(DATABASE);
	DB_sol->change_to_database();
	
	init_DB_sol(0 /*verbose_level - 1*/);
	
	DB_sol->create(0 /*verbose_level - 1*/);
}
Пример #13
0
void otudp_free(OTUDP *x) {
	debug_close_post("* entered otudp_free");
	
	freeobject(x->o_clock);
    if (x->o_udp_ep != 0) {
    	debug_close_post("* about to close Open Transport endpoint...");
		OTCloseProvider(x->o_udp_ep);
		debug_close_post("* ... closed Open Transport endpoint");
	} else {
		debug_close_post("* This OTUDP object didn't have an Open Transport endpoint");
	}
	
	if (x->allBuffers != 0) {
		DestroyPackets(x->allBuffers, x->nbufs);
	}
	
	qelem_free(x->UnbindQelem);
}
Пример #14
0
/*------------------------------------ udpPortCreate ---*/
static void *
udpPortCreate(const long port,
              const long numBuffers)
{
    UdpObjectData * xx = static_cast<UdpObjectData *>(object_alloc(gClass));
    
    if (xx)
    {
        bool okSoFar = true;
        long actBuffCount;
        
#if defined(BE_VERBOSE)
        xx->fVerbose = false;
#endif /* BE_VERBOSE */
        presetObjectPointers(xx);
        if ((0 > port) || (MAX_PORT < port) || (0 > numBuffers))
        {
            LOG_ERROR_1(xx, OUTPUT_PREFIX "invalid parameters for device")
            okSoFar = false;
        }
        if (0 == numBuffers)
        {
            actBuffCount = NUM_RX_BUFFERS;
        }
        else
        {
            actBuffCount = numBuffers;
        }
        if (okSoFar)
        {
            okSoFar = initObject(xx, port, actBuffCount);
        }
        if (okSoFar)
        {
            udpPortSetPort(xx, false);
        }
        else
        {
            freeobject(reinterpret_cast<t_object *>(xx));
            xx = NULL;
        }
    }
    return xx;
} // udpPortCreate
Пример #15
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);
}
Пример #16
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);
}
Пример #17
0
void hoa_print_credit()
{
    if(gensym("hoa_print_credits")->s_thing == NULL)
    {
		t_object* print;
		t_atom* sym = (t_atom*) malloc( sizeof(t_atom));
		atom_setsym(sym, gensym("HoaLibrary"));
		print = (t_object*)object_new_typed(CLASS_BOX, gensym("print"), 1, sym);
		atom_setsym(sym, _sym_credit_line1);
		object_method_typed(print, gensym("list"), 1, sym, NULL);
		atom_setsym(sym, _sym_hoa_version);
		print = (t_object*)object_new_typed(CLASS_BOX, gensym("print"), 1, sym);
		atom_setsym(sym, _sym_credit_line2);
		object_method_typed(print, gensym("list"), 1, sym, NULL);
		gensym("hoa_print_credits")->s_thing = print;
		freeobject(print);
		free(sym);
    }
}
Пример #18
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);
}
Пример #19
0
/*------------------------------------ notXCreate ---*/
static void *
notXCreate(void)
{
    NotXData * xx = static_cast<NotXData *>(object_alloc(gClass));
    
    if (xx)
    {
        xx->fPreviousList = NULL;
        xx->fPreviousLength = 0;
        xx->fPreviousResult = 0;
        xx->fResultOut = static_cast<t_outlet *>(outlet_new(xx, NULL));
        if (! xx->fResultOut)
        {
            LOG_ERROR_1(xx, OUTPUT_PREFIX "unable to create port for object")
            freeobject(reinterpret_cast<t_object *>(xx));
            xx = NULL;
        }
    }
    return xx;
} // notXCreate
Пример #20
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);
}
Пример #21
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);
}
Пример #22
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);
}
Пример #23
0
void  noisiness_free(t_noisiness *x) {

    dsp_free((t_pxobject *)x);

#ifdef __ALTIVEC__
#pragma altivec_model on
    if (x->x_A.realp) t_freebytes(x->x_A.realp, x->x_FFTSizeOver2);
    if (x->x_A.imagp) t_freebytes(x->x_A.imagp, x->x_FFTSizeOver2);
    if (x->x_setup) destroy_fftsetup(x->x_setup);
#pragma altivec_model off
#else
    if (x->memFFT != NULL) DisposePtr((char *) x->memFFT);
#endif
    if (x->Buf1 != NULL) DisposePtr((char *) x->Buf1);
    if (x->Buf2 != NULL) DisposePtr((char *) x->Buf2);
    if (x->BufFFT != NULL) DisposePtr((char *) x->BufFFT);
    if (x->WindFFT != NULL) DisposePtr((char *) x->WindFFT);
    if (x->x_clock != NULL) freeobject((t_object *)x->x_clock);
    if (x->BufBark != NULL) DisposePtr((char *) x->BufBark);
    if (x->BufSizeBark != NULL) DisposePtr((char *) x->BufSizeBark);

}
Пример #24
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);
}
Пример #25
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);
}
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);
}
Пример #27
0
void jit_gl_lua_free(t_jit_gl_lua *x)
{
	/* call closebang method on script if it exists*/
	jit_gl_lua_closebang(x);

	/* Remember to destroy the Lua State */
	lua_close(x->lua);
	
	//free handle on script data
	if (x->texthandle) {
		//HUnlock(x->texthandle);
		sysmem_lockhandle(x->texthandle, false);
		//DisposeHandle(x->texthandle);
		sysmem_freehandle(x->texthandle);
	}
	
	if (x->file_watcher) {
		freeobject((t_object *)x->file_watcher);
		x->file_watcher = NULL;
	}
	
	jit_ob3d_free(x);
}
Пример #28
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);
}
Пример #29
0
Object *
search(Object *rt, Object *parent, Reprog *preg) {
    /* Create a `search object', a subtree of rt containing
     * only objects with s in their value of key fields plus
     * their parentage.
     *
     * Algorithm: depth-first traversal of rt.  On the way down,
     * copy rt to nr (new root), on the way back up, delete
     * subtrees without match.
     *
     * returns null when there are no matches in rt's subtree
     */
    Object *o, *nr;
    char *s;
    int i;
    int yes = 0;

    nr = newobject(rt->type, parent);
    nr->orig = rt->orig?rt->orig:rt;
    nr->value = rt->value;
    strncpy(nr->key, rt->key, KEYLEN);

    if((((s = nr->value)) && regexec(preg, s, nil, 0) == 1)
            || (((s = nr->value)) && regexec(preg, s, nil, 0) == 1))
        yes = 1;
    for(i = 0; i < rt->nchildren; i++)
        if((o = search((Object*)rt->children[i], nr, preg))) {
            yes = 1;
            addchild(nr, o, "search");
        }
    if(yes == 0) {
        freeobject(nr, "s");
        return nil;
    }
    return nr;
}
/* 
 * 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);
}