Beispiel #1
0
	static inline void
	AddInfo(void)
		{
		Object*	attr;
		Symbol*	symFloat64		= gensym("float64");
		Symbol*	symLong			= gensym("long");
		
		// Read-Write Attributes
		attr = attr_offset_new("dice", symLong, 0, NULL, NULL, calcoffset(objDicey, nDice));
		class_addattr(gObjectClass, attr);
		attr = attr_offset_new("faces", symLong, 0, NULL, NULL, calcoffset(objDicey, nFaces));
		class_addattr(gObjectClass, attr);
		
		// Read-Only Attributes
		attr = attribute_new("min", symLong, kAttrFlagsReadOnly, (method) DiceyGetMin, NULL);
		class_addattr(gObjectClass, attr);
		attr = attribute_new("max", symLong, kAttrFlagsReadOnly, (method) DiceyGetMax, NULL);
		class_addattr(gObjectClass, attr);
		attr = attribute_new("mean", symFloat64, kAttrFlagsReadOnly, (method) DiceyGetMean, NULL);
		class_addattr(gObjectClass, attr);
		attr = attribute_new("median", symFloat64, kAttrFlagsReadOnly, (method) DiceyGetMedian, NULL);
		class_addattr(gObjectClass, attr);
		attr = attribute_new("mode", symFloat64, kAttrFlagsReadOnly, (method) DiceyGetMode, NULL);
		class_addattr(gObjectClass, attr);
		attr = attribute_new("var", symFloat64, kAttrFlagsReadOnly, (method) DiceyGetVar, NULL);
		class_addattr(gObjectClass, attr);
		attr = attribute_new("stddev", symFloat64, kAttrFlagsReadOnly, (method) DiceyGetStdDev, NULL);
		class_addattr(gObjectClass, attr);
		attr = attribute_new("skew", symFloat64, kAttrFlagsReadOnly, (method) DiceyGetSkew, NULL);
		class_addattr(gObjectClass, attr);
		attr = attribute_new("kurtosis", symFloat64, kAttrFlagsReadOnly, (method) DiceyGetKurtosis, NULL);
		class_addattr(gObjectClass, attr);
		attr = attribute_new("entropy", symFloat64, kAttrFlagsReadOnly, (method) DiceyGetEntropy, NULL);
		class_addattr(gObjectClass, attr);
		}
Beispiel #2
0
int TTCLASSWRAPPERMAX_EXPORT main(void)
{
	long attrflags = 0;
	t_class *c;
	t_object *attr;

	TTDSPInit();	
	common_symbols_init();

	c = class_new("jcom.balance~",(method)balance_new, (method)balance_free, (short)sizeof(t_balance), 
		(method)0L, A_GIMME, 0);

 	class_addmethod(c, (method)balance_clear, 			"clear",	0L);		
 	class_addmethod(c, (method)balance_dsp, 			"dsp",		A_CANT, 0L);		
	class_addmethod(c, (method)balance_assist, 			"assist",	A_CANT, 0L); 

	attr = attr_offset_new("bypass", _sym_long, attrflags,
		(method)0L,(method)balance_setBypass, calcoffset(t_balance, attrBypass));
	class_addattr(c, attr);	

	attr = attr_offset_new("frequency", _sym_float32, attrflags,
		(method)0L,(method)balance_setFrequency, calcoffset(t_balance, attrFrequency));
	class_addattr(c, attr);	

	class_dspinit(c);						// Setup object's class to work with MSP
	class_register(CLASS_BOX, c);
	balance_class = c;

	return 0;
}
Beispiel #3
0
/** Class Definition
  */
int JAMOMA_EXPORT_MAXOBJ main(void)
{
	//post("main");
	
	long attrflags = 0;
	t_class *c;
	t_object *attr;

	jamoma_init();
common_symbols_init();
	jps_symbol  = gensym("symbol");
	jps_long    = gensym("long");
	jps_float32 = gensym("float32");
	jps_dumpout = gensym("dumpout");

	// Define our class
	c = class_new("jcom.envexp",(method)envExp_new, 0L, sizeof(t_envExp), (method)0L, A_GIMME, 0);

	// Make methods accessible for our class: 
	class_addmethod(c, (method)envExp_bang,				"bang",		A_CANT,		0);
	class_addmethod(c, (method)envExp_float,			"float",	A_FLOAT,	0);
	class_addmethod(c, (method)envExp_assist, 			"assist",	A_CANT,		0); 
	class_addmethod(c, (method)object_obex_dumpout, 	"dumpout",	A_CANT,		0);
	
	// ATTRIBUTE: attack
	attr = attr_offset_new("attack", jps_float32, attrflags,
		(method)0L, (method)envExp_setattack, calcoffset(t_envExp, attr_attack));
	class_addattr(c, attr);

	// ATTRIBUTE: maximum amplitude
	attr = attr_offset_new("amplitude", jps_float32, attrflags,
		(method)0L, (method)envExp_setamplitude, calcoffset(t_envExp, attr_amplitude));
	class_addattr(c, attr);
		
	// ATTRIBUTE: decay rate
	attr = attr_offset_new("decayrate", jps_float32, attrflags,
		(method)0L, (method)envExp_setdecayrate, calcoffset(t_envExp, attr_decayrate));
	class_addattr(c, attr);

	// ATTRIBUTE: low threshold
	attr = attr_offset_new("threshold", jps_float32, attrflags,
		(method)0L, (method)envExp_setthreshold, calcoffset(t_envExp, attr_threshold));
	class_addattr(c, attr);	
	
	// ATTRIBUTE: note stealing
	attr = attr_offset_new("steal", jps_long, attrflags,
		(method)0L, (method)0L, calcoffset(t_envExp, attr_steal));
	class_addattr(c, attr);

	// Finalize our class
	class_register(CLASS_BOX, c);
	this_class = c;
	
	return 0;
}
Beispiel #4
0
int C74_EXPORT main(void)
{
	long attrflags = 0;
	t_class *c;
	t_object *attr;
	
	TTDSPInit();
	common_symbols_init();

	c = class_new("j.zerox~", (method)zerox_new, (method)zerox_free, sizeof(t_zerox), (method)0L, A_GIMME, 0);

	class_addmethod(c, (method)zerox_dsp, 		"dsp",		A_CANT, 0L);		
	class_addmethod(c, (method)zerox_dsp64,		"dsp64",	A_CANT, 0);
    class_addmethod(c, (method)zerox_assist, 	"assist",	A_CANT, 0L); 
	class_addmethod(c, (method)jamoma_fileusage, "fileusage", A_CANT, 0);

	attr = attr_offset_new("size", _sym_long, attrflags,
		(method)0L, (method)attr_set_size, calcoffset(t_zerox, attr_size));
	class_addattr(c, attr);
	
	class_dspinit(c);
	class_register(CLASS_BOX, c);
	s_zerox_class = c;
	return 0;
}
Beispiel #5
0
int C74_EXPORT main(void)
{
	t_class* c;
	
	TTFoundationInit();
	common_symbols_init();
	
	// Define our class
	c = class_new("j.unit",(method)dataspace_new, (method)dataspace_free, sizeof(t_dataspace), (method)0L, A_GIMME, 0);
	
	// Make methods accessible for our class:
	class_addmethod(c, (method)dataspace_int,			"int",				A_LONG, 0);
	class_addmethod(c, (method)dataspace_float,			"float",			A_FLOAT, 0);
	class_addmethod(c, (method)dataspace_list,			"list",				A_GIMME, 0);
	class_addmethod(c, (method)dataspace_getDataspaces,	"dataspaces.get",	0);
 	class_addmethod(c, (method)dataspace_getUnits,		"units.get",		A_GIMME, 0);
	class_addmethod(c, (method)dataspace_assist,		"assist",			A_CANT, 0); 
    class_addmethod(c, (method)object_obex_dumpout, 	"dumpout",			A_CANT, 0);
	class_addmethod(c, (method)jamoma_fileusage, "fileusage", A_CANT, 0);
	
	class_addattr(c, 
				  attr_offset_new("dataspace", _sym_symbol, 0,
								  (method)0, (method)dataspace_setDataspace, calcoffset(t_dataspace, attr_dataspace)));

	CLASS_ATTR_SYM(c,		"input",	0,		t_dataspace,	attr_dataspace_active);
	CLASS_ATTR_ACCESSORS(c,	"input",	NULL,	dataspace_setDataspaceActive);
	
	CLASS_ATTR_SYM(c,		"output",	0,		t_dataspace,	attr_dataspace_native);
	CLASS_ATTR_ACCESSORS(c,	"output",	NULL,	dataspace_setDataspaceNative);
	
	// Finalize our class
	class_register(CLASS_BOX, c);
	dataspace_class = c;
	return 0;
}
void send_tilde_initclass(void)
{
    long attrflags = 0;
    t_class *c;
    t_object *attr;

    // Define our class
    c = class_new("jcom.send~", (method)audiosend_new, (method)audiosend_free,
                  sizeof(t_audiosend), (method)NULL, A_GIMME, 0);

    // Make methods accessible for our class:
    class_addmethod(c, (method)audiosend_bang,			"bang",			0);
    class_addmethod(c, (method)audiosend_dsp,			"dsp", 			A_CANT, 0);
    class_addmethod(c, (method)audiosend_assist,		"assist", 		A_CANT, 0);
    class_addmethod(c, (method)object_obex_dumpout, 	"dumpout", 		A_CANT,0);

    // ATTRIBUTE: name
    attr = attr_offset_new("target", _sym_symbol, attrflags,
                           (method)0, (method)audiosend_attr_settarget, calcoffset(t_audiosend, attr_target));
    class_addattr(c, attr);

    // Setup our class to work with MSP
    class_dspinit(c);

    // Finalize our class
    class_register(CLASS_BOX, c);
    s_audiosend_class = c;
}
Beispiel #7
0
void send_initclass()
{
	long attrflags = 0;
	t_class *c;
	t_object *attr;
	
	// Define our class
	c = class_new("jcom.send", (method)send_new, (method)0L, sizeof(t_send), (method)0L, A_GIMME, 0);

	// Make methods accessible for our class:
	class_addmethod(c, (method)send_bang,				"bang",			0L);
	class_addmethod(c, (method)send_int,				"int",			A_LONG, 0L);
	class_addmethod(c, (method)send_float,				"float",		A_FLOAT, 0L);
	class_addmethod(c, (method)send_list,				"list",			A_GIMME, 0L);
	class_addmethod(c, (method)send_list,				"anything",		A_GIMME, 0L);
    class_addmethod(c, (method)send_assist,				"assist", 		A_CANT, 0L);
    class_addmethod(c, (method)object_obex_dumpout, 	"dumpout", 		A_CANT,0);
	
	// ATTRIBUTE: name
	attr = attr_offset_new("name", _sym_symbol, attrflags,
		(method)0, (method)0, calcoffset(t_send, attr_name));
	class_addattr(c, attr);
	
	// Finalize our class
	class_register(CLASS_BOX, c);
	s_send_class = c;
}
Beispiel #8
0
int JAMOMA_EXPORT_MAXOBJ main(void)
{
	long attrflags = 0;
	t_class *c;
	t_object *attr;
	
	common_symbols_init();

	// Define our class
	c = class_new("j.stats",(method)stats_new, (method)stats_free, sizeof(t_stats), (method)0L, A_GIMME, 0);		
		
	// Make methods accessible for our class: 

	class_addmethod(c, (method)stats_bang,				"bang",			0);
	class_addmethod(c, (method)stats_int,				"int",			A_LONG,		0);
 	class_addmethod(c, (method)stats_float, 			"float",		A_FLOAT,	0);		
	class_addmethod(c, (method)stats_assist, 			"assist",		A_CANT,		0); 
    class_addmethod(c, (method)stats_set,				"set",			A_FLOAT,	0);
	class_addmethod(c, (method)stats_window,			"window_size",	A_LONG,		0);
    class_addmethod(c, (method)stats_clear,				"clear",		0);
	class_addmethod(c, (method)object_obex_dumpout, 	"dumpout",		A_CANT,		0);
	
	// ATTRIBUTE: windowed
	attr = attr_offset_new("windowed", _sym_long, attrflags,
		(method)0, (method)stats_setwindowed, calcoffset(t_stats, attr_windowed));
	class_addattr(c, attr);	
	
	// Finalize our class
	class_register(CLASS_BOX, c);
	this_class = c;
	return 0;
}
void receive_initclass()
{
	long attrflags = 0;
	t_class *c;
	t_object *attr;
	
	// Define our class
	c = class_new(	"jcom.receive", 
					(method)receive_new, 
					(method)receive_free, 
					sizeof(t_receive), 
					(method)0L, 
					A_GIMME, 
					0);

	// Make methods accessible for our class: 
	class_addmethod(c, (method)receive_dispatch,		"dispatch",			A_CANT, 0);
	class_addmethod(c, (method)receive_setcallback,		"setcallback",		A_CANT, 0);
    class_addmethod(c, (method)receive_assist,			"assist", 			A_CANT, 0);
    class_addmethod(c, (method)object_obex_dumpout, 	"dumpout", 			A_CANT, 0); 
	
	// ATTRIBUTE: name
	attr = attr_offset_new("name", _sym_symbol, attrflags,
		(method)0, (method)receive_setname, calcoffset(t_receive, attr_name));
	class_addattr(c, attr);
	
	// Finalize our class
	class_register(CLASS_BOX, c);
	s_receive_class = c;
}
int JAMOMA_EXPORT_MAXOBJ main(void)
{
	t_class *c;
	
	jamoma_init();
	common_symbols_init();

	// Define our class
	c = class_new("jcom.ramp",(method)ramp_new, (method)ramp_free, sizeof(t_ramp), (method)0L, A_GIMME, 0);
	
	// Make methods accessible for our class:
	class_addmethod(c, (method)ramp_bang,					"bang",						0);
	class_addmethod(c, (method)ramp_int,					"int",						A_DEFLONG,	0);
	class_addmethod(c, (method)ramp_float,					"float",					A_DEFFLOAT,	0);
 	class_addmethod(c, (method)ramp_list,					"list",						A_GIMME,	0);
	class_addmethod(c, (method)ramp_set,					"set",						A_GIMME,	0);
	class_addmethod(c, (method)ramp_stop,					"stop",						0);
	class_addmethod(c, (method)ramp_attrset,				"attrset",					A_GIMME, 	0);
	class_addmethod(c, (method)ramp_attrget,				"attrget",					A_GIMME,	0);
	class_addmethod(c, (method)ramp_getFunctionParameter,	"function.parameter.get",	A_GIMME,	0);
	class_addmethod(c, (method)ramp_setFunctionParameter,	"function.parameter",		A_GIMME,	0);
	class_addmethod(c, (method)ramp_getDrives,				"drives.get",				0);
	class_addmethod(c, (method)ramp_getFunctions,			"functions.get",			0);
	class_addmethod(c, (method)ramp_clock,					"clock",					A_SYM,		0);
	class_addmethod(c, (method)ramp_assist,					"assist",					A_CANT,		0); 
    class_addmethod(c, (method)object_obex_dumpout,			"dumpout",					A_CANT,		0);

	// ATTRIBUTE: rampunit
	class_addattr(c, 
		attr_offset_new("drive", _sym_symbol, 0,
		(method)0, (method)ramp_setrampunit, calcoffset(t_ramp, attr_rampunit)));
	
	// ATTRIBUTE: function
	class_addattr(c, 
		attr_offset_new("function", _sym_symbol, 0,
		(method)0, (method)ramp_setFunction, calcoffset(t_ramp, attr_function)));	

	// Finalize our class
	class_register(CLASS_BOX, c);
	ramp_class = c;
	
	return 0;
}
Beispiel #11
0
int JAMOMA_EXPORT_MAXOBJ main(void)
{
	long 		attrflags = 0;
	t_class 	*c;
	t_object 	*attr = NULL;
	
	jamoma_init();
	common_symbols_init();

	// Define our class
#ifdef JCOM_OUT_TILDE
	c = class_new("jcom.out~",(method)out_new, (method)out_free, sizeof(t_out), (method)0L, A_GIMME, 0);
#else
	c = class_new("jcom.out",(method)out_new, (method)out_free, sizeof(t_out), (method)0L, A_GIMME, 0);
#endif

	// Make methods accessible for our class: 
	class_addmethod(c, (method)out_dispatched,			"dispatched",			A_GIMME, 0L);
	class_addmethod(c, (method)out_algorithm_message,	"algorithm_message",	A_GIMME, 0L);
	class_addmethod(c, (method)out_link_to_in_object,	"link_in", 				A_CANT, 0L);
	class_addmethod(c, (method)out_unlink,				"unlink_in",			0L);
	class_addmethod(c, (method)out_register_meter,		"register_meter",		A_CANT, 0L);
	class_addmethod(c, (method)out_remove_meters,		"remove_meters",		A_CANT, 0L);
	class_addmethod(c, (method)out_register_preview,	"register_preview",		A_CANT, 0L);
#ifdef JCOM_OUT_TILDE
	class_addmethod(c, (method)out_getAudioForChannel,	"getAudioForChannel",	A_CANT, 0);
	class_addmethod(c, (method)out_dsp,					"dsp", 					A_CANT, 0L);
#else
	class_addmethod(c, (method)out_anything,			"anything",				A_GIMME, 0L);
	class_addmethod(c, (method)out_sendbypassedvalue,	"sendbypassedvalue",	A_CANT, 0L);
	class_addmethod(c, (method)out_sendlastvalue,		"sendlastvalue",		A_CANT, 0L);
#endif
	class_addmethod(c, (method)out_release,				"release",				A_CANT, 0L);	// notification of hub being freed
    class_addmethod(c, (method)out_assist,				"assist", 				A_CANT, 0L);

	jcom_core_subscriber_classinit_common(c, attr);	
		
	// ATTRIBUTE: num_inputs
	attr = attr_offset_new("num_outputs", _sym_long, attrflags,
		(method)0, (method)0, calcoffset(t_out, numOutputs));
	class_addattr(c, attr);	

#ifdef JCOM_OUT_TILDE
	// Setup our class to work with MSP
	class_dspinit(c);
#endif 

	// Finalize our class
	class_register(CLASS_BOX, c);
	out_class = c;
	return 0;
}
Beispiel #12
0
// This is the default attribute getter for Jamoma's core
// It sends the data out not only the parameter dumpout, but also
// out the feedback outlet from the module
// for example:
// 	jamoma_class_attr_new(c, "ramp/drive", _sym_symbol, (method)param_setramp, 
//		calcoffset(t_param, attr_ramp));
void jamoma_class_attr_new(t_class *c, char *attrName, t_symbol *attrType, method setter, method getter)
{
	t_object	*attr = NULL;
	char		getterName[256];
	
	strcpy(getterName, attrName);
	strcat(getterName, "/get");

	attr = attr_offset_new(attrName, attrType, 0, getter, setter, NULL);
	class_addattr(c, attr);

	class_addmethod(c, (method)jamoma_class_attr_get, getterName, A_GIMME, 0);
}
Beispiel #13
0
extern "C" int C74_EXPORT main(void)
{
	long attrflags = 0;
	t_class *c;
	t_object *attr;
	
	c = class_new("tap.jit.proximity", (method)proximity_new, (method)proximity_free, sizeof(t_proximity), 
		(method)0L, A_GIMME, 0);

	common_symbols_init();
	
    class_addmethod(c, (method)proximity_coords,	"coords", A_FLOAT, A_FLOAT, 0L);
    class_addmethod(c, (method)proximity_assist, 	"assist", A_CANT, 0L); 
	class_addmethod(c, (method)stdinletinfo,		"inletinfo",	A_CANT, 0);

	// attrflags = JIT_ATTR_GET_DEFER_LOW | JIT_ATTR_SET_USURP_LOW ;
	
	// ATTRIBUTE: matrix name
	attr = attr_offset_new("name", _sym_symbol, attrflags, (method)0, (method)0, calcoffset(t_proximity, name));
	class_addattr(c, attr);
	
class_register(_sym_box, c); 	proximity_class = c;
}
TTErr wrapAsMaxAudioGraph(TTSymbolPtr ttClassName, char* maxClassName, WrappedClassPtr* c, WrappedClassOptionsPtr options)
{
	TTObject*		o = NULL;
	TTValue			v;
	TTUInt16		numChannels = 1;
	WrappedClass*	wrappedMaxClass = NULL;

	common_symbols_init();
	TTAudioGraphInit();
	
	if(!wrappedMaxClasses)
		wrappedMaxClasses = hashtab_new(0);
	
	wrappedMaxClass = new WrappedClass;
	wrappedMaxClass->maxClassName = gensym(maxClassName);
	wrappedMaxClass->maxClass = class_new(	maxClassName, 
											(method)wrappedClass_new, 
											(method)wrappedClass_free, 
											sizeof(WrappedInstance), 
											(method)0L, 
											A_GIMME, 
											0);
	wrappedMaxClass->ttClassName = ttClassName;
	wrappedMaxClass->validityCheck = NULL;
	wrappedMaxClass->validityCheckArgument = NULL;
	wrappedMaxClass->options = options;
	wrappedMaxClass->maxAttrNamesToTTAttrNames = hashtab_new(0);
	
	// Create a temporary instance of the class so that we can query it.
	TTObjectInstantiate(ttClassName, &o, numChannels);

	o->getMessageNames(v);
	for(TTUInt16 i=0; i<v.getSize(); i++){
		TTSymbolPtr			name = NULL;
		
		v.get(i, &name);
		if(name == TT("updateMaxNumChannels") || name == TT("updateSr"))
			continue;	// don't expose these attributes to Max users

		class_addmethod(wrappedMaxClass->maxClass, (method)wrappedClass_anything, (char*)name->getCString(), A_GIMME, 0);
	}
	
	o->getAttributeNames(v);
	for (TTUInt16 i=0; i<v.getSize(); i++) {
		TTSymbolPtr		name = NULL;
		TTAttributePtr	attr = NULL;
		SymbolPtr		maxType = _sym_long;
		TTCString		nameCString = NULL;
		SymbolPtr		nameMaxSymbol = NULL;
		TTUInt32		nameSize = 0;
		
		v.get(i, &name);
		if(name == TT("maxNumChannels") || name == TT("processInPlace"))
			continue;	// don't expose these attributes to Max users
		
		o->findAttribute(name, &attr);
		
		if (attr->type == kTypeFloat32)
			maxType = _sym_float32;
		else if (attr->type == kTypeFloat64)
			maxType = _sym_float64;
		else if (attr->type == kTypeSymbol || attr->type == kTypeString)
			maxType = _sym_symbol;
		
		// convert first letter to lower-case if it isn't already
		nameSize = name->getString().length();
		nameCString = new char[nameSize+1];
		strncpy_zero(nameCString, name->getCString(), nameSize+1);
		if (nameCString[0]>64 && nameCString[0]<91)
			nameCString[0] += 32;
		nameMaxSymbol = gensym(nameCString);
		
		hashtab_store(wrappedMaxClass->maxAttrNamesToTTAttrNames, nameMaxSymbol, ObjectPtr(name));
		class_addattr(wrappedMaxClass->maxClass, attr_offset_new(nameCString, maxType, 0, (method)wrappedClass_attrGet, (method)wrappedClass_attrSet, NULL));
		
		// Add display styles for the Max 5 inspector
		if (attr->type == kTypeBoolean)
			CLASS_ATTR_STYLE(wrappedMaxClass->maxClass, (char*)name->getCString(), 0, "onoff");
		if (name == TT("fontFace"))
			CLASS_ATTR_STYLE(wrappedMaxClass->maxClass,	"fontFace", 0, "font");
	}
	
	TTObjectRelease(&o);
	
	class_addmethod(wrappedMaxClass->maxClass, (method)MaxAudioGraphReset,		"audio.reset",		A_CANT, 0);
	class_addmethod(wrappedMaxClass->maxClass, (method)MaxAudioGraphSetup,		"audio.setup",		A_CANT, 0);
	class_addmethod(wrappedMaxClass->maxClass, (method)MaxAudioGraphConnect,		"audio.connect",	A_OBJ, A_LONG, 0);
    class_addmethod(wrappedMaxClass->maxClass, (method)object_obex_dumpout, 	"dumpout",				A_CANT, 0); 
	class_addmethod(wrappedMaxClass->maxClass, (method)wrappedClass_assist, 	"assist",				A_CANT, 0L);
	class_addmethod(wrappedMaxClass->maxClass, (method)stdinletinfo,			"inletinfo",			A_CANT, 0);
	
	class_register(_sym_box, wrappedMaxClass->maxClass);
	if (c)
		*c = wrappedMaxClass;
	
	hashtab_store(wrappedMaxClasses, wrappedMaxClass->maxClassName, ObjectPtr(wrappedMaxClass));
	return kTTErrNone;
}
Beispiel #15
0
extern "C" int TTCLASSWRAPPERMAX_EXPORT main(void)
{
    long attrflags = 0;
    t_class *c;
    t_object *attr;

    c = class_new("tap.jit.colortrack", (method)max_jit_colortrack_new, (method)max_jit_colortrack_free, sizeof(t_max_jit_colortrack),
                  (method)0L, A_GIMME, 0);

    common_symbols_init();															// Initialize TapTools
    class_addmethod(c, (method)max_jit_colortrack_jit_matrix,	"jit_matrix", A_GIMME, 0L);	//at beginning of messlist for speed
    class_addmethod(c, (method)max_jit_colortrack_assist,		"assist", A_CANT, 0L);
    class_addmethod(c, (method)stdinletinfo,					"inletinfo",	A_CANT, 0);

// 	attrflags = JIT_ATTR_GET_DEFER_LOW | JIT_ATTR_SET_USURP_LOW ;

    // ATTRIBUTE: output_bounds_1
    attr = attr_offset_new("output_bounds_1", _sym_char, attrflags,
                           (method)0, (method)colortrack_set_output_bounds_1, calcoffset(t_max_jit_colortrack, output_bounds[TRACKER_1]));
    class_addattr(c, attr);

    // ATTRIBUTE: output_bounds_2
    attr = attr_offset_new("output_bounds_2", _sym_char, attrflags,
                           (method)0, (method)colortrack_set_output_bounds_2, calcoffset(t_max_jit_colortrack, output_bounds[TRACKER_2]));
    class_addattr(c, attr);

    // ATTRIBUTE: output_bounds_3
    attr = attr_offset_new("output_bounds_3", _sym_char, attrflags,
                           (method)0, (method)colortrack_set_output_bounds_3, calcoffset(t_max_jit_colortrack, output_bounds[TRACKER_3]));
    class_addattr(c, attr);

    // ATTRIBUTE: output_bounds_4
    attr = attr_offset_new("output_bounds_4", _sym_char, attrflags,
                           (method)0, (method)colortrack_set_output_bounds_4, calcoffset(t_max_jit_colortrack, output_bounds[TRACKER_4]));
    class_addattr(c, attr);


    // ATTRIBUTE: output_center_1
    attr = attr_offset_new("output_center_1", _sym_char, attrflags,
                           (method)0, (method)colortrack_set_output_center_1, calcoffset(t_max_jit_colortrack, output_center[TRACKER_1]));
    class_addattr(c, attr);

    // ATTRIBUTE: output_center_2
    attr = attr_offset_new("output_center_2", _sym_char, attrflags,
                           (method)0, (method)colortrack_set_output_center_2, calcoffset(t_max_jit_colortrack, output_center[TRACKER_2]));
    class_addattr(c, attr);

    // ATTRIBUTE: output_center_3
    attr = attr_offset_new("output_center_3", _sym_char, attrflags,
                           (method)0, (method)colortrack_set_output_center_3, calcoffset(t_max_jit_colortrack, output_center[TRACKER_3]));
    class_addattr(c, attr);

    // ATTRIBUTE: output_center_4
    attr = attr_offset_new("output_center_4", _sym_char, attrflags,
                           (method)0, (method)colortrack_set_output_center_4, calcoffset(t_max_jit_colortrack, output_center[TRACKER_4]));
    class_addattr(c, attr);


    // ATTRIBUTE: output_size_1
    attr = attr_offset_new("output_size_1", _sym_char, attrflags,
                           (method)0, (method)colortrack_set_output_size_1, calcoffset(t_max_jit_colortrack, output_size[TRACKER_1]));
    class_addattr(c, attr);

    // ATTRIBUTE: output_size_2
    attr = attr_offset_new("output_size_2", _sym_char, attrflags,
                           (method)0, (method)colortrack_set_output_size_2, calcoffset(t_max_jit_colortrack, output_size[TRACKER_2]));
    class_addattr(c, attr);

    // ATTRIBUTE: output_size_3
    attr = attr_offset_new("output_size_3", _sym_char, attrflags,
                           (method)0, (method)colortrack_set_output_size_3, calcoffset(t_max_jit_colortrack, output_size[TRACKER_3]));
    class_addattr(c, attr);

    // ATTRIBUTE: output_size_4
    attr = attr_offset_new("output_size_4", _sym_char, attrflags,
                           (method)0, (method)colortrack_set_output_size_4, calcoffset(t_max_jit_colortrack, output_size[TRACKER_4]));
    class_addattr(c, attr);


    // ATTRIBUTE: hue_1
    attr = attr_offset_new("hue_1", _sym_long, attrflags,
                           (method)0, (method)colortrack_set_hue_1, calcoffset(t_max_jit_colortrack, hue[TRACKER_1]));
    class_addattr(c, attr);

    // ATTRIBUTE: hue_variation_1
    attr = attr_offset_new("hue_variation_1", _sym_long, attrflags,
                           (method)0, (method)colortrack_set_hue_variation_1, calcoffset(t_max_jit_colortrack, hue_variation[TRACKER_1]));
    class_addattr(c, attr);

    // ATTRIBUTE: hue_2
    attr = attr_offset_new("hue_2", _sym_long, attrflags,
                           (method)0, (method)colortrack_set_hue_2, calcoffset(t_max_jit_colortrack, hue[TRACKER_2]));
    class_addattr(c, attr);

    // ATTRIBUTE: hue_variation_2
    attr = attr_offset_new("hue_variation_2", _sym_long, attrflags,
                           (method)0, (method)colortrack_set_hue_variation_2, calcoffset(t_max_jit_colortrack, hue_variation[TRACKER_2]));
    class_addattr(c, attr);

    // ATTRIBUTE: hue_3
    attr = attr_offset_new("hue_3", _sym_long, attrflags,
                           (method)0, (method)colortrack_set_hue_3, calcoffset(t_max_jit_colortrack, hue[TRACKER_3]));
    class_addattr(c, attr);

    // ATTRIBUTE: hue_variation_3
    attr = attr_offset_new("hue_variation_3", _sym_long, attrflags,
                           (method)0, (method)colortrack_set_hue_variation_3, calcoffset(t_max_jit_colortrack, hue_variation[TRACKER_3]));
    class_addattr(c, attr);

    // ATTRIBUTE: hue_4
    attr = attr_offset_new("hue_4", _sym_long, attrflags,
                           (method)0, (method)colortrack_set_hue_4, calcoffset(t_max_jit_colortrack, hue[TRACKER_4]));
    class_addattr(c, attr);

    // ATTRIBUTE: hue_variation_4
    attr = attr_offset_new("hue_variation_4", _sym_long, attrflags,
                           (method)0, (method)colortrack_set_hue_variation_4, calcoffset(t_max_jit_colortrack, hue_variation[TRACKER_4]));
    class_addattr(c, attr);


    // ATTRIBUTE: saturation_1
    attr = attr_offset_new("saturation_1", _sym_long, attrflags,
                           (method)0, (method)colortrack_set_saturation_1, calcoffset(t_max_jit_colortrack, saturation[TRACKER_1]));
    class_addattr(c, attr);

    // ATTRIBUTE: saturation_variation_1
    attr = attr_offset_new("saturation_variation_1", _sym_long, attrflags,
                           (method)0, (method)colortrack_set_saturation_variation_1, calcoffset(t_max_jit_colortrack, saturation_variation[TRACKER_1]));
    class_addattr(c, attr);

    // ATTRIBUTE: saturation_2
    attr = attr_offset_new("saturation_2", _sym_long, attrflags,
                           (method)0, (method)colortrack_set_saturation_2, calcoffset(t_max_jit_colortrack, saturation[TRACKER_2]));
    class_addattr(c, attr);

    // ATTRIBUTE: saturation_variation_2
    attr = attr_offset_new("saturation_variation_2", _sym_long, attrflags,
                           (method)0, (method)colortrack_set_saturation_variation_2, calcoffset(t_max_jit_colortrack, saturation_variation[TRACKER_2]));
    class_addattr(c, attr);

    // ATTRIBUTE: saturation_3
    attr = attr_offset_new("saturation_3", _sym_long, attrflags,
                           (method)0, (method)colortrack_set_saturation_3, calcoffset(t_max_jit_colortrack, saturation[TRACKER_3]));
    class_addattr(c, attr);

    // ATTRIBUTE: saturation_variation_3
    attr = attr_offset_new("saturation_variation_3", _sym_long, attrflags,
                           (method)0, (method)colortrack_set_saturation_variation_3, calcoffset(t_max_jit_colortrack, saturation_variation[TRACKER_3]));
    class_addattr(c, attr);

    // ATTRIBUTE: saturation_4
    attr = attr_offset_new("saturation_4", _sym_long, attrflags,
                           (method)0, (method)colortrack_set_saturation_4, calcoffset(t_max_jit_colortrack, saturation[TRACKER_4]));
    class_addattr(c, attr);

    // ATTRIBUTE: saturation_variation_4
    attr = attr_offset_new("saturation_variation_4", _sym_long, attrflags,
                           (method)0, (method)colortrack_set_saturation_variation_4, calcoffset(t_max_jit_colortrack, saturation_variation[TRACKER_4]));
    class_addattr(c, attr);


    // ATTRIBUTE: brightness_1
    attr = attr_offset_new("brightness_1", _sym_long, attrflags,
                           (method)0, (method)colortrack_set_brightness_1, calcoffset(t_max_jit_colortrack, brightness[TRACKER_1]));
    class_addattr(c, attr);

    // ATTRIBUTE: brightness_variation_1
    attr = attr_offset_new("brightness_variation_1", _sym_long, attrflags,
                           (method)0, (method)colortrack_set_brightness_variation_1, calcoffset(t_max_jit_colortrack, brightness_variation[TRACKER_1]));
    class_addattr(c, attr);

    // ATTRIBUTE: brightness_2
    attr = attr_offset_new("brightness_2", _sym_long, attrflags,
                           (method)0, (method)colortrack_set_brightness_2, calcoffset(t_max_jit_colortrack, brightness[TRACKER_2]));
    class_addattr(c, attr);

    // ATTRIBUTE: brightness_variation_2
    attr = attr_offset_new("brightness_variation_2", _sym_long, attrflags,
                           (method)0, (method)colortrack_set_brightness_variation_2, calcoffset(t_max_jit_colortrack, brightness_variation[TRACKER_2]));
    class_addattr(c, attr);

    // ATTRIBUTE: brightness_3
    attr = attr_offset_new("brightness_3", _sym_long, attrflags,
                           (method)0, (method)colortrack_set_brightness_3, calcoffset(t_max_jit_colortrack, brightness[TRACKER_3]));
    class_addattr(c, attr);

    // ATTRIBUTE: brightness_variation_3
    attr = attr_offset_new("brightness_variation_3", _sym_long, attrflags,
                           (method)0, (method)colortrack_set_brightness_variation_3, calcoffset(t_max_jit_colortrack, brightness_variation[TRACKER_3]));
    class_addattr(c, attr);

    // ATTRIBUTE: brightness_4
    attr = attr_offset_new("brightness_4", _sym_long, attrflags,
                           (method)0, (method)colortrack_set_brightness_4, calcoffset(t_max_jit_colortrack, brightness[TRACKER_4]));
    class_addattr(c, attr);

    // ATTRIBUTE: brightness_variation_4
    attr = attr_offset_new("brightness_variation_4", _sym_long, attrflags,
                           (method)0, (method)colortrack_set_brightness_variation_4, calcoffset(t_max_jit_colortrack, brightness_variation[TRACKER_4]));
    class_addattr(c, attr);


    // this is very important!
    class_register(_sym_box, c);
    max_jit_colortrack_class = c;
}
Beispiel #16
0
TTErr wrapAsMaxGraph(TTSymbol& ttClassName, char* maxClassName, WrappedClassPtr* c, WrappedClassOptionsPtr options)
{
	TTObjectBasePtr	o = NULL;
	TTValue			v;
	TTUInt16		numChannels = 1;
	WrappedClass*	wrappedMaxClass = NULL;
	TTSymbol		name;
	TTCString		nameCString = NULL;
	t_symbol*		nameMaxSymbol = NULL;
	TTUInt32		nameSize = 0;

	common_symbols_init();
	TTGraphInit();
	
	if (!wrappedMaxClasses)
		wrappedMaxClasses = hashtab_new(0);
	
	wrappedMaxClass = new WrappedClass;
	wrappedMaxClass->maxClassName = gensym(maxClassName);
	wrappedMaxClass->maxClass = class_new(	maxClassName, 
											(method)wrappedClass_new, 
											(method)wrappedClass_free, 
											sizeof(WrappedInstance), 
											(method)0L, 
											A_GIMME, 
											0);
	wrappedMaxClass->ttClassName = ttClassName;
	wrappedMaxClass->validityCheck = NULL;
	wrappedMaxClass->validityCheckArgument = NULL;
	wrappedMaxClass->options = options;
	wrappedMaxClass->maxNamesToTTNames = hashtab_new(0);
	
	// Create a temporary instance of the class so that we can query it.
	TTObjectBaseInstantiate(ttClassName, &o, numChannels);

	o->getMessageNames(v);
	for (TTUInt16 i=0; i<v.size(); i++) {
		name = v[i];
		nameSize = strlen(name.c_str());
		nameCString = new char[nameSize+1];
		strncpy_zero(nameCString, name.c_str(), nameSize+1);

		nameMaxSymbol = gensym(nameCString);			
		hashtab_store(wrappedMaxClass->maxNamesToTTNames, nameMaxSymbol, (t_object*)name.rawpointer());
		class_addmethod(wrappedMaxClass->maxClass, (method)wrappedClass_anything, nameCString, A_GIMME, 0);

		delete nameCString;
		nameCString = NULL;
	}
	
	o->getAttributeNames(v);
	for (TTUInt16 i=0; i<v.size(); i++) {
		TTAttributePtr	attr = NULL;
		t_symbol*		maxType = _sym_long;
		
		name = v[i];
		nameSize = strlen(name.c_str());
		nameCString = new char[nameSize+1];
		strncpy_zero(nameCString, name.c_str(), nameSize+1);
		nameMaxSymbol = gensym(nameCString);
				
		if (name == TT("MaxNumChannels"))
			continue;						// don't expose these attributes to Max users
		if (name == TT("Bypass")) {
			if (wrappedMaxClass->options && !wrappedMaxClass->options->lookup(TT("generator"), v))
				continue;					// generators don't have inputs, and so don't really provide a bypass
		}
		
		o->findAttribute(name, &attr);
		
		if (attr->type == kTypeFloat32)
			maxType = _sym_float32;
		else if (attr->type == kTypeFloat64)
			maxType = _sym_float64;
		else if (attr->type == kTypeSymbol || attr->type == kTypeString)
			maxType = _sym_symbol;
		
		hashtab_store(wrappedMaxClass->maxNamesToTTNames, nameMaxSymbol, (t_object*)name.rawpointer());
		class_addattr(wrappedMaxClass->maxClass, attr_offset_new(nameCString, maxType, 0, (method)wrappedClass_attrGet, (method)wrappedClass_attrSet, 0));
		
		// Add display styles for the Max 5 inspector
		if (attr->type == kTypeBoolean)
			CLASS_ATTR_STYLE(wrappedMaxClass->maxClass, (char*)name.c_str(), 0, "onoff");
		if (name == TT("fontFace"))
			CLASS_ATTR_STYLE(wrappedMaxClass->maxClass,	"fontFace", 0, "font");

		delete nameCString;
		nameCString = NULL;
	}
	
	TTObjectBaseRelease(&o);
	
	class_addmethod(wrappedMaxClass->maxClass, (method)MaxGraphReset,		"graph.reset",		A_CANT, 0);
	class_addmethod(wrappedMaxClass->maxClass, (method)MaxGraphSetup,		"graph.setup",		A_CANT, 0);
	class_addmethod(wrappedMaxClass->maxClass, (method)MaxGraphConnect,		"graph.connect",	A_OBJ, A_LONG, 0);
    class_addmethod(wrappedMaxClass->maxClass, (method)object_obex_dumpout, "dumpout",			A_CANT, 0); 
	class_addmethod(wrappedMaxClass->maxClass, (method)wrappedClass_assist, "assist",			A_CANT, 0L);
	class_addmethod(wrappedMaxClass->maxClass, (method)stdinletinfo,		"inletinfo",		A_CANT, 0);
	
	class_register(_sym_box, wrappedMaxClass->maxClass);
	if (c)
		*c = wrappedMaxClass;
	
	hashtab_store(wrappedMaxClasses, wrappedMaxClass->maxClassName, (t_object*)wrappedMaxClass);
	return kTTErrNone;
}
TTErr wrapTTModularClassAsMaxClass(TTSymbol& ttblueClassName, const char* maxClassName, WrappedClassPtr* c, ModularSpec* specificities)
{
	TTObject        o;
	TTValue			v, args;
	WrappedClass*	wrappedMaxClass = NULL;
	TTSymbol		TTName;
	t_symbol		*MaxName = NULL;
    TTUInt16        i;
	
	jamoma_init();
	common_symbols_init();
	
	if (!wrappedMaxClasses)
		wrappedMaxClasses = hashtab_new(0);
	
	wrappedMaxClass = new WrappedClass;
	wrappedMaxClass->maxClassName = gensym(maxClassName);
	wrappedMaxClass->maxClass = class_new(	maxClassName,
										  (method)wrappedModularClass_new,
										  (method)wrappedModularClass_free,
										  sizeof(WrappedModularInstance),
										  (method)0L,
										  A_GIMME,
										  0);
	wrappedMaxClass->ttblueClassName = ttblueClassName;
	wrappedMaxClass->validityCheck = NULL;
	wrappedMaxClass->validityCheckArgument = NULL;
	wrappedMaxClass->options = NULL;
	wrappedMaxClass->maxNamesToTTNames = hashtab_new(0);
	
	wrappedMaxClass->specificities = specificities;
    
#ifdef AUDIO_EXTERNAL
    // Setup our class to work with MSP
	class_dspinit(wrappedMaxClass->maxClass);
#endif
	
	// Create a temporary instance of the class so that we can query it.
	o = TTObject(ttblueClassName);
	
	// Register Messages as Max method
	o.messages(v);
	for (i = 0; i < v.size(); i++)
	{
		TTName = v[i];

        if (TTName == TTSymbol("test")                      ||
            TTName == TTSymbol("getProcessingBenchmark")    ||
            TTName == TTSymbol("resetBenchmarking"))
			continue;
        else if ((MaxName = jamoma_TTName_To_MaxName(TTName))) 
		{
            hashtab_store(wrappedMaxClass->maxNamesToTTNames, MaxName, (t_object*)(TTName.rawpointer()));
            class_addmethod(wrappedMaxClass->maxClass, (method)wrappedModularClass_anything, MaxName->s_name, A_GIMME, 0);
        }
	}
	
	// Register Attributes as Max attr
	o.attributes(v);
	for (i = 0; i < v.size(); i++) {
		TTAttributePtr	attr = NULL;
		t_symbol		*maxType = _sym_atom;
		
		TTName = v[i];
        
#ifdef AUDIO_EXTERNAL
        // the enable word is already used by a message declared in the dsp_init method
        if (TTName == TTSymbol("enable"))
            continue;
#endif
        
        // we want to hide service attribute for Max external
        if (TTName == TTSymbol("service"))
            continue;
		
		if ((MaxName = jamoma_TTName_To_MaxName(TTName))) {
            
            if (TTName == kTTSym_bypass && wrappedMaxClass->maxClassName != gensym("j.in") && wrappedMaxClass->maxClassName != gensym("j.in~"))
                continue;
            
			o.instance()->findAttribute(TTName, &attr);
			
			if (attr->type == kTypeFloat32)
				maxType = _sym_float32;
			else if (attr->type == kTypeFloat64)
				maxType = _sym_float64;
			else if (attr->type == kTypeSymbol || attr->type == kTypeString)
				maxType = _sym_symbol;
			else if (attr->type == kTypeLocalValue)
				maxType = _sym_atom;
			
			hashtab_store(wrappedMaxClass->maxNamesToTTNames, MaxName, (t_object*)(TTName.rawpointer()));
			class_addattr(wrappedMaxClass->maxClass, attr_offset_new(MaxName->s_name, maxType, 0, (method)wrappedModularClass_attrGet, (method)wrappedModularClass_attrSet, 0));
			
			// Add display styles for the Max 5 inspector
			if (attr->type == kTypeBoolean)
				CLASS_ATTR_STYLE(wrappedMaxClass->maxClass, (char*)TTName.c_str(), 0, "onoff");
			if (TTName == TTSymbol("fontFace"))
				CLASS_ATTR_STYLE(wrappedMaxClass->maxClass,	"fontFace", 0, "font");
		}
	}
	
	// standalone support:
	class_addmethod(wrappedMaxClass->maxClass, (method)jamoma_fileusage, "fileusage", A_CANT, 0);

	class_addmethod(wrappedMaxClass->maxClass, (method)stdinletinfo,							"inletinfo",			A_CANT, 0);
	class_addmethod(wrappedMaxClass->maxClass, (method)wrappedModularClass_notify,				"notify",				A_CANT, 0);
	class_addmethod(wrappedMaxClass->maxClass, (method)wrappedModularClass_shareContextNode,	"share_context_node",	A_CANT,	0);
	class_addmethod(wrappedMaxClass->maxClass, (method)wrappedModularClass_anything,			"anything",				A_GIMME, 0);
	
	// Register specific methods and do specific things
	if (specificities) {
		if (specificities->_wrap)
			specificities->_wrap(wrappedMaxClass);
	}
	
	class_addmethod(wrappedMaxClass->maxClass, (method)wrappedModularClass_dump,				"dump",					A_GIMME, 0);

#ifdef ARRAY_EXTERNAL
	
	class_addmethod(wrappedMaxClass->maxClass, (method)wrappedModularClass_ArraySelect,				"array/select",			A_GIMME,0);
    class_addmethod(wrappedMaxClass->maxClass, (method)wrappedModularClass_ArrayResize,				"array/resize",			A_LONG,0);
	
	CLASS_ATTR_SYM(wrappedMaxClass->maxClass,			"format",	0,		WrappedModularInstance,	arrayAttrFormat);
	CLASS_ATTR_ACCESSORS(wrappedMaxClass->maxClass,		"format",			wrappedModularClass_FormatGet,	wrappedModularClass_FormatSet);
	CLASS_ATTR_ENUM(wrappedMaxClass->maxClass,			"format",	0,		"single array");
#endif
	
	class_register(_sym_box, wrappedMaxClass->maxClass);
	if (c)
		*c = wrappedMaxClass;
	
	hashtab_store(wrappedMaxClasses, wrappedMaxClass->maxClassName, (t_object*)(wrappedMaxClass));
	return kTTErrNone;
}
Beispiel #18
0
int main(void){
	t_class *c;
	t_object *attr;
	long attrflags = 0;

	c = class_new("legion", (method)legion_new, (method)legion_free, (short)sizeof(t_legion), (method)0L, A_GIMME, 0); 
	class_obexoffset_set(c, calcoffset(t_legion, obex));
	common_symbols_init();
	
	version(0);

	class_addmethod(c, (method) version, "version", 0);
	class_addmethod(c, (method)legion_assist, "assist", A_CANT, 0);
	class_addmethod(c, (method)legion_tellmeeverything, "tellmeeverything", 0L, 0);
	class_addmethod(c, (method)legion_list, "list", A_GIMME, 0);
	
	class_addmethod(c, (method)object_obex_dumpout, "dumpout", A_CANT, 0);
	class_addmethod(c, (method)object_obex_quickref, "quickref", A_CANT, 0);

	attr = attr_offset_new("numColumns", _sym_long, attrflags, (method)0L, (method)0L, calcoffset(t_legion, t_numColumns));
	class_addattr(c, attr);
	attr = attr_offset_new("numRows", _sym_long, attrflags, (method)0L, (method)0L, calcoffset(t_legion, t_numRows));
	class_addattr(c, attr);
	attr = attr_offset_new("vectorLength", _sym_long, attrflags, (method)0L, (method)0L, calcoffset(t_legion, t_vectorLength));
	class_addattr(c, attr);
	attr = attr_offset_new("kappa", _sym_float64, attrflags, (method)0L, (method)0L, calcoffset(t_legion, t_kappa));
	class_addattr(c, attr);
	attr = attr_offset_new("lambda", _sym_float64, attrflags, (method)0L, (method)0L, calcoffset(t_legion, t_lambda));
	class_addattr(c, attr);
	attr = attr_offset_new("temperature", _sym_float64, attrflags, (method)0L, (method)0L, calcoffset(t_legion, t_temperature));
	class_addattr(c, attr);
	attr = attr_offset_new("learningRate", _sym_float64, attrflags, (method)0L, (method)0L, calcoffset(t_legion, t_learningRate));
	class_addattr(c, attr);
	attr = attr_offset_new("entrainmentRate", _sym_float64, attrflags, (method)0L, (method)0L, calcoffset(t_legion, t_entrainmentRate));
	class_addattr(c, attr);
	attr = attr_offset_new("radius", _sym_float64, attrflags, (method)0L, (method)0L, calcoffset(t_legion, t_radius));
	class_addattr(c, attr);
	attr = attr_offset_new("nfParam", _sym_float64, attrflags, (method)0L, (method)0L, calcoffset(t_legion, t_nfParam));
	class_addattr(c, attr);
	attr = attr_offset_new("learn", _sym_long, attrflags, (method)0L, (method)0L, calcoffset(t_legion, t_learn));
	class_addattr(c, attr);
	attr = attr_offset_new("neighborhoodFunction", _sym_symbol,attrflags, (method)0L, (method)legion_setneighborhoodFunction, calcoffset(t_legion, t_nfName));
	class_addattr(c, attr);
	attr = attr_offset_new("randMin", _sym_float64, attrflags, (method)0L, (method)0L, calcoffset(t_legion, t_randMin));
	class_addattr(c, attr);
	attr = attr_offset_new("randMax", _sym_float64, attrflags, (method)0L, (method)0L, calcoffset(t_legion, t_randMax));
	class_addattr(c, attr);
	class_register(CLASS_BOX, c);
	legion_class = c;
	return 0;
}