diff options
Diffstat (limited to 'externals/grill/flext/source')
-rw-r--r-- | externals/grill/flext/source/flclass.h | 15 | ||||
-rw-r--r-- | externals/grill/flext/source/fldsp.cpp | 25 | ||||
-rw-r--r-- | externals/grill/flext/source/fldsp.h | 23 | ||||
-rw-r--r-- | externals/grill/flext/source/flext.cpp | 22 | ||||
-rwxr-xr-x | externals/grill/flext/source/flmsg.cpp | 18 | ||||
-rwxr-xr-x | externals/grill/flext/source/flprefix.h | 9 | ||||
-rwxr-xr-x | externals/grill/flext/source/flproxy.cpp | 14 | ||||
-rwxr-xr-x | externals/grill/flext/source/flqueue.cpp | 2 | ||||
-rw-r--r-- | externals/grill/flext/source/flsupport.h | 5 | ||||
-rw-r--r-- | externals/grill/flext/source/flthr.cpp | 5 |
10 files changed, 76 insertions, 62 deletions
diff --git a/externals/grill/flext/source/flclass.h b/externals/grill/flext/source/flclass.h index b32f49fa..4fcf64a9 100644 --- a/externals/grill/flext/source/flclass.h +++ b/externals/grill/flext/source/flclass.h @@ -86,23 +86,22 @@ public: @{ */ - //! called on "help" message: should post some text - virtual void m_help(); - //! called on patcher load (not on mere object creation!) + virtual void CbLoadbang(); virtual void m_loadbang(); //! called on (double-)click into object box - virtual void m_click(); + virtual void CbClick(); /*! \brief Called for every incoming message. All method handling is done in there \return True if a handler was found and called */ - virtual bool m_methodmain(int inlet,const t_symbol *s,int argc,const t_atom *argv); + virtual bool CbMethodHandler(int inlet,const t_symbol *s,int argc,const t_atom *argv); - /*! \brief Called for every unhandled message (by m_methodmain) + /*! \brief Called for every unhandled message (by CbMethodHandler) */ + virtual bool CbMethodResort(int inlet,const t_symbol *s,int argc,const t_atom *argv); virtual bool m_method_(int inlet,const t_symbol *s,int argc,const t_atom *argv); //! @} FLEXT_C_VIRTUAL @@ -501,10 +500,6 @@ public: //! Terminate all threads of this object bool StopThreads(); - - //! Check if current thread should terminate - bool ShouldExit() const; - #endif // FLEXT_THREADS //! @} FLEXT_C_THREAD diff --git a/externals/grill/flext/source/fldsp.cpp b/externals/grill/flext/source/fldsp.cpp index 0cf5eb37..85d7f2f8 100644 --- a/externals/grill/flext/source/fldsp.cpp +++ b/externals/grill/flext/source/fldsp.cpp @@ -90,7 +90,7 @@ t_int *flext_dsp::dspmeth(t_int *w) #endif { obj->indsp = true; - obj->m_signal(obj->blksz,obj->invecs,obj->outvecs); + obj->CbSignal(); obj->indsp = false; } return w+2; @@ -156,16 +156,16 @@ void flext_dsp::cb_dsp(t_class *c,t_signal **sp) #endif // with the following call derived classes can do their eventual DSP setup - obj->m_dsp(obj->blksz,obj->invecs,obj->outvecs); - - // set the DSP function + if(obj->CbDsp()) { + // set the DSP function #if FLEXT_SYS == FLEXT_SYS_JMAX - fts_atom_t args; - fts_set_pointer(args,obj); - fts_dsp_add_function(dspsym,1,args); + fts_atom_t args; + fts_set_pointer(args,obj); + fts_dsp_add_function(dspsym,1,args); #else - dsp_add((t_dspmethod)dspmeth,1,obj); + dsp_add((t_dspmethod)dspmeth,1,obj); #endif + } } /* @@ -184,11 +184,20 @@ void flext_dsp::cb_dsp_delete(fts_object_t *c, int winlet, fts_symbol_t *s, int void flext_dsp::m_dsp(int /*n*/,t_signalvec const * /*insigs*/,t_signalvec const * /*outsigs*/) {} +bool flext_dsp::CbDsp() +{ + m_dsp(Blocksize(),invecs,outvecs); + return true; +} + void flext_dsp::m_signal(int n,t_sample *const * /*insigs*/,t_sample *const *outs) { for(int i = 0; i < CntOutSig(); ++i) ZeroSamples(outs[i],n); } +void flext_dsp::CbSignal() { m_signal(Blocksize(),invecs,outvecs); } + + #if FLEXT_SYS == FLEXT_SYS_PD void flext_dsp::cb_enable(t_class *c,t_float on) { thisObject(c)->dspon = on != 0; } #elif FLEXT_SYS == FLEXT_SYS_JMAX diff --git a/externals/grill/flext/source/fldsp.h b/externals/grill/flext/source/fldsp.h index a9452aa6..1ba21ef1 100644 --- a/externals/grill/flext/source/fldsp.h +++ b/externals/grill/flext/source/fldsp.h @@ -51,6 +51,12 @@ public: //! returns current block (aka vector) size int Blocksize() const { return blksz; } + //! returns array of input vectors (CntInSig() vectors) + t_sample *const *InSig() const { return invecs; } + + //! returns array of output vectors (CntOutSig() vectors) + t_sample *const *OutSig() const { return outvecs; } + //! typedef describing a signal vector #if FLEXT_SYS == FLEXT_SYS_JMAX typedef fts_symbol_t t_signalvec; @@ -68,15 +74,28 @@ public: */ /*! \brief Called on every dsp init. \note Don't expect any valid data in the signal vectors! + flext_dsp::CbDsp should not be called by the derived class + + \return true (default)... use DSP, false, don't use DSP + */ + virtual bool CbDsp(); + + /*! \brief Called with every signal vector - here you do the dsp calculation + flext_dsp::CbSignal fills all output vectors with silence + */ + virtual void CbSignal(); + + /*! \brief Deprecated method for CbSignal + \deprecated \param n: frames (aka samples) in one signal vector \param insigs: array of input vectors (get number with function CntInSig()) \param outsigs: array of output vectors (get number with function CntOutSig()) */ virtual void m_dsp(int n,t_signalvec const *insigs,t_signalvec const *outsigs); - /*! \brief Called with every signal vector - here you do the dsp calculation - + /*! \brief Deprecated method for CbSignal + \deprecated \param n: frames (aka samples) in one signal vector \param insigs: array of input vectors (get number with function CntInSig()) \param outsigs: array of output vectors (get number with function CntOutSig()) diff --git a/externals/grill/flext/source/flext.cpp b/externals/grill/flext/source/flext.cpp index 6509697e..531109f8 100644 --- a/externals/grill/flext/source/flext.cpp +++ b/externals/grill/flext/source/flext.cpp @@ -145,14 +145,12 @@ void flext_base::Setup(t_classid id) t_class *c = getClass(id); #if FLEXT_SYS == FLEXT_SYS_PD || FLEXT_SYS == FLEXT_SYS_MAX - add_method(c,cb_help,"help"); add_loadbang(c,cb_loadbang); #if FLEXT_SYS == FLEXT_SYS_MAX add_assist(c,cb_assist); add_dblclick(c,cb_click); #endif #else - fts_class_message_varargs(c,MakeSymbol("help"),cb_help); #pragma message ("no implementation of loadbang or assist") #endif @@ -174,28 +172,20 @@ void flext_base::Setup(t_classid id) StartQueue(); } -#if FLEXT_SYS == FLEXT_SYS_JMAX -void flext_base::cb_help(fts_object_t *c,int, fts_symbol_t, int, const fts_atom_t *) { thisObject(c)->m_help(); } -#else -void flext_base::cb_help(t_class *c) { thisObject(c)->m_help(); } -void flext_base::cb_loadbang(t_class *c) { thisObject(c)->m_loadbang(); } +#if FLEXT_SYS != FLEXT_SYS_JMAX +void flext_base::cb_loadbang(t_class *c) { thisObject(c)->CbLoadbang(); } #endif -void flext_base::m_help() -{ - // This should better be overloaded - post("%s (using flext " FLEXT_VERSTR ") - compiled on %s %s",thisName(),__DATE__,__TIME__); -} - void flext_base::m_loadbang() {} +void flext_base::CbLoadbang() { return m_loadbang(); } -void flext_base::m_click() {} +void flext_base::CbClick() {} #if FLEXT_SYS == FLEXT_SYS_PD int flext_base::cb_click(t_gobj *c, struct _glist *glist,int xpix, int ypix, int shift, int alt, int dbl, int doit) { if(doit && alt) { - thisObject(c)->m_click(); + thisObject(c)->CbClick(); return 1; } else @@ -206,7 +196,7 @@ int flext_base::cb_click(t_gobj *c, struct _glist *glist,int xpix, int ypix, int #if FLEXT_SYS == FLEXT_SYS_MAX void flext_base::cb_click(t_class *c, Point pt, short mods) { - thisObject(c)->m_click(); + thisObject(c)->CbClick(); } void flext_base::cb_assist(t_class *c,void * /*b*/,long msg,long arg,char *s) diff --git a/externals/grill/flext/source/flmsg.cpp b/externals/grill/flext/source/flmsg.cpp index 917cc66c..5a8ef0b1 100755 --- a/externals/grill/flext/source/flmsg.cpp +++ b/externals/grill/flext/source/flmsg.cpp @@ -160,7 +160,7 @@ bool flext_base::FindMeth(int inlet,const t_symbol *s,int argc,const t_atom *arg /*! \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,const t_atom *argv) +bool flext_base::CbMethodHandler(int inlet,const t_symbol *s,int argc,const t_atom *argv) { static bool trap = false; @@ -179,7 +179,7 @@ bool flext_base::m_methodmain(int inlet,const t_symbol *s,int argc,const t_atom t_atom fl; SetInt(fl,GetAInt(argv[0])); trap = true; - ret = m_methodmain(inlet,sym_int,1,&fl); + ret = CbMethodHandler(inlet,sym_int,1,&fl); trap = false; } if(ret) goto end; @@ -189,7 +189,7 @@ bool flext_base::m_methodmain(int inlet,const t_symbol *s,int argc,const t_atom t_atom fl; SetFloat(fl,GetAFloat(argv[0])); trap = true; - ret = m_methodmain(inlet,sym_float,1,&fl); + ret = CbMethodHandler(inlet,sym_float,1,&fl); trap = false; } if(ret) goto end; @@ -210,7 +210,7 @@ bool flext_base::m_methodmain(int inlet,const t_symbol *s,int argc,const t_atom #endif trap = true; - ret = m_methodmain(inlet,sym_list,1,&list); + ret = CbMethodHandler(inlet,sym_list,1,&list); trap = false; } if(ret) goto end; @@ -220,7 +220,7 @@ bool flext_base::m_methodmain(int inlet,const t_symbol *s,int argc,const t_atom t_atom list; SetSymbol(list,s); trap = true; - ret = m_methodmain(inlet,sym_list,1,&list); + ret = CbMethodHandler(inlet,sym_list,1,&list); trap = false; } if(ret) goto end; @@ -239,7 +239,7 @@ bool flext_base::m_methodmain(int inlet,const t_symbol *s,int argc,const t_atom #endif if(sym) { trap = true; - m_methodmain(i,sym,1,argv+i); + CbMethodHandler(i,sym,1,argv+i); trap = false; } } @@ -247,7 +247,7 @@ bool flext_base::m_methodmain(int inlet,const t_symbol *s,int argc,const t_atom ret = true; } - if(!ret && !trap) ret = m_method_(inlet,s,argc,argv); + if(!ret && !trap) ret = CbMethodResort(inlet,s,argc,argv); } catch(std::exception &x) { error("%s - Exception while processing method: %s",thisName(),x.what()); @@ -273,3 +273,7 @@ bool flext_base::m_method_(int inlet,const t_symbol *s,int argc,const t_atom *ar return false; } +bool flext_base::CbMethodResort(int inlet,const t_symbol *s,int argc,const t_atom *argv) +{ + return m_method_(inlet,s,argc,argv); +} diff --git a/externals/grill/flext/source/flprefix.h b/externals/grill/flext/source/flprefix.h index faaa67b9..d7921d94 100755 --- a/externals/grill/flext/source/flprefix.h +++ b/externals/grill/flext/source/flprefix.h @@ -221,7 +221,7 @@ WARRANTIES, see the file, "license.txt," in this distribution. // and Intel (as suggested by Tim Blechmann) #ifndef FLEXT_CPU - #if defined(_X86_64_) // not sure about this one + #if defined(__x86_64__) // not sure about this one #define FLEXT_CPU FLEXT_CPU_X86_64 #elif defined(_X86_) || defined(__i386__) || defined(__i586__) || defined(__i686__) #define FLEXT_CPU FLEXT_CPU_IA32 @@ -339,15 +339,10 @@ WARRANTIES, see the file, "license.txt," in this distribution. #endif // ----- set threading model ----- -// shared builds are always threaded (although this not be so....) +// shared builds are always threaded #ifdef FLEXT_SHARED #undef FLEXT_THREADS #define FLEXT_THREADS -/* - // and also enabled for virtual daughter-classes?? - #undef FLEXT_VIRT - #define FLEXT_VIRT -*/ #endif #ifdef FLEXT_THREADS diff --git a/externals/grill/flext/source/flproxy.cpp b/externals/grill/flext/source/flproxy.cpp index ca72faf3..d650e42e 100755 --- a/externals/grill/flext/source/flproxy.cpp +++ b/externals/grill/flext/source/flproxy.cpp @@ -24,18 +24,18 @@ t_class *flext_base::px_class = NULL; void flext_base::px_object::px_method(px_object *obj,const t_symbol *s,int argc,t_atom *argv) { - obj->base->m_methodmain(obj->index,s,argc,argv); + obj->base->CbMethodHandler(obj->index,s,argc,argv); } void flext_base::cb_px_anything(t_class *c,const t_symbol *s,int argc,t_atom *argv) { - thisObject(c)->m_methodmain(0,s,argc,argv); + thisObject(c)->CbMethodHandler(0,s,argc,argv); } #define DEF_IN_FT(IX) \ void flext_base::cb_px_ft ## IX(t_class *c,float v) { \ t_atom atom; SETFLOAT(&atom,v); \ - thisObject(c)->m_methodmain(IX,sym_float,1,&atom); \ + thisObject(c)->CbMethodHandler(IX,sym_float,1,&atom); \ } #define ADD_IN_FT(IX) \ @@ -49,7 +49,7 @@ void flext_base::cb_px_anything(t_class *c,const t_symbol *s,short argc,t_atom * flext_base *o = thisObject(c); int ci = ((flext_hdr *)o->x_obj)->curinlet; - o->m_methodmain(ci,s,argc,argv); + o->CbMethodHandler(ci,s,argc,argv); } #if 0 //FLEXT_OS == FLEXT_OS_WIN @@ -62,7 +62,7 @@ void flext_base::cb_px_int(t_class *c,long v) // check if inlet allows int type t_atom atom; SetInt(atom,v); - o->m_methodmain(ci,sym_int,1,&atom); + o->CbMethodHandler(ci,sym_int,1,&atom); } void flext_base::cb_px_float(t_class *c,double v) @@ -72,7 +72,7 @@ void flext_base::cb_px_float(t_class *c,double v) // check if inlet allows float type t_atom atom; SetFloat(atom,v); - o->m_methodmain(ci,sym_float,1,&atom); + o->CbMethodHandler(ci,sym_float,1,&atom); } #else void flext_base::cb_px_int(t_class *c,long v) @@ -161,7 +161,7 @@ void flext_base::SetProxies(t_class *c) void flext_base::jmax_proxy(fts_object_t *c, int winlet, fts_symbol_t s, int argc, const fts_atom_t *argv) { flext_base *o = thisObject(c); - o->m_methodmain(winlet,s,argc,argv); + o->CbMethodHandler(winlet,s,argc,argv); } void flext_base::SetProxies(t_class *c) diff --git a/externals/grill/flext/source/flqueue.cpp b/externals/grill/flext/source/flqueue.cpp index a580bb53..ddfd0303 100755 --- a/externals/grill/flext/source/flqueue.cpp +++ b/externals/grill/flext/source/flqueue.cpp @@ -47,7 +47,7 @@ public: { if(out < 0) // message to self - th->m_methodmain(-1-out,msg.Header(),msg.Count(),msg.Atoms()); + th->CbMethodHandler(-1-out,msg.Header(),msg.Count(),msg.Atoms()); else // message to outlet th->ToSysAnything(out,msg.Header(),msg.Count(),msg.Atoms()); diff --git a/externals/grill/flext/source/flsupport.h b/externals/grill/flext/source/flsupport.h index c3141a16..b2a157c6 100644 --- a/externals/grill/flext/source/flsupport.h +++ b/externals/grill/flext/source/flsupport.h @@ -741,7 +741,10 @@ public: /*! \brief Get system thread id */ static thrid_t GetSysThreadId(); - + + //! Check if current thread should terminate + static bool ShouldExit(); + //! Check if current thread is the realtime system's thread static bool IsThread(thrid_t t,thrid_t ref = GetThreadId()) { #if FLEXT_THREADS == FLEXT_THR_POSIX diff --git a/externals/grill/flext/source/flthr.cpp b/externals/grill/flext/source/flthr.cpp index 47c64354..56a9c9a2 100644 --- a/externals/grill/flext/source/flthr.cpp +++ b/externals/grill/flext/source/flthr.cpp @@ -320,10 +320,9 @@ bool flext::StopThread(void (*meth)(thr_params *p),thr_params *p,bool wait) return qufnd.Size() == 0; } -bool flext_base::ShouldExit() const +bool flext::ShouldExit() { - thr_entry *fnd = thrstopped.Find(GetThreadId()); - return fnd != NULL; + return thrstopped.Find(GetThreadId()) != NULL; } bool flext::PushThread() |