aboutsummaryrefslogtreecommitdiff
path: root/externals/grill/flext/source/flext.cpp
diff options
context:
space:
mode:
authorThomas Grill <xovo@users.sourceforge.net>2002-11-25 22:27:34 +0000
committerThomas Grill <xovo@users.sourceforge.net>2002-11-25 22:27:34 +0000
commita55a5773570e56a1fb59887f1215f3d05a055700 (patch)
tree507e32ac5b202cb99366bc416d74fff105aa6711 /externals/grill/flext/source/flext.cpp
parent286c5cf7f627308f56b94289a8a05ed653923c07 (diff)
""
svn path=/trunk/; revision=243
Diffstat (limited to 'externals/grill/flext/source/flext.cpp')
-rw-r--r--externals/grill/flext/source/flext.cpp55
1 files changed, 47 insertions, 8 deletions
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));