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; }
/************************************************************************************/ // Main() Function #ifdef PD void teabox_tilde_setup(void) { teabox_class = class_new(gensym("teabox~"), (t_newmethod)teabox_new, (t_method)teabox_free, sizeof(t_teabox), 0, A_GIMME, 0); CLASS_MAINSIGNALIN(teabox_class, t_teabox, f); class_addmethod(teabox_class, (t_method)teabox_dsp, gensym("dsp"), A_NULL); class_addmethod(teabox_class, (t_method)teabox_getversion, gensym("getversion"), 0); class_addmethod(teabox_class, (t_method)teabox_getstatus, gensym("getstatus"), 0); class_sethelpsymbol(teabox_class, gensym("help-teabox~.pd")); #ifdef UB // For the Pd Mac-Universal-Binary build (from Xcode) we need to setup the classes here // This way they will be available in Pd by just adding teabox~ to the startup libs teabox_bits_tilde_setup(); teabox_count_tilde_setup(); #endif } #else /* Max/MSP */ int main(void) // main recieves a copy of the Max function macros table { t_class *c; c = class_new("teabox~", (method)teabox_new, (method)teabox_free, (short)sizeof(t_teabox), 0L, A_GIMME, 0); common_symbols_init(); class_obexoffset_set(c, calcoffset(t_teabox, obex)); class_addmethod(c, (method)teabox_dsp, "dsp", A_CANT, 0); // Bind method "teabox_dsp" to the DSP call from MSP class_addmethod(c, (method)teabox_assist, "assist", A_CANT,0); // Bind method "teabox_assist" to assistance calls class_addmethod(c, (method)teabox_getversion, "getversion", 0); class_addmethod(c, (method)teabox_getstatus, "getstatus", 0); class_dspinit(c); // Setup object's class to work with MSP class_register(CLASS_BOX, c); teabox_class = c; return 0; }