From b8827f17107c537f192c60eef0d7840ba1d2d3e8 Mon Sep 17 00:00:00 2001 From: Thomas Grill Date: Mon, 12 Sep 2005 10:27:40 +0000 Subject: changed initialization functions accordingly minimal additions for buffers and exception handling change click modifier to shift (seems to work) small fixes for tutorial examples added flfeatures.h for compile-time version-specific feature detection added typed flext::NewAligned fixed severe Altivec bug adapted for pd-devel 0.39 - better handling of click callback slimmed object data structures update DSP methods for SndObj and STK classes - more compatible handling of attributes in patcher (hiding is now an option - define FLEXT_ATTRHIDE) better buffer checking svn path=/trunk/; revision=3537 --- externals/grill/flext/buildsys/mac/max/gnumake-gcc-ext.inc | 1 + externals/grill/flext/changes.txt | 2 ++ externals/grill/flext/flext.vcproj | 8 ++++---- externals/grill/flext/source/flbase.cpp | 1 + externals/grill/flext/source/flbuf.cpp | 5 ++--- externals/grill/flext/source/fldsp.h | 6 ++++++ externals/grill/flext/source/flext.cpp | 2 +- externals/grill/flext/source/flmsg.cpp | 3 +++ externals/grill/flext/source/flsndobj.cpp | 13 +++++++------ externals/grill/flext/source/flsndobj.h | 6 +++--- externals/grill/flext/source/flstk.cpp | 13 +++++++------ externals/grill/flext/source/flstk.h | 4 ++-- externals/grill/flext/source/flsupport.h | 9 ++++++++- 13 files changed, 47 insertions(+), 26 deletions(-) diff --git a/externals/grill/flext/buildsys/mac/max/gnumake-gcc-ext.inc b/externals/grill/flext/buildsys/mac/max/gnumake-gcc-ext.inc index 3808d6bb..cc26b0ae 100644 --- a/externals/grill/flext/buildsys/mac/max/gnumake-gcc-ext.inc +++ b/externals/grill/flext/buildsys/mac/max/gnumake-gcc-ext.inc @@ -16,3 +16,4 @@ TARGETPOST=$(INSTTARGET)/Contents/Pkginfo $(INSTTARGET)/Contents/Pkginfo: echo "iLaX????" >> $@ + diff --git a/externals/grill/flext/changes.txt b/externals/grill/flext/changes.txt index 516e10ca..d601330c 100644 --- a/externals/grill/flext/changes.txt +++ b/externals/grill/flext/changes.txt @@ -15,6 +15,8 @@ Version history: - better handling of click callback - more compatible handling of attributes in patcher (hiding is now an option - define FLEXT_ATTRHIDE) - added header file flfeatures.h for compile-time detection of version-specific features +- typed flext::NewAligned allocator +- fixed severe Altivec bug (load unaligned)... thanks to Ian Ollmann 0.5.0: - fixes for 64 bit builds (size_t is integer type of pointer size) diff --git a/externals/grill/flext/flext.vcproj b/externals/grill/flext/flext.vcproj index 4dde8462..5b05af23 100644 --- a/externals/grill/flext/flext.vcproj +++ b/externals/grill/flext/flext.vcproj @@ -121,10 +121,10 @@ #ifdef _MSC_VER #pragma warning (pop) diff --git a/externals/grill/flext/source/flbuf.cpp b/externals/grill/flext/source/flbuf.cpp index 529d32d0..a807c20b 100644 --- a/externals/grill/flext/source/flbuf.cpp +++ b/externals/grill/flext/source/flbuf.cpp @@ -326,11 +326,10 @@ void flext::buffer::ClearDirty() bool flext::buffer::IsDirty() const { - FLEXT_ASSERT(sym); + if(!sym) return false; #if FLEXT_SYS == FLEXT_SYS_PD - FLEXT_ASSERT(arr); #ifdef _FLEXT_HAVE_PD_GARRAYUPDATETIME - return isdirty || garray_updatetime(arr) > cleantime; + return arr && (isdirty || garray_updatetime(arr) > cleantime); #else // Don't know.... (no method in PD judging whether buffer has been changed from outside flext...) return true; diff --git a/externals/grill/flext/source/fldsp.h b/externals/grill/flext/source/fldsp.h index d9dbb1fe..19b4b3cb 100644 --- a/externals/grill/flext/source/fldsp.h +++ b/externals/grill/flext/source/fldsp.h @@ -54,9 +54,15 @@ public: //! returns array of input vectors (CntInSig() vectors) t_sample *const *InSig() const { return invecs; } + //! returns input vector + t_sample *InSig(int i) const { return invecs[i]; } + //! returns array of output vectors (CntOutSig() vectors) t_sample *const *OutSig() const { return outvecs; } + //! returns output vector + t_sample *OutSig(int i) const { return outvecs[i]; } + //! typedef describing a signal vector #if FLEXT_SYS == FLEXT_SYS_JMAX typedef fts_symbol_t t_signalvec; diff --git a/externals/grill/flext/source/flext.cpp b/externals/grill/flext/source/flext.cpp index d37df1f0..70184bef 100644 --- a/externals/grill/flext/source/flext.cpp +++ b/externals/grill/flext/source/flext.cpp @@ -175,7 +175,7 @@ void flext_base::CbClick() {} #if FLEXT_SYS == FLEXT_SYS_PD void flext_base::cb_click(t_gobj *c,t_floatarg xpos,t_floatarg ypos,t_floatarg shift,t_floatarg ctrl,t_floatarg alt) { - if(alt) thisObject(c)->CbClick(); + if(shift) thisObject(c)->CbClick(); } #endif diff --git a/externals/grill/flext/source/flmsg.cpp b/externals/grill/flext/source/flmsg.cpp index 1ab4b4a7..640c90cd 100755 --- a/externals/grill/flext/source/flmsg.cpp +++ b/externals/grill/flext/source/flmsg.cpp @@ -253,12 +253,15 @@ bool flext_base::CbMethodHandler(int inlet,const t_symbol *s,int argc,const t_at } catch(std::exception &x) { error("%s - Exception while processing method: %s",thisName(),x.what()); + ret = false; } catch(const char *txt) { error("%s - Exception while processing method: %s",thisName(),txt); + ret = false; } catch(...) { error("%s - Unknown exception while processing method",thisName()); + ret = false; } end: diff --git a/externals/grill/flext/source/flsndobj.cpp b/externals/grill/flext/source/flsndobj.cpp index 830a7b46..b884ce73 100644 --- a/externals/grill/flext/source/flsndobj.cpp +++ b/externals/grill/flext/source/flsndobj.cpp @@ -50,7 +50,7 @@ void flext_sndobj::ClearObjs() } } -void flext_sndobj::m_dsp(int n,t_sample *const *in,t_sample *const *out) +bool flext_sndobj::CbDsp() { // called on every rebuild of the dsp chain @@ -68,13 +68,13 @@ void flext_sndobj::m_dsp(int n,t_sample *const *in,t_sample *const *out) inobj = new Inlet *[inobjs]; tmpobj = new SndObj *[inobjs]; for(i = 0; i < inobjs; ++i) { - inobj[i] = new Inlet(in[i],blsz,smprt); + inobj[i] = new Inlet(InSig(i),blsz,smprt); tmpobj[i] = new SndObj(NULL,blsz,smprt); } } if(outobjs) { outobj = new Outlet *[outobjs]; - for(i = 0; i < outobjs; ++i) outobj[i] = new Outlet(out[i],blsz,smprt); + for(i = 0; i < outobjs; ++i) outobj[i] = new Outlet(OutSig(i),blsz,smprt); } if(!NewObjs()) ClearObjs(); @@ -82,12 +82,13 @@ void flext_sndobj::m_dsp(int n,t_sample *const *in,t_sample *const *out) else { // assign changed input/output vectors - for(i = 0; i < inobjs; ++i) inobj[i]->SetBuf(in[i]); - for(i = 0; i < outobjs; ++i) outobj[i]->SetBuf(out[i]); + for(i = 0; i < inobjs; ++i) inobj[i]->SetBuf(InSig(i)); + for(i = 0; i < outobjs; ++i) outobj[i]->SetBuf(OutSig(i)); } + return true; } -void flext_sndobj::m_signal(int n,t_sample *const *in,t_sample *const *out) +void flext_sndobj::CbSignal() { for(int i = 0; i < inobjs; ++i) *tmpobj[i] << *inobj[i]; ProcessObjs(); diff --git a/externals/grill/flext/source/flsndobj.h b/externals/grill/flext/source/flsndobj.h index 9cff9461..dee6c9de 100644 --- a/externals/grill/flext/source/flsndobj.h +++ b/externals/grill/flext/source/flsndobj.h @@ -41,9 +41,6 @@ protected: virtual bool Init(); virtual void Exit(); - virtual void m_dsp(int n,t_sample *const *in,t_sample *const *out); - virtual void m_signal(int n,t_sample *const *in,t_sample *const *out); - private: //! SndObj for reading from inlet buffer class Inlet: @@ -75,6 +72,9 @@ private: t_sample *buf; }; + virtual bool CbDsp(); + virtual void CbSignal(); + void ClearObjs(); int inobjs,outobjs; diff --git a/externals/grill/flext/source/flstk.cpp b/externals/grill/flext/source/flstk.cpp index b3a6204c..f3161565 100644 --- a/externals/grill/flext/source/flstk.cpp +++ b/externals/grill/flext/source/flstk.cpp @@ -45,7 +45,7 @@ void flext_stk::ClearObjs() } } -void flext_stk::m_dsp(int n,t_sample *const *in,t_sample *const *out) +bool flext_stk::CbDsp() { // called on every rebuild of the dsp chain @@ -64,12 +64,12 @@ void flext_stk::m_dsp(int n,t_sample *const *in,t_sample *const *out) if(inobjs) { inobj = new Input *[inobjs]; for(i = 0; i < inobjs; ++i) - inobj[i] = new Input(in[i],blsz); + inobj[i] = new Input(InSig(i),blsz); } if(outobjs) { outobj = new Output *[outobjs]; for(i = 0; i < outobjs; ++i) - outobj[i] = new Output(out[i],blsz); + outobj[i] = new Output(OutSig(i),blsz); } if(!NewObjs()) ClearObjs(); @@ -77,12 +77,13 @@ void flext_stk::m_dsp(int n,t_sample *const *in,t_sample *const *out) else { // assign changed input/output vectors - for(i = 0; i < inobjs; ++i) inobj[i]->SetBuf(in[i]); - for(i = 0; i < outobjs; ++i) outobj[i]->SetBuf(out[i]); + for(i = 0; i < inobjs; ++i) inobj[i]->SetBuf(InSig(i)); + for(i = 0; i < outobjs; ++i) outobj[i]->SetBuf(OutSig(i)); } + return true; } -void flext_stk::m_signal(int n,t_sample *const *in,t_sample *const *out) +void flext_stk::CbSignal() { if(inobjs || outobjs) ProcessObjs(blsz); } diff --git a/externals/grill/flext/source/flstk.h b/externals/grill/flext/source/flstk.h index 7f15edd9..4a9b7ece 100644 --- a/externals/grill/flext/source/flstk.h +++ b/externals/grill/flext/source/flstk.h @@ -79,8 +79,8 @@ protected: Output &Outlet(int ix) { return *outobj[ix]; } private: - virtual void m_dsp(int n,t_sample *const *in,t_sample *const *out); - virtual void m_signal(int n,t_sample *const *in,t_sample *const *out); + virtual bool CbDsp(); + virtual void CbSignal(); void ClearObjs(); diff --git a/externals/grill/flext/source/flsupport.h b/externals/grill/flext/source/flsupport.h index b6bb4eaa..25622b07 100644 --- a/externals/grill/flext/source/flsupport.h +++ b/externals/grill/flext/source/flsupport.h @@ -200,7 +200,14 @@ public: /*! \brief Check if the buffer is valid for use \note This must be true to use any of the other functions except set */ - bool Ok() const { return sym && data; } + bool Ok() const + { + return sym +#if FLEXT_SYS == FLEXT_SYS_PD + && arr +#endif + && data; + } /*! \brief Check if buffer content is valid (not in state of content change) \note buffer must be Ok() -- cgit v1.2.1