From 0709ac9fabf4184675df1c3d8e205a2790adaadb Mon Sep 17 00:00:00 2001 From: Thomas Grill Date: Sat, 8 Jan 2005 04:58:31 +0000 Subject: minor updates adapted the queue stuff to work with the new set_callback functionality reconsidered flext::buffer:Update added object construction and destruction flags updated autoconf system small updates better templates, some minor changes update for linux cleanups svn path=/trunk/; revision=2476 --- externals/grill/flext/build/bmake-win-bcc.inc | 34 +++++++-------- externals/grill/flext/build/config-lnx.def | 17 +++++--- externals/grill/flext/build/config-mac.def | 20 ++++----- externals/grill/flext/build/config-win.def | 14 +++--- externals/grill/flext/build/gnumake-lnx-gcc.inc | 17 ++++++++ externals/grill/flext/build/gnumake-mac-gcc.inc | 34 +++++++-------- externals/grill/flext/build/gnumake-win-cygwin.inc | 34 +++++++-------- externals/grill/flext/build/gnumake-win-mingw.inc | 34 +++++++-------- externals/grill/flext/build/nmake-win-msvc.inc | 34 +++++++-------- externals/grill/flext/buildsys/nmake.mak | 2 +- .../grill/flext/buildsys/win/nmake-msvc-ext.inc | 5 +-- .../grill/flext/buildsys/win/nmake-msvc-flext.inc | 18 +++----- externals/grill/flext/changes.txt | 1 + externals/grill/flext/flext.vcproj | 37 ++++++++-------- externals/grill/flext/notes.txt | 3 +- externals/grill/flext/source/flclass.h | 2 +- externals/grill/flext/source/fldsp.cpp | 25 ++--------- externals/grill/flext/source/fldsp.h | 4 +- externals/grill/flext/source/flout.cpp | 2 +- externals/grill/flext/source/flqueue.cpp | 50 +++++++++++++++------- externals/grill/flext/source/flstdc.h | 16 +++++-- externals/grill/flext/source/flsupport.h | 4 +- 22 files changed, 216 insertions(+), 191 deletions(-) create mode 100644 externals/grill/flext/build/gnumake-lnx-gcc.inc (limited to 'externals/grill/flext') diff --git a/externals/grill/flext/build/bmake-win-bcc.inc b/externals/grill/flext/build/bmake-win-bcc.inc index d39b9bf4..a54bb367 100644 --- a/externals/grill/flext/build/bmake-win-bcc.inc +++ b/externals/grill/flext/build/bmake-win-bcc.inc @@ -1,17 +1,17 @@ -!ifdef SIMD -DEFS=$(DEFS) /DFLEXT_USE_SIMD -!endif - -!ifdef SNDOBJ -SRCS=$(SRCS) $(SRCS_SNDOBJ) -HDRS=$(HDRS) $(HDRS_SNDOBJ) -INCPATH=$(INCPATH) /I$(SNDOBJ)\include -LIBS=$(LIBS) $(SNDOBJ)\lib\sndobj.lib -!endif - -!ifdef STK -SRCS=$(SRCS) $(SRCS_STK) -HDRS=$(HDRS) $(HDRS_STK) -INCPATH=$(INCPATH) /I$(STK)\include -LIBS=$(LIBS) $(STK)\lib\stk.lib -!endif +!ifdef SIMD +DEFS=$(DEFS) /DFLEXT_USE_SIMD +!endif + +!ifdef SNDOBJ +SRCS=$(SRCS) $(SRCS_SNDOBJ) +HDRS=$(HDRS) $(HDRS_SNDOBJ) +INCPATH=$(INCPATH) /I$(SNDOBJ)\include +LIBS=$(LIBS) $(SNDOBJ)\lib\sndobj.lib +!endif + +!ifdef STK +SRCS=$(SRCS) $(SRCS_STK) +HDRS=$(HDRS) $(HDRS_STK) +INCPATH=$(INCPATH) /I$(STK)\include +LIBS=$(LIBS) $(STK)\lib\stk.lib +!endif diff --git a/externals/grill/flext/build/config-lnx.def b/externals/grill/flext/build/config-lnx.def index d112b5a3..354c6c3b 100644 --- a/externals/grill/flext/build/config-lnx.def +++ b/externals/grill/flext/build/config-lnx.def @@ -1,7 +1,10 @@ -# where is the STK installation? -# (uncomment the line with # to disable STK support) -#STK=/usr/local/lib/stk - -# where is the Sndobjs installation? -# (uncomment the line with # to disable SNDOBJ support) -#SNDOBJ=/usr/local/lib/sndobj +# use SIMD CPU instructions (Altivec, SSE)? +SIMD=1 + +# where is the STK installation? +# (uncomment the line with # to disable STK support) +#STK=/usr/local/lib/stk + +# where is the Sndobjs installation? +# (uncomment the line with # to disable SNDOBJ support) +#SNDOBJ=/usr/local/lib/sndobj diff --git a/externals/grill/flext/build/config-mac.def b/externals/grill/flext/build/config-mac.def index 3d789fc6..280fff90 100644 --- a/externals/grill/flext/build/config-mac.def +++ b/externals/grill/flext/build/config-mac.def @@ -1,10 +1,10 @@ -# uncomment to inhibit SIMD usage -SIMD=1 - -# where is the STK installation? -# (uncomment the line with # to disable STK support) -#STK=/usr/local/lib/stk - -# where is the Sndobjs installation? -# (uncomment the line with # to disable SNDOBJ support) -#SNDOBJ=/usr/local/lib/sndobj +# uncomment to inhibit SIMD usage +SIMD=1 + +# where is the STK installation? +# (uncomment the line with # to disable STK support) +#STK=/usr/local/lib/stk + +# where is the Sndobjs installation? +# (uncomment the line with # to disable SNDOBJ support) +#SNDOBJ=/usr/local/lib/sndobj diff --git a/externals/grill/flext/build/config-win.def b/externals/grill/flext/build/config-win.def index 13515818..a5afc913 100644 --- a/externals/grill/flext/build/config-win.def +++ b/externals/grill/flext/build/config-win.def @@ -1,7 +1,7 @@ -# where is the STK installation? -# (uncomment the line with # to disable STK support) -#STK=c:\data\prog\audio\stk - -# where is the Sndobjs installation? -# (uncomment the line with # to disable SNDOBJ support) -#SNDOBJ=c:\data\prog\audio\sndobj +# where is the STK installation? +# (uncomment the line with # to disable STK support) +#STK=c:\data\prog\audio\stk + +# where is the Sndobjs installation? +# (uncomment the line with # to disable SNDOBJ support) +#SNDOBJ=c:\data\prog\audio\sndobj diff --git a/externals/grill/flext/build/gnumake-lnx-gcc.inc b/externals/grill/flext/build/gnumake-lnx-gcc.inc new file mode 100644 index 00000000..9cd5ac8f --- /dev/null +++ b/externals/grill/flext/build/gnumake-lnx-gcc.inc @@ -0,0 +1,17 @@ +ifdef SIMD +DEFS += -DFLEXT_USE_SIMD +endif + +ifdef SNDOBJ +SRCS+=$(SRCS_SNDOBJ) +HDRS+=$(HDRS_SNDOBJ) +INCPATH+=-I$(SNDOBJ) +LIBS+=-lsndobj +endif + +ifdef STK +SRCS+=$(SRCS_STK) +HDRS+=$(HDRS_STK) +INCPATH+=-I$(STK) +LIBS+=-lstk +endif diff --git a/externals/grill/flext/build/gnumake-mac-gcc.inc b/externals/grill/flext/build/gnumake-mac-gcc.inc index 9cd5ac8f..1eb1ce77 100644 --- a/externals/grill/flext/build/gnumake-mac-gcc.inc +++ b/externals/grill/flext/build/gnumake-mac-gcc.inc @@ -1,17 +1,17 @@ -ifdef SIMD -DEFS += -DFLEXT_USE_SIMD -endif - -ifdef SNDOBJ -SRCS+=$(SRCS_SNDOBJ) -HDRS+=$(HDRS_SNDOBJ) -INCPATH+=-I$(SNDOBJ) -LIBS+=-lsndobj -endif - -ifdef STK -SRCS+=$(SRCS_STK) -HDRS+=$(HDRS_STK) -INCPATH+=-I$(STK) -LIBS+=-lstk -endif +ifdef SIMD +DEFS += -DFLEXT_USE_SIMD +endif + +ifdef SNDOBJ +SRCS+=$(SRCS_SNDOBJ) +HDRS+=$(HDRS_SNDOBJ) +INCPATH+=-I$(SNDOBJ) +LIBS+=-lsndobj +endif + +ifdef STK +SRCS+=$(SRCS_STK) +HDRS+=$(HDRS_STK) +INCPATH+=-I$(STK) +LIBS+=-lstk +endif diff --git a/externals/grill/flext/build/gnumake-win-cygwin.inc b/externals/grill/flext/build/gnumake-win-cygwin.inc index 9cd5ac8f..1eb1ce77 100644 --- a/externals/grill/flext/build/gnumake-win-cygwin.inc +++ b/externals/grill/flext/build/gnumake-win-cygwin.inc @@ -1,17 +1,17 @@ -ifdef SIMD -DEFS += -DFLEXT_USE_SIMD -endif - -ifdef SNDOBJ -SRCS+=$(SRCS_SNDOBJ) -HDRS+=$(HDRS_SNDOBJ) -INCPATH+=-I$(SNDOBJ) -LIBS+=-lsndobj -endif - -ifdef STK -SRCS+=$(SRCS_STK) -HDRS+=$(HDRS_STK) -INCPATH+=-I$(STK) -LIBS+=-lstk -endif +ifdef SIMD +DEFS += -DFLEXT_USE_SIMD +endif + +ifdef SNDOBJ +SRCS+=$(SRCS_SNDOBJ) +HDRS+=$(HDRS_SNDOBJ) +INCPATH+=-I$(SNDOBJ) +LIBS+=-lsndobj +endif + +ifdef STK +SRCS+=$(SRCS_STK) +HDRS+=$(HDRS_STK) +INCPATH+=-I$(STK) +LIBS+=-lstk +endif diff --git a/externals/grill/flext/build/gnumake-win-mingw.inc b/externals/grill/flext/build/gnumake-win-mingw.inc index 9cd5ac8f..1eb1ce77 100644 --- a/externals/grill/flext/build/gnumake-win-mingw.inc +++ b/externals/grill/flext/build/gnumake-win-mingw.inc @@ -1,17 +1,17 @@ -ifdef SIMD -DEFS += -DFLEXT_USE_SIMD -endif - -ifdef SNDOBJ -SRCS+=$(SRCS_SNDOBJ) -HDRS+=$(HDRS_SNDOBJ) -INCPATH+=-I$(SNDOBJ) -LIBS+=-lsndobj -endif - -ifdef STK -SRCS+=$(SRCS_STK) -HDRS+=$(HDRS_STK) -INCPATH+=-I$(STK) -LIBS+=-lstk -endif +ifdef SIMD +DEFS += -DFLEXT_USE_SIMD +endif + +ifdef SNDOBJ +SRCS+=$(SRCS_SNDOBJ) +HDRS+=$(HDRS_SNDOBJ) +INCPATH+=-I$(SNDOBJ) +LIBS+=-lsndobj +endif + +ifdef STK +SRCS+=$(SRCS_STK) +HDRS+=$(HDRS_STK) +INCPATH+=-I$(STK) +LIBS+=-lstk +endif diff --git a/externals/grill/flext/build/nmake-win-msvc.inc b/externals/grill/flext/build/nmake-win-msvc.inc index d39b9bf4..a54bb367 100644 --- a/externals/grill/flext/build/nmake-win-msvc.inc +++ b/externals/grill/flext/build/nmake-win-msvc.inc @@ -1,17 +1,17 @@ -!ifdef SIMD -DEFS=$(DEFS) /DFLEXT_USE_SIMD -!endif - -!ifdef SNDOBJ -SRCS=$(SRCS) $(SRCS_SNDOBJ) -HDRS=$(HDRS) $(HDRS_SNDOBJ) -INCPATH=$(INCPATH) /I$(SNDOBJ)\include -LIBS=$(LIBS) $(SNDOBJ)\lib\sndobj.lib -!endif - -!ifdef STK -SRCS=$(SRCS) $(SRCS_STK) -HDRS=$(HDRS) $(HDRS_STK) -INCPATH=$(INCPATH) /I$(STK)\include -LIBS=$(LIBS) $(STK)\lib\stk.lib -!endif +!ifdef SIMD +DEFS=$(DEFS) /DFLEXT_USE_SIMD +!endif + +!ifdef SNDOBJ +SRCS=$(SRCS) $(SRCS_SNDOBJ) +HDRS=$(HDRS) $(HDRS_SNDOBJ) +INCPATH=$(INCPATH) /I$(SNDOBJ)\include +LIBS=$(LIBS) $(SNDOBJ)\lib\sndobj.lib +!endif + +!ifdef STK +SRCS=$(SRCS) $(SRCS_STK) +HDRS=$(HDRS) $(HDRS_STK) +INCPATH=$(INCPATH) /I$(STK)\include +LIBS=$(LIBS) $(STK)\lib\stk.lib +!endif diff --git a/externals/grill/flext/buildsys/nmake.mak b/externals/grill/flext/buildsys/nmake.mak index 5772d5a9..e097e048 100644 --- a/externals/grill/flext/buildsys/nmake.mak +++ b/externals/grill/flext/buildsys/nmake.mak @@ -46,7 +46,7 @@ BUILDTYPE=single SYSCONFIG=$(BUILDPATH)config-$(PLATFORM)-$(RTSYS)-$(COMPILER).txt SYSDEFAULT=$(BUILDPATH)$(PLATFORM)\$(RTSYS)\config-$(COMPILER).def -OPTIONS=-f $(BUILDPATH)nmake-sub.mak \ +OPTIONS=/NOLOGO /f $(BUILDPATH)nmake-sub.mak \ PLATFORM=$(PLATFORM) RTSYS=$(RTSYS) COMPILER=$(COMPILER) \ BUILDPATH=$(BUILDPATH) PKGINFO=$(PKGINFO) BUILDCLASS=$(BUILDCLASS) diff --git a/externals/grill/flext/buildsys/win/nmake-msvc-ext.inc b/externals/grill/flext/buildsys/win/nmake-msvc-ext.inc index 419c3276..2a86155a 100644 --- a/externals/grill/flext/buildsys/win/nmake-msvc-ext.inc +++ b/externals/grill/flext/buildsys/win/nmake-msvc-ext.inc @@ -37,8 +37,7 @@ _clean_: ############################################## -$(INSTPATH): - if not exist $@ mkdir $@ > nul +_install_: + @if not exist $(INSTPATH) mkdir $(INSTPATH) > nul -_install_: $(INSTPATH) copy $(TARGET) $(INSTPATH) > nul diff --git a/externals/grill/flext/buildsys/win/nmake-msvc-flext.inc b/externals/grill/flext/buildsys/win/nmake-msvc-flext.inc index 389533de..36a72f4d 100644 --- a/externals/grill/flext/buildsys/win/nmake-msvc-flext.inc +++ b/externals/grill/flext/buildsys/win/nmake-msvc-flext.inc @@ -44,22 +44,16 @@ FLEXTLIBINST=$(FLEXTSHLIB) FLEXTLIBINST=$(FLEXTLIB) !endif -$(FLEXTINC): - if not exist $@ mkdir $@ > nul - -$(FLEXTLIB): - if not exist $@ mkdir $@ > nul - -$(FLEXTLIBINST): - if not exist $@ mkdir $@ > nul - -_install_:: $(FLEXTINC) $(FLEXTLIB) $(FLEXTLIBINST) +_install_: +# create folders + @if not exist $(FLEXTINC) mkdir $(FLEXTINC) > nul + @if not exist $(FLEXTLIB) mkdir $(FLEXTLIB) > nul + @if not exist $(FLEXTLIBINST) mkdir $(FLEXTLIBINST) > nul -_install_:: copy $(TARGET) $(FLEXTLIBINST) > nul !ifdef SHARED # copy import library copy $(TARGET:.dll=.lib) $(FLEXTLIB) > nul !endif # copy headers - for %%i in ($(HDRS)) do @copy $(SRCDIR)\%%i $(FLEXTINC) > nul + for %%i in ($(HDRS)) do @copy $(SRCDIR)\%%i $(FLEXTINC) > nul diff --git a/externals/grill/flext/changes.txt b/externals/grill/flext/changes.txt index 0f8979e0..0364a0ca 100644 --- a/externals/grill/flext/changes.txt +++ b/externals/grill/flext/changes.txt @@ -23,6 +23,7 @@ Version history: - reconsidered flext::buffer::Update - enhanced buffer handling - support for buffer locking (flext::buffer::Lock() and Unlock()) - it's a must for Max/MSP at least +- use new PD idle callback for queues messages (currently in devel_0_38) 0.4.7: - added flext::GetBool (just because flext::GetInt has been there for a while) diff --git a/externals/grill/flext/flext.vcproj b/externals/grill/flext/flext.vcproj index 4854e348..315be37d 100644 --- a/externals/grill/flext/flext.vcproj +++ b/externals/grill/flext/flext.vcproj @@ -121,7 +121,7 @@ @@ -188,7 +188,7 @@ Name="VCCustomBuildTool"/> @@ -238,7 +238,7 @@ Name="VCCustomBuildTool"/> @@ -289,7 +289,7 @@ Name="VCCustomBuildTool"/> @@ -341,11 +341,11 @@ @@ -406,11 +406,11 @@ @@ -470,11 +470,11 @@ copy c:\data\pdmax\flext\pd-msvc\flext.dll c:\data\prog\dll + ImportLibrary="./max-msvc/flext-max_d.lib"/> + ImportLibrary="./max-msvc/flext-max.lib"/> + OutputFile="max-msvc/flext-max_s.lib"/> + OutputFile="max-msvc/flext-max_sd.lib"/> + OutputFile="max-msvc/flext-max_td.lib"/> + OutputFile="max-msvc/flext-max_t.lib"/> + + diff --git a/externals/grill/flext/notes.txt b/externals/grill/flext/notes.txt index a1f5ab44..d056236a 100644 --- a/externals/grill/flext/notes.txt +++ b/externals/grill/flext/notes.txt @@ -55,6 +55,7 @@ TESTS TO DO: - PD: problems with timed buffer redrawing (takes a lot of cpu time) - hard thread termination upon object destruction doesn't seem to work properly -> crash - Max rounding bug ... buffer resize could be one sample less! + - flext_dsp: Max/MSP doesn't correctly report in/out channel counts - PD: figure out what "pointer" messages do and whether they are correctly implemented in flext @@ -62,4 +63,4 @@ TESTS TO DO: - Max buffer~ resize: flext_base::buffer::Frames(): must we use buffer or system sample rate? - check whether m_dsp gets called upon deletion of a used buffer (PD and MaxMSP may behave differently). - -> PD does call m_dsp + -> PD does call m_dsp, Max/MSP does not diff --git a/externals/grill/flext/source/flclass.h b/externals/grill/flext/source/flclass.h index 7f19e6cf..edf8866c 100644 --- a/externals/grill/flext/source/flclass.h +++ b/externals/grill/flext/source/flclass.h @@ -854,7 +854,7 @@ private: //! Start message queue static void StartQueue(); -#ifdef FLEXT_QTHR +#if FLEXT_QMODE == 2 //! Queue worker function static void QWorker(thr_params *); #endif diff --git a/externals/grill/flext/source/fldsp.cpp b/externals/grill/flext/source/fldsp.cpp index 2384c5fe..f27ae032 100644 --- a/externals/grill/flext/source/fldsp.cpp +++ b/externals/grill/flext/source/fldsp.cpp @@ -48,17 +48,7 @@ flext_dsp::FLEXT_CLASSDEF(flext_dsp)(): #else srate(sys_getsr()),blksz(sys_getblksize()), #endif -#if FLEXT_SYS == FLEXT_SYS_PD - chnsin(sys_get_inchannels()), - chnsout(sys_get_outchannels()), -#elif FLEXT_SYS == FLEXT_SYS_MAX - chnsin(0),chnsout(0), -#elif FLEXT_SYS == FLEXT_SYS_JMAX - #pragma message("not implemented") chnsin(0),chnsout(0), -#else -#error -#endif #if FLEXT_SYS != FLEXT_SYS_MAX dspon(true), #endif @@ -76,6 +66,9 @@ flext_dsp::~FLEXT_CLASSDEF(flext_dsp)() fts_dsp_object_delete(thisHdr()); #endif + if(invecs) delete[] invecs; + if(outvecs) delete[] outvecs; + /* #if FLEXT_SYS == FLEXT_SYS_MAX // switch off dsp as the dsp function might get called afterwards (?!) @@ -138,18 +131,6 @@ void flext_dsp::cb_dsp(t_class *c,t_signal **sp) obj->blksz = sp[0]->s_n; // is this guaranteed to be the same as sys_getblksize() ? #endif -/* -#if FLEXT_SYS == FLEXT_SYS_PD - obj->chnsin = sys_get_inchannels(); - obj->chnsout = sys_get_outchannels(); -#elif FLEXT_SYS == FLEXT_SYS_MAX - obj->chnsin = obj->chnsout = sys_getch(); -#elif FLEXT_SYS == FLEXT_SYS_JMAX - #pragma message ("How to query the channels?") -#else -#error -#endif -*/ // store in and out signal vectors int i; int in = obj->chnsin = obj->CntInSig(); diff --git a/externals/grill/flext/source/fldsp.h b/externals/grill/flext/source/fldsp.h index 21a3aadb..80731848 100644 --- a/externals/grill/flext/source/fldsp.h +++ b/externals/grill/flext/source/fldsp.h @@ -50,7 +50,7 @@ public: //! returns current block (aka vector) size int Blocksize() const { return blksz; } - + /*! \brief returns number of audio system input channels \bug Doesn't work in Max/MSP - is always 0 */ @@ -60,7 +60,7 @@ public: \bug Doesn't work in Max/MSP - is always 0 */ int ChannelsOut() const { return chnsout; } - + //! typedef describing a signal vector #if FLEXT_SYS == FLEXT_SYS_JMAX typedef fts_symbol_t t_signalvec; diff --git a/externals/grill/flext/source/flout.cpp b/externals/grill/flext/source/flout.cpp index c0d72ac7..70c940ef 100644 --- a/externals/grill/flext/source/flout.cpp +++ b/externals/grill/flext/source/flout.cpp @@ -62,7 +62,7 @@ void flext_base::ToSysAnything(int n,const t_symbol *s,int argc,const t_atom *ar #endif #if defined(FLEXT_THREADS) - #if defined(FLEXT_QTHR) + #if FLEXT_QMODE == 2 #define CHKTHR() (IsSystemThread() || IsThread(flext::thrmsgid)) #else #define CHKTHR() IsSystemThread() diff --git a/externals/grill/flext/source/flqueue.cpp b/externals/grill/flext/source/flqueue.cpp index 9277887b..7c47cac6 100755 --- a/externals/grill/flext/source/flqueue.cpp +++ b/externals/grill/flext/source/flqueue.cpp @@ -25,7 +25,6 @@ WARRANTIES, see the file, "license.txt," in this distribution. flext::thrid_t flext::thrmsgid = 0; #endif - #define QUEUE_LENGTH 2048 #define QUEUE_ATOMS 8192 @@ -203,9 +202,9 @@ protected: static Queue queue; -#ifdef FLEXT_QTHR +#if FLEXT_QMODE == 2 static flext::ThrCond qthrcond; -#else +#elif FLEXT_QMODE == 0 static t_qelem *qclk = NULL; #endif @@ -222,7 +221,7 @@ static void QWork(bool syslock) int qc = queue.Count(); if(!qc) break; - #ifdef FLEXT_QTHR + #if FLEXT_QMODE == 2 if(syslock) sys_lock(); #endif @@ -232,14 +231,14 @@ static void QWork(bool syslock) queue.Pop(); } // inner loop - #ifdef FLEXT_QTHR + #if FLEXT_QMODE == 2 if(syslock) sys_unlock(); #endif } } -#if !defined(FLEXT_QTHR) +#if FLEXT_QMODE == 0 #if FLEXT_SYS == FLEXT_SYS_JMAX static void QTick(fts_object_t *c,int winlet, fts_symbol_t s, int ac, const fts_atom_t *at) { @@ -252,6 +251,17 @@ static void QTick(flext_base *c) #endif QWork(false); } + +#elif FLEXT_QMODE == 1 +static t_int QTick(t_int *) +{ + QWork(false); +#ifdef FLEXT_SHARED + return 1; +#else + return 0; +#endif +} #endif /* @@ -273,23 +283,29 @@ void flext_base::QFlush(flext_base *th) static void Trigger() { #if FLEXT_SYS == FLEXT_SYS_PD - #ifdef FLEXT_QTHR + #if FLEXT_QMODE == 2 // wake up worker thread qthrcond.Signal(); - #else + #elif FLEXT_QMODE == 1 && !defined(FLEXT_SHARED) + set_callback(QTick,NULL,0); + #elif FLEXT_QMODE == 0 clock_delay(qclk,0); #endif #elif FLEXT_SYS == FLEXT_SYS_MAX - qelem_set(qclk); + #if FLEXT_QMODE == 0 + qelem_set(qclk); + #endif #elif FLEXT_SYS == FLEXT_SYS_JMAX - // this is dangerous because there may be other timers on this object! - fts_timebase_add_call(fts_get_timebase(), (fts_object_t *)thisHdr(), QTick, NULL, 0); + #if FLEXT_QMODE == 0 + // this is dangerous because there may be other timers on this object! + fts_timebase_add_call(fts_get_timebase(), (fts_object_t *)thisHdr(), QTick, NULL, 0); + #endif #else #error Not implemented #endif } -#ifdef FLEXT_QTHR +#if FLEXT_QMODE == 2 void flext_base::QWorker(thr_params *) { thrmsgid = GetThreadId(); @@ -306,15 +322,17 @@ void flext_base::StartQueue() if(started) return; else started = true; -#ifdef FLEXT_QTHR +#if FLEXT_QMODE == 1 +#ifdef FLEXT_SHARED + set_callback(QTick,NULL,0); +#endif +#elif FLEXT_QMODE == 2 LaunchThread(QWorker,NULL); -#else -#if FLEXT_SYS == FLEXT_SYS_PD || FLEXT_SYS == FLEXT_SYS_MAX +#elif FLEXT_QMODE == 0 && (FLEXT_SYS == FLEXT_SYS_PD || FLEXT_SYS == FLEXT_SYS_MAX) qclk = (t_qelem *)(qelem_new(NULL,(t_method)QTick)); #else #error Not implemented! #endif -#endif } void flext_base::ToQueueBang(int o) const diff --git a/externals/grill/flext/source/flstdc.h b/externals/grill/flext/source/flstdc.h index 7d912090..75e17d57 100644 --- a/externals/grill/flext/source/flstdc.h +++ b/externals/grill/flext/source/flstdc.h @@ -281,25 +281,33 @@ typedef t_symbol *t_symptr; // ----- set message queue mode ----- -#undef FLEXT_QTHR - #if FLEXT_SYS == FLEXT_SYS_PD && PD_MINOR_VERSION >= 37 // for PD version >= 0.37test10 FLEXT_PDLOCK is standard #undef FLEXT_PDLOCK #define FLEXT_PDLOCK #endif -#ifdef FLEXT_PDLOCK +#if FLEXT_SYS == FLEXT_SYS_PD && PD_MINOR_VERSION >= 38 && defined(PD_DEVEL_VERSION) + // use idle callback + #define FLEXT_QMODE 1 +#elif defined(FLEXT_PDLOCK) // new PD thread locking functionality shall be used #if FLEXT_SYS == FLEXT_SYS_PD #ifdef FLEXT_THREADS // can only be used with PD and threaded build - #define FLEXT_QTHR + #define FLEXT_QMODE 2 + #else + #define FLEXT_QMODE 0 #endif #else #error FLEXT_PDLOCK can only be defined with PD #endif +#else + #define FLEXT_QMODE 0 #endif +#ifndef FLEXT_QMODE +#error Internal error: Queueing mode not defined +#endif #endif diff --git a/externals/grill/flext/source/flsupport.h b/externals/grill/flext/source/flsupport.h index e7e284c4..71332f6b 100644 --- a/externals/grill/flext/source/flsupport.h +++ b/externals/grill/flext/source/flsupport.h @@ -2,7 +2,7 @@ flext - C++ layer for Max/MSP and pd (pure data) externals -Copyright (c) 2001-2004 Thomas Grill (xovo@gmx.net) +Copyright (c) 2001-2005 Thomas Grill (gr@grrrr.org) For information on usage and redistribution, and for a DISCLAIMER OF ALL WARRANTIES, see the file, "license.txt," in this distribution. @@ -225,7 +225,7 @@ public: bool IsDirty() const; //! Get symbol of buffer - t_symbol *Symbol() const { return const_cast(sym); } + const t_symbol *Symbol() const { return sym; } //! Get literal name of buffer const char *Name() const { return sym?GetString(sym):""; } -- cgit v1.2.1