From 5a33517fef170ceb104b35aa690fdadcb0cf292b Mon Sep 17 00:00:00 2001 From: Thomas Grill Date: Tue, 10 Jun 2003 02:33:37 +0000 Subject: "" svn path=/trunk/; revision=687 --- externals/grill/flext/source/flbind.cpp | 27 ++++++++++++++++++++++++++- externals/grill/flext/source/flbuf.cpp | 2 +- externals/grill/flext/source/flclass.h | 5 +++++ externals/grill/flext/source/fldoxygen.h | 8 +++++--- externals/grill/flext/source/flext.cpp | 2 +- externals/grill/flext/source/flsimd.cpp | 8 +------- externals/grill/flext/source/flsupport.h | 2 +- 7 files changed, 40 insertions(+), 14 deletions(-) (limited to 'externals/grill/flext/source') diff --git a/externals/grill/flext/source/flbind.cpp b/externals/grill/flext/source/flbind.cpp index a0af2ce0..4422eac6 100644 --- a/externals/grill/flext/source/flbind.cpp +++ b/externals/grill/flext/source/flbind.cpp @@ -99,6 +99,11 @@ bool flext_base::BindMethod(const t_symbol *sym,bool (*fun)(flext_base *,t_symbo post("%s - Symbol already bound",thisName()); return false; } + + if(bindhead->Count() > 20) { + // Hash it! + bindhead->Finalize(); + } } SetupBindProxy(); @@ -152,7 +157,7 @@ bool flext_base::UnbindMethod(const t_symbol *sym,bool (*fun)(flext_base *,t_sym if(!sz) sz = 1; for(int i = 0; i < sz; ++i) { - for(it = (binditem *)bindhead->Item(0); it; it = (binditem *)it->nxt) { + for(it = (binditem *)bindhead->Item(i); it; it = (binditem *)it->nxt) { if(it->tag == sym && (!fun || it->fun == fun)) break; } if(it) break; @@ -167,6 +172,26 @@ bool flext_base::UnbindMethod(const t_symbol *sym,bool (*fun)(flext_base *,t_sym return ok; } +bool flext_base::UnbindAll() +{ +// bool memleak = false; + + int sz = bindhead->Size(); + if(!sz) sz = 1; + + for(int i = 0; i < sz; ++i) { + for(binditem *it = (binditem *)bindhead->Item(i); it; it = (binditem *)it->nxt) { +// if(it->px->data) memleak = true; + if(bindhead->Remove(it)) delete it; + } + } +/* + if(memleak) + post("%s - Memory was not deallocated while unbinding methods",thisName()); +*/ + return true; +} + void flext_base::pxbnd_object::px_method(pxbnd_object *c,const t_symbol *s,int argc,t_atom *argv) { c->item->fun(c->base,(t_symbol *)s,argc,(t_atom *)argv,c->data); diff --git a/externals/grill/flext/source/flbuf.cpp b/externals/grill/flext/source/flbuf.cpp index 1e7b6ccf..c9d37983 100644 --- a/externals/grill/flext/source/flbuf.cpp +++ b/externals/grill/flext/source/flbuf.cpp @@ -54,7 +54,7 @@ int flext::buffer::Set(const t_symbol *s,bool nameonly) bool valid = data != NULL; // valid now? (before change) if(s && sym != s) { - ret = -1; + ret = 1; data = NULL; frames = 0; chns = 0; diff --git a/externals/grill/flext/source/flclass.h b/externals/grill/flext/source/flclass.h index e1b46c52..3add0f13 100644 --- a/externals/grill/flext/source/flclass.h +++ b/externals/grill/flext/source/flclass.h @@ -437,6 +437,11 @@ public: //! \brief Unbind a method from a symbol (as string) bool UnbindMethod(const char *sym,bool (*meth)(flext_base *obj,t_symbol *sym,int argc,t_atom *argv,void *data) = NULL,void **data = NULL) { return UnbindMethod(MakeSymbol(sym),meth,data); } + /*! Unbind all symbol bindings + \note Memory associated to data pointers passed by BindMethod will not be freed! + */ + bool UnbindAll(); + //! @} FLEXT_C_BIND // --- thread stuff ----------------------------------------------- diff --git a/externals/grill/flext/source/fldoxygen.h b/externals/grill/flext/source/fldoxygen.h index 1bfef48e..202176ea 100644 --- a/externals/grill/flext/source/fldoxygen.h +++ b/externals/grill/flext/source/fldoxygen.h @@ -16,7 +16,7 @@ Currently there exist two widely used modular systems for real-time audio that c extended by self-written objects (so called "externals"):
Max/MSP (http://www.cycling74.com) and Pure Data (http://www.pure-data.org). -Both come with APIs that are not very different (as they share their origins), but as well not quite the same. +Both come with APIs that are not very different (as they share their origin), but as well not quite the same. Flext seeks to provide a unifying interface for the APIs of those real-time systems while also concentrating on making use of the advantages of the object orientation of the C++ language. @@ -35,12 +35,13 @@ The advantages of flext are:
  • Libraries of externals in Max/MSP
  • More than 3 typed creation arguments possible for Max/MSP
  • Any input to any object's inlet (with the exception of signal streams) +
  • Control of the object state by use of Max/Jitter-like "attributes" Naturally there are some cons, too: Currently, flext supports @@ -71,7 +72,8 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. In the official flext distribution, the GNU General Public License is -in the file gpl.txt
    Also see the file license.txt for notes on +in the file gpl.txt
    +Also see the file license.txt for notes on referenced works and their license texts. \section DOWNLOAD Download diff --git a/externals/grill/flext/source/flext.cpp b/externals/grill/flext/source/flext.cpp index 23d02893..2eacb118 100644 --- a/externals/grill/flext/source/flext.cpp +++ b/externals/grill/flext/source/flext.cpp @@ -79,7 +79,7 @@ flext_base::~flext_base() // delete message lists if(methhead) delete methhead; - if(bindhead) delete bindhead; + if(bindhead) delete bindhead; // ATTENTION: the object must free all memory associated to bindings itself if(attrhead) delete attrhead; // destroy inlets and outlets and their proxy objects diff --git a/externals/grill/flext/source/flsimd.cpp b/externals/grill/flext/source/flsimd.cpp index a491bd51..bc8bb9b1 100755 --- a/externals/grill/flext/source/flsimd.cpp +++ b/externals/grill/flext/source/flsimd.cpp @@ -446,16 +446,10 @@ void flext::MulSamples(t_sample *dst,const t_sample *src,t_sample mul,int cnt) while(cnt--) *(dst++) = *(src++)*mul; } else -/* #elif FLEXT_OS == FLEXT_OS_MAC && defined(__VEC__) && defined(__VECTOROPS__) { - int n = cnt>>2,n4 = n<<2; - cnt -= n4; - vScopy(n4,src,dst); - src += n4,dst += n4; - while(cnt--) *(dst++) = *(src++); + vsmul(src,1,&mul,dst,1,cnt); } -*/ #endif // _MSC_VER #endif // FLEXT_USE_SIMD { diff --git a/externals/grill/flext/source/flsupport.h b/externals/grill/flext/source/flsupport.h index 8c04c3ce..6a756590 100644 --- a/externals/grill/flext/source/flsupport.h +++ b/externals/grill/flext/source/flsupport.h @@ -661,7 +661,7 @@ protected: static bool StopHelper(); static void ThrHelper(void *); - //! system's thread id + //! the system's thread id static thrid_t thrid; // the system thread public: -- cgit v1.2.1