From a55a5773570e56a1fb59887f1215f3d05a055700 Mon Sep 17 00:00:00 2001 From: Thomas Grill Date: Mon, 25 Nov 2002 22:27:34 +0000 Subject: "" svn path=/trunk/; revision=243 --- externals/grill/flext/source/flext.cpp | 55 +++++++++++++++++++++++++++++----- 1 file changed, 47 insertions(+), 8 deletions(-) (limited to 'externals/grill/flext/source/flext.cpp') diff --git a/externals/grill/flext/source/flext.cpp b/externals/grill/flext/source/flext.cpp index 5ed852c3..82ccdaba 100644 --- a/externals/grill/flext/source/flext.cpp +++ b/externals/grill/flext/source/flext.cpp @@ -70,7 +70,7 @@ void flext_base::cb_px_int(t_class *c,int v) { // check if inlet allows int type t_atom atom; - SETINT(&atom,v); + SetInt(atom,v); cb_px_anything(c,sym_int,1,&atom); } @@ -78,7 +78,7 @@ void flext_base::cb_px_float(t_class *c,float v) { // check if inlet allows float type t_atom atom; - SETFLOAT(&atom,v); + SetFloat(atom,v); cb_px_anything(c,sym_float,1,&atom); } @@ -199,15 +199,20 @@ flext_base::~flext_base() if(attrhead) delete attrhead; } - +/*! This virtual function is created after the object has been created, that is, + after the constructor has been processed. It creates the inlets and outlets. + \note You can override it in your own class, but be sure to call it, + \note otherwise no inlets/outlets will be created + \remark Creation of inlets/outlets can't be done upon declaration, as MaxMSP needs creation + \remark in reverse. +*/ bool flext_base::Init() { // if(!flext_obj::Init()) return false; bool ok = true; - - incnt = insigs = 0; +/* if(inlets) { for(int ix = 0; ix < incnt; ++ix) if(inlets[ix]) { @@ -220,6 +225,13 @@ bool flext_base::Init() delete[] inlets; inlets = NULL; } +*/ + + // ---------------------------------- + // create inlets + // ---------------------------------- + + incnt = insigs = 0; if(inlist) { xlet *xi; @@ -363,9 +375,21 @@ bool flext_base::Init() delete[] list; } +/* if(outlets) { delete[] outlets; outlets = NULL; } +*/ + // ---------------------------------- + // create outlets + // ---------------------------------- + outcnt = outsigs = 0; +#ifdef MAXMSP + // for MAXMSP the rightmost outlet has to be created first + if(procattr) + outattr = (outlet *)newout_anything(&x_obj->obj); +#endif + if(outlist) { xlet *xi; @@ -418,13 +442,24 @@ bool flext_base::Init() delete[] list; } - if(procattr) + if(procattr) { +#ifdef PD // attribute dump outlet is the last one outattr = (outlet *)newout_anything(&x_obj->obj); - +#endif + + // initialize creation attributes + if(m_holdaargc && m_holdaargv) + ok = InitAttrib(m_holdaargc,m_holdaargv); + } + + return ok; } +/*! Set up proxy classes and basic methods at class creation time + This ensures that they are processed before the registered flext messages +*/ void flext_base::Setup(t_class *c) { add_method(c,cb_help,"help"); @@ -471,7 +506,9 @@ void flext_base::m_help() post("%s (using flext " FLEXT_VERSTR ") - compiled on %s %s",thisName(),__DATE__,__TIME__); } - +/*! \brief All the message processing + The messages of all the inlets go here and are promoted to the registered callback functions +*/ bool flext_base::m_methodmain(int inlet,const t_symbol *s,int argc,t_atom *argv) { static bool trap = false; @@ -700,6 +737,8 @@ void flext_base::AddMethodDef(int inlet,const char *tag) AddMethItem(new methitem(inlet,tag?MakeSymbol(tag):NULL)); } +/*! \brief Add a method to the queue +*/ void flext_base::AddMethod(int inlet,const char *tag,methfun fun,metharg tp,...) { methitem *mi = new methitem(inlet,MakeSymbol(tag)); -- cgit v1.2.1