示例#1
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;
}
示例#2
0
void jcom_core_subscriber_classinit_extended(t_class *c, t_object *attr, bool define_name)
{
	jcom_core_subscriber_classinit_common(c, attr, define_name);

	// TODO: The name of the attributes should be substituted for their jps_* symbol pointers.
	
	// ATTRIBUTE: range <low, high>
	jamoma_class_attr_array_new(c, 	"range/bounds", 		_sym_float32, 2, (method)jcom_core_attr_setrange, (method)jcom_core_attr_getrange);
		
	// ATTRIBUTE: clipmode - options are none, low, high, both, wrap, fold
	jamoma_class_attr_new(c, 		"range/clipmode",	 	_sym_symbol, (method)jcom_core_attr_setclipmode, (method)jcom_core_attr_getclipmode);
	CLASS_ATTR_ENUM(c,				"range/clipmode",		0,	(char*)"none low high both wrap fold");	

	// ATTRIBUTE: repetitions - 0 means repetitive values are not allowed, 1 means they are
	jamoma_class_attr_new(c, 		"repetitions/allow", 	_sym_long, (method)jcom_core_attr_setrepetitions, (method)jcom_core_attr_getrepetitions);

	// ATTRIBUTE: type 
	// this is not defined here because some objects (i.e jcom.parameter) need to treat this in different ways

	// ATTRIBUTE: description - does nothing, but is accessed by jcom.dispatcher for /autodoc generation
	jamoma_class_attr_new(c,		"description", 			_sym_symbol, (method)jcom_core_attr_setdescription, (method)jcom_core_attr_getdescription);
	CLASS_ATTR_STYLE(c,				"description",			0, "text_onesymbol");
}