diff options
author | Thomas Grill <xovo@users.sourceforge.net> | 2003-06-18 02:41:05 +0000 |
---|---|---|
committer | Thomas Grill <xovo@users.sourceforge.net> | 2003-06-18 02:41:05 +0000 |
commit | 1d296c40615533f41472fbc5d552f0f9ebd5c2b1 (patch) | |
tree | 2e825e2c267bb5ca89c61e70689bb4327bcb2419 /externals/grill/flext | |
parent | 8c5e2d4efa5e341c0fbd4f168dcd22c7da36f970 (diff) |
""
svn path=/trunk/; revision=704
Diffstat (limited to 'externals/grill/flext')
-rw-r--r-- | externals/grill/flext/changes.txt | 3 | ||||
-rw-r--r-- | externals/grill/flext/flext.vcproj | 20 | ||||
-rw-r--r-- | externals/grill/flext/source/flattr.cpp | 66 | ||||
-rw-r--r-- | externals/grill/flext/source/flclass.h | 14 | ||||
-rw-r--r-- | externals/grill/flext/source/flext.cpp | 6 | ||||
-rwxr-xr-x | externals/grill/flext/tutorial/bind1/main.cpp | 144 | ||||
-rwxr-xr-x | externals/grill/flext/tutorial/maxmsp/ex-adv1.pat (renamed from externals/grill/flext/tutorial/maxmsp/ex-adv1) | bin | 540 -> 540 bytes | |||
-rwxr-xr-x | externals/grill/flext/tutorial/maxmsp/ex-adv2.pat (renamed from externals/grill/flext/tutorial/maxmsp/ex-adv2) | bin | 726 -> 726 bytes | |||
-rwxr-xr-x | externals/grill/flext/tutorial/maxmsp/ex-adv3.pat (renamed from externals/grill/flext/tutorial/maxmsp/ex-adv3) | bin | 801 -> 801 bytes | |||
-rwxr-xr-x | externals/grill/flext/tutorial/maxmsp/ex-attr1.pat (renamed from externals/grill/flext/tutorial/maxmsp/ex-attr1) | bin | 1050 -> 1050 bytes | |||
-rwxr-xr-x | externals/grill/flext/tutorial/maxmsp/ex-attr2.pat (renamed from externals/grill/flext/tutorial/maxmsp/ex-attr2) | bin | 1389 -> 1389 bytes | |||
-rwxr-xr-x | externals/grill/flext/tutorial/maxmsp/ex-attr3.pat (renamed from externals/grill/flext/tutorial/maxmsp/ex-attr3) | bin | 1358 -> 1358 bytes | |||
-rwxr-xr-x | externals/grill/flext/tutorial/maxmsp/ex-lib1.pat (renamed from externals/grill/flext/tutorial/maxmsp/ex-lib1) | bin | 1440 -> 1440 bytes | |||
-rwxr-xr-x | externals/grill/flext/tutorial/maxmsp/ex-signal1.pat (renamed from externals/grill/flext/tutorial/maxmsp/ex-signal1) | bin | 740 -> 740 bytes | |||
-rwxr-xr-x | externals/grill/flext/tutorial/maxmsp/ex-signal2.pat (renamed from externals/grill/flext/tutorial/maxmsp/ex-signal2) | bin | 708 -> 708 bytes | |||
-rwxr-xr-x | externals/grill/flext/tutorial/maxmsp/ex-simple1.pat (renamed from externals/grill/flext/tutorial/maxmsp/ex-simple1) | bin | 725 -> 725 bytes | |||
-rwxr-xr-x | externals/grill/flext/tutorial/maxmsp/ex-simple2.pat (renamed from externals/grill/flext/tutorial/maxmsp/ex-simple2) | bin | 668 -> 668 bytes | |||
-rwxr-xr-x | externals/grill/flext/tutorial/maxmsp/ex-simple3.pat (renamed from externals/grill/flext/tutorial/maxmsp/ex-simple3) | bin | 662 -> 662 bytes | |||
-rwxr-xr-x | externals/grill/flext/tutorial/maxmsp/ex-thread1.pat (renamed from externals/grill/flext/tutorial/maxmsp/ex-thread1) | bin | 1004 -> 1004 bytes | |||
-rwxr-xr-x | externals/grill/flext/tutorial/maxmsp/ex-thread2.pat (renamed from externals/grill/flext/tutorial/maxmsp/ex-thread2) | bin | 874 -> 874 bytes | |||
-rwxr-xr-x | externals/grill/flext/tutorial/maxmsp/ex-timer1.pat (renamed from externals/grill/flext/tutorial/maxmsp/ex-timer1) | bin | 1247 -> 1247 bytes | |||
-rw-r--r-- | externals/grill/flext/tutorial/pd/ex-signal1.pd | 50 | ||||
-rw-r--r-- | externals/grill/flext/tutorial/pd/ex-signal2.pd | 50 | ||||
-rw-r--r-- | externals/grill/flext/tutorial/pd/ex-simple1.pd | 8 | ||||
-rw-r--r-- | externals/grill/flext/tutorial/pd/ex-stk2.pd | 8 | ||||
-rw-r--r-- | externals/grill/flext/tutorial/pd/ex-thread1.pd | 22 | ||||
-rwxr-xr-x | externals/grill/flext/tutorial/simple1/main.cpp | 59 |
27 files changed, 253 insertions, 197 deletions
diff --git a/externals/grill/flext/changes.txt b/externals/grill/flext/changes.txt index 181c50c1..312dab3a 100644 --- a/externals/grill/flext/changes.txt +++ b/externals/grill/flext/changes.txt @@ -18,6 +18,9 @@ Version history: - fixed wrong returned result of flext::buffer::set function - fix for linux static exported function name-clash (flext::Setup() single- vs. multi-threading) - made message queue stuff global (static) for all flext objects +- added flext_base::DumpAttrib to send an attribute value to the attribute outlet +- added "getmethods" message (for attribute-enabled externals) to list methods for a specified inlet (default = 0) +- "getattributes" or "getmethods" output lists are now alphabethically sorted 0.4.4: - fixed deadly bug for Max/MSP method-to-symbol-binding proxies diff --git a/externals/grill/flext/flext.vcproj b/externals/grill/flext/flext.vcproj index 30df0b1e..c613a78d 100644 --- a/externals/grill/flext/flext.vcproj +++ b/externals/grill/flext/flext.vcproj @@ -338,8 +338,8 @@ </Configuration> <Configuration Name="Shared Debug|Win32" - OutputDirectory=".\ddl" - IntermediateDirectory=".\ddl" + OutputDirectory=".\pd-msvc\ddl" + IntermediateDirectory=".\pd-msvc\ddl" ConfigurationType="2" UseOfMFC="0" ATLMinimizesCRunTimeLibraryUsage="FALSE" @@ -348,7 +348,7 @@ Name="VCCLCompilerTool" Optimization="0" AdditionalIncludeDirectories="f:\prog\pd\pd-cvs\src,f:\prog\packs\pthreads,f:\prog\audio\sndobj\include,f:\prog\audio\stk\include" - PreprocessorDefinitions="WIN32;_DEBUG;_LIB;FLEXT_SYS_PD;FLEXT_THREADS;FLEXT_USE_SIMD;FLEXT_SHARED;FLEXT_EXPORTS;FLEXT_PDLOCK" + PreprocessorDefinitions="WIN32;_DEBUG;_LIB;FLEXT_SYS_PD;FLEXT_THREADS;FLEXT_USE_SIMD;FLEXT_SHARED;FLEXT_EXPORTS" BasicRuntimeChecks="3" RuntimeLibrary="3" RuntimeTypeInfo="TRUE" @@ -368,10 +368,10 @@ <Tool Name="VCLinkerTool" AdditionalDependencies="pd.lib pthreadVC.lib stk_d.lib sndobj.lib" - OutputFile=".\pd_msvc\flext_ld.dll" + OutputFile=".\pd-msvc\flext_ld.dll" AdditionalLibraryDirectories="f:\prog\packs\pthreads;"f:\prog\pd\pd-cvs\bin";F:\prog\audio\stk\lib;F:\prog\audio\sndobj\lib" OptimizeReferences="1" - ImportLibrary="./pd-msvc/flext_dl.lib"/> + ImportLibrary="./pd-msvc/flext_ld.lib"/> <Tool Name="VCMIDLTool"/> <Tool @@ -397,8 +397,8 @@ </Configuration> <Configuration Name="Shared Release|Win32" - OutputDirectory=".\dd" - IntermediateDirectory=".\dd" + OutputDirectory=".\pd-msvc\dd" + IntermediateDirectory=".\pd-msvc\dd" ConfigurationType="2" UseOfMFC="0" ATLMinimizesCRunTimeLibraryUsage="FALSE" @@ -408,9 +408,9 @@ Optimization="3" GlobalOptimizations="FALSE" InlineFunctionExpansion="2" - OmitFramePointers="TRUE" + OmitFramePointers="FALSE" AdditionalIncludeDirectories="f:\prog\pd\pd-cvs\src,f:\prog\packs\pthreads,f:\prog\audio\sndobj\include,f:\prog\audio\stk\include" - PreprocessorDefinitions="WIN32;_DEBUG;_LIB;FLEXT_SYS_PD;FLEXT_THREADS;FLEXT_USE_SIMD;FLEXT_SHARED;FLEXT_EXPORTS;FLEXT_PDLOCK" + PreprocessorDefinitions="WIN32;_DEBUG;_LIB;FLEXT_SYS_PD;FLEXT_THREADS;FLEXT_USE_SIMD;FLEXT_SHARED;FLEXT_EXPORTS" StringPooling="TRUE" RuntimeLibrary="2" RuntimeTypeInfo="TRUE" @@ -430,7 +430,7 @@ <Tool Name="VCLinkerTool" AdditionalDependencies="pd.lib pthreadVC.lib stk.lib sndobj.lib" - OutputFile=".\pd_msvc\flext_l.dll" + OutputFile=".\pd-msvc\flext_l.dll" AdditionalLibraryDirectories="f:\prog\packs\pthreads;"f:\prog\pd\pd-cvs\bin";F:\prog\audio\stk\lib;F:\prog\audio\sndobj\lib" OptimizeReferences="1" ImportLibrary="./pd-msvc/flext_l.lib"/> diff --git a/externals/grill/flext/source/flattr.cpp b/externals/grill/flext/source/flattr.cpp index 0cdc74c9..e22c15a8 100644 --- a/externals/grill/flext/source/flattr.cpp +++ b/externals/grill/flext/source/flattr.cpp @@ -14,6 +14,7 @@ WARRANTIES, see the file, "license.txt," in this distribution. #include "flext.h" #include <string.h> +#include <stdlib.h> #ifdef __MWERKS__ #define STD std @@ -76,6 +77,13 @@ void flext_base::AddAttrib(t_classid c,const char *attr,metharg tp,methfun gfun, AddAttrib(ClAttrs(c),ClMeths(c),attr,tp,gfun,sfun); } + +//! Sorting function for pure symbol atom lists (used with qsort below) +static int sortcmp(const void *a, const void *b) +{ + return strcmp(flext::GetString(*(t_atom *)a),flext::GetString(*(t_atom *)b)); +} + int flext_base::ListAttr(AtomList &la) const { int cnt = attrhead?attrhead->Count():0; @@ -90,12 +98,43 @@ int flext_base::ListAttr(AtomList &la) const for(item *l = a->Item(ai); l; l = l->nxt) { attritem *aa = (attritem *)l; + + // only list once! if(!aa->BothExist() || aa->IsGet()) SetSymbol(la[ix++],aa->tag); } } } } + + qsort(la.Atoms(),ix,sizeof(t_atom),sortcmp); + return ix; +} + +int flext_base::ListMeth(AtomList &la,int inlet) const +{ + int cnt = methhead?methhead->Count():0; + int ccnt = clmethhead?clmethhead->Count():0; + la(ccnt+cnt); + + int ix = 0; + for(int i = 0; i <= 1; ++i) { + itemarr *a = i?methhead:clmethhead; + if(a) { + for(int ai = 0; ai < a->Size(); ++ai) { + for(item *l = a->Item(ai); l; l = l->nxt) + { + methitem *aa = (methitem *)l; + + // match inlet and see that it's not related to an attribute + if(aa->inlet == inlet && !aa->IsAttr()) + SetSymbol(la[ix++],aa->tag); + } + } + } + } + + qsort(la.Atoms(),ix,sizeof(t_atom),sortcmp); return ix; } @@ -122,7 +161,7 @@ bool flext_base::InitAttrib(int argc,const t_atom *argv) return true; } -bool flext_base::ListAttrib() +bool flext_base::ListAttrib() const { if(procattr) { AtomList la; @@ -134,6 +173,26 @@ bool flext_base::ListAttrib() return false; } +bool flext_base::ListMethods(int inlet) const +{ + if(procattr) { + AtomList la; + int c = ListMeth(la,inlet); + ToOutAnything(GetOutAttr(),MakeSymbol("methods"),c,la.Atoms()); + return true; + } + else + return false; +} + +bool flext_base::cb_ListMethods(flext_base *c,int argc,const t_atom *argv) +{ + if(argc == 0 || (argc == 1 && CanbeInt(argv[0]))) + return c->ListMethods(argc?GetAInt(argv[0]):0); + else + return false; +} + flext_base::attritem *flext_base::FindAttr(const t_symbol *tag,bool get) const { // first search within object scope @@ -249,3 +308,8 @@ bool flext_base::GetAttrib(attritem *a) return true; } +bool flext_base::DumpAttrib(const t_symbol *attr) const +{ + attritem *item = FindAttr(attr,true); + return item && const_cast<flext_base *>(this)->GetAttrib(item); +} diff --git a/externals/grill/flext/source/flclass.h b/externals/grill/flext/source/flclass.h index c5559153..8b0e0dc7 100644 --- a/externals/grill/flext/source/flclass.h +++ b/externals/grill/flext/source/flclass.h @@ -310,8 +310,8 @@ public: a_null = 0, a_float,a_int, a_symbol,a_pointer, - a_list,a_any, - a_LIST,a_ANY + a_list,a_any, // (t_symbol *) / int / t_atom * + a_LIST,a_ANY // AtomList, AtomAnything }; typedef bool (*methfun)(flext_base *c); @@ -519,6 +519,11 @@ protected: //! @} FLEXT_C_CATTR + //! Dump an attribute to the attribute outlet + bool DumpAttrib(const t_symbol *attr) const; + //! Dump an attribute to the attribute outlet + bool DumpAttrib(const char *attr) const { return DumpAttrib(MakeSymbol(attr)); } + /*! \addtogroup FLEXT_C_INOUT @{ */ @@ -717,15 +722,18 @@ private: attritem *FindAttr(const t_symbol *tag,bool get) const; int ListAttr(AtomList &a) const; + int ListMeth(AtomList &a,int inlet = 0) const; static int CheckAttrib(int argc,const t_atom *argv); bool InitAttrib(int argc,const t_atom *argv); - bool ListAttrib(); + bool ListMethods(int inlet = 0) const; + bool ListAttrib() const; bool GetAttrib(attritem *a); bool SetAttrib(const t_symbol *s,int argc,const t_atom *argv); bool SetAttrib(attritem *a,int argc,const t_atom *argv); + static bool cb_ListMethods(flext_base *c,int argc,const t_atom *argv); static bool cb_ListAttrib(flext_base *c) { return c->ListAttrib(); } // queue stuff diff --git a/externals/grill/flext/source/flext.cpp b/externals/grill/flext/source/flext.cpp index fc033b21..78f01ff5 100644 --- a/externals/grill/flext/source/flext.cpp +++ b/externals/grill/flext/source/flext.cpp @@ -154,8 +154,10 @@ void flext_base::Setup(t_classid id) #pragma message ("no implementation of loadbang or assist") #endif - if(process_attributes) - AddMethod(id,0,"getattributes",(methfun)cb_ListAttrib); + if(process_attributes) { + AddMethod(id,0,"getattributes",cb_ListAttrib); + AddMethod(id,0,"getmethods",cb_ListMethods); + } SetProxies(c); diff --git a/externals/grill/flext/tutorial/bind1/main.cpp b/externals/grill/flext/tutorial/bind1/main.cpp index 2532556a..debfa68a 100755 --- a/externals/grill/flext/tutorial/bind1/main.cpp +++ b/externals/grill/flext/tutorial/bind1/main.cpp @@ -31,11 +31,19 @@ class bind1: public: // constructor with no arguments - bind1(); + bind1() + { + // define inlets: + // first inlet must always be of type anything (or signal for dsp objects) + AddInAnything("message inlet"); // add one inlet for any message + AddInAnything("forwarding inlet"); // add one inlet for any message + + AddOutAnything("bound message"); // output received bound message + } /* - no constructor necessary here: - flext frees all eventually still bound symbols when the object is destroyed + no destructor necessary here: + flext frees all eventually remaining bound symbols when the object is destroyed (but NOT the data that can be passed via the FLEXT_BINDMETHOD call!) */ @@ -44,25 +52,69 @@ protected: buffer *buf; // bind object - void m_bind(const t_symbol *s); + void m_bind(const t_symbol *s) + { + if(!Bind(s)) { + post("%s (%s) - Binding failed",thisName(),GetString(thisTag())); + } + } + // unbind object - void m_unbind(const t_symbol *s); + void m_unbind(const t_symbol *s) + { + if(!Unbind(s)) { + post("%s (%s) - Binding failed",thisName(),GetString(thisTag())); + } + } + // bind method - void m_bindmethod(const t_symbol *s); + void m_bindmethod(const t_symbol *s) + { + if(!FLEXT_BINDMETHOD(s,m_bound,NULL)) { + post("%s (%s) - Binding failed",thisName(),GetString(thisTag())); + } + } + // unbind method - void m_unbindmethod(const t_symbol *s); + void m_unbindmethod(const t_symbol *s) + { + if(!FLEXT_UNBINDMETHOD(s)) { + post("%s (%s) - Binding failed",thisName(),GetString(thisTag())); + } + } // forward message - void m_forward(const t_symbol *s,int argc,const t_atom *argv); + void m_forward(const t_symbol *s,int argc,const t_atom *argv) + { + Forward(s,argc,argv); + } // method for symbol-bound messages - void m_bound(const t_symbol *sym,int argc,const t_atom *argv,void *data); + void m_bound(const t_symbol *sym,int argc,const t_atom *argv,void *data) + { + ToOutAnything(0,sym,argc,argv); + } // method for binding test - void m_test(float value); + void m_test(float value) + { + post("%s - TEST METHOD: value %f",thisName(),value); + } private: - static void setup(t_classid c); + static void setup(t_classid c) + { + // register methods + + FLEXT_CADDMETHOD_(c,0,"bind",m_bind); // register method "bind" for inlet 0 + FLEXT_CADDMETHOD_(c,0,"unbind",m_unbind); // register method "unbind" for inlet 0 + FLEXT_CADDMETHOD_(c,0,"bindmethod",m_bindmethod); // register method "bindmethod" for inlet 0 + FLEXT_CADDMETHOD_(c,0,"unbindmethod",m_unbindmethod); // register method "unbindmethod" for inlet 0 + + FLEXT_CADDMETHOD_(c,0,"test",m_test); // register method m_test for inlet 0 + + FLEXT_CADDMETHOD(c,1,m_forward); // register method m_forward for inlet 1 + } FLEXT_CALLBACK_S(m_bind) // wrapper for method m_bind (with symbol argument) FLEXT_CALLBACK_S(m_unbind) // wrapper for method m_unbind (with symbol argument) @@ -79,74 +131,4 @@ private: FLEXT_NEW("bind1",bind1) -void bind1::setup(t_classid c) -{ - // register methods - - FLEXT_CADDMETHOD_(c,0,"bind",m_bind); // register method "bind" for inlet 0 - FLEXT_CADDMETHOD_(c,0,"unbind",m_unbind); // register method "unbind" for inlet 0 - FLEXT_CADDMETHOD_(c,0,"bindmethod",m_bindmethod); // register method "bindmethod" for inlet 0 - FLEXT_CADDMETHOD_(c,0,"unbindmethod",m_unbindmethod); // register method "unbindmethod" for inlet 0 - - FLEXT_CADDMETHOD_(c,0,"test",m_test); // register method m_test for inlet 0 - - FLEXT_CADDMETHOD(c,1,m_forward); // register method m_forward for inlet 1 -} - - -bind1::bind1() -{ - // define inlets: - // first inlet must always be of type anything (or signal for dsp objects) - AddInAnything("message inlet"); // add one inlet for any message - AddInAnything("forwarding inlet"); // add one inlet for any message - - AddOutAnything("bound message"); // output received bound message -} - - -void bind1::m_bind(const t_symbol *s) -{ - if(!Bind(s)) { - post("%s (%s) - Binding failed",thisName(),GetString(thisTag())); - } -} - -void bind1::m_unbind(const t_symbol *s) -{ - if(!Unbind(s)) { - post("%s (%s) - Binding failed",thisName(),GetString(thisTag())); - } -} - -void bind1::m_bindmethod(const t_symbol *s) -{ - if(!FLEXT_BINDMETHOD(s,m_bound,NULL)) { - post("%s (%s) - Binding failed",thisName(),GetString(thisTag())); - } -} - -void bind1::m_unbindmethod(const t_symbol *s) -{ - if(!FLEXT_UNBINDMETHOD(s)) { - post("%s (%s) - Binding failed",thisName(),GetString(thisTag())); - } -} - -void bind1::m_forward(const t_symbol *s,int argc,const t_atom *argv) -{ - Forward(s,argc,argv); -} - - -void bind1::m_bound(const t_symbol *sym,int argc,const t_atom *argv,void *data) -{ - ToOutAnything(0,sym,argc,argv); -} - -void bind1::m_test(float value) -{ - post("%s - TEST METHOD: value %f",thisName(),value); -} - diff --git a/externals/grill/flext/tutorial/maxmsp/ex-adv1 b/externals/grill/flext/tutorial/maxmsp/ex-adv1.pat Binary files differindex f086ab57..f086ab57 100755 --- a/externals/grill/flext/tutorial/maxmsp/ex-adv1 +++ b/externals/grill/flext/tutorial/maxmsp/ex-adv1.pat diff --git a/externals/grill/flext/tutorial/maxmsp/ex-adv2 b/externals/grill/flext/tutorial/maxmsp/ex-adv2.pat Binary files differindex b6aa0065..b6aa0065 100755 --- a/externals/grill/flext/tutorial/maxmsp/ex-adv2 +++ b/externals/grill/flext/tutorial/maxmsp/ex-adv2.pat diff --git a/externals/grill/flext/tutorial/maxmsp/ex-adv3 b/externals/grill/flext/tutorial/maxmsp/ex-adv3.pat Binary files differindex 1f041257..1f041257 100755 --- a/externals/grill/flext/tutorial/maxmsp/ex-adv3 +++ b/externals/grill/flext/tutorial/maxmsp/ex-adv3.pat diff --git a/externals/grill/flext/tutorial/maxmsp/ex-attr1 b/externals/grill/flext/tutorial/maxmsp/ex-attr1.pat Binary files differindex 5dc46f10..5dc46f10 100755 --- a/externals/grill/flext/tutorial/maxmsp/ex-attr1 +++ b/externals/grill/flext/tutorial/maxmsp/ex-attr1.pat diff --git a/externals/grill/flext/tutorial/maxmsp/ex-attr2 b/externals/grill/flext/tutorial/maxmsp/ex-attr2.pat Binary files differindex aab02c92..aab02c92 100755 --- a/externals/grill/flext/tutorial/maxmsp/ex-attr2 +++ b/externals/grill/flext/tutorial/maxmsp/ex-attr2.pat diff --git a/externals/grill/flext/tutorial/maxmsp/ex-attr3 b/externals/grill/flext/tutorial/maxmsp/ex-attr3.pat Binary files differindex 7ef7292f..7ef7292f 100755 --- a/externals/grill/flext/tutorial/maxmsp/ex-attr3 +++ b/externals/grill/flext/tutorial/maxmsp/ex-attr3.pat diff --git a/externals/grill/flext/tutorial/maxmsp/ex-lib1 b/externals/grill/flext/tutorial/maxmsp/ex-lib1.pat Binary files differindex 26f65f2b..26f65f2b 100755 --- a/externals/grill/flext/tutorial/maxmsp/ex-lib1 +++ b/externals/grill/flext/tutorial/maxmsp/ex-lib1.pat diff --git a/externals/grill/flext/tutorial/maxmsp/ex-signal1 b/externals/grill/flext/tutorial/maxmsp/ex-signal1.pat Binary files differindex aa50e2e3..aa50e2e3 100755 --- a/externals/grill/flext/tutorial/maxmsp/ex-signal1 +++ b/externals/grill/flext/tutorial/maxmsp/ex-signal1.pat diff --git a/externals/grill/flext/tutorial/maxmsp/ex-signal2 b/externals/grill/flext/tutorial/maxmsp/ex-signal2.pat Binary files differindex 21c12f88..21c12f88 100755 --- a/externals/grill/flext/tutorial/maxmsp/ex-signal2 +++ b/externals/grill/flext/tutorial/maxmsp/ex-signal2.pat diff --git a/externals/grill/flext/tutorial/maxmsp/ex-simple1 b/externals/grill/flext/tutorial/maxmsp/ex-simple1.pat Binary files differindex 133eefe9..133eefe9 100755 --- a/externals/grill/flext/tutorial/maxmsp/ex-simple1 +++ b/externals/grill/flext/tutorial/maxmsp/ex-simple1.pat diff --git a/externals/grill/flext/tutorial/maxmsp/ex-simple2 b/externals/grill/flext/tutorial/maxmsp/ex-simple2.pat Binary files differindex acc74744..acc74744 100755 --- a/externals/grill/flext/tutorial/maxmsp/ex-simple2 +++ b/externals/grill/flext/tutorial/maxmsp/ex-simple2.pat diff --git a/externals/grill/flext/tutorial/maxmsp/ex-simple3 b/externals/grill/flext/tutorial/maxmsp/ex-simple3.pat Binary files differindex 7dda678c..7dda678c 100755 --- a/externals/grill/flext/tutorial/maxmsp/ex-simple3 +++ b/externals/grill/flext/tutorial/maxmsp/ex-simple3.pat diff --git a/externals/grill/flext/tutorial/maxmsp/ex-thread1 b/externals/grill/flext/tutorial/maxmsp/ex-thread1.pat Binary files differindex cd204b4a..cd204b4a 100755 --- a/externals/grill/flext/tutorial/maxmsp/ex-thread1 +++ b/externals/grill/flext/tutorial/maxmsp/ex-thread1.pat diff --git a/externals/grill/flext/tutorial/maxmsp/ex-thread2 b/externals/grill/flext/tutorial/maxmsp/ex-thread2.pat Binary files differindex d68690c4..d68690c4 100755 --- a/externals/grill/flext/tutorial/maxmsp/ex-thread2 +++ b/externals/grill/flext/tutorial/maxmsp/ex-thread2.pat diff --git a/externals/grill/flext/tutorial/maxmsp/ex-timer1 b/externals/grill/flext/tutorial/maxmsp/ex-timer1.pat Binary files differindex d3828986..d3828986 100755 --- a/externals/grill/flext/tutorial/maxmsp/ex-timer1 +++ b/externals/grill/flext/tutorial/maxmsp/ex-timer1.pat diff --git a/externals/grill/flext/tutorial/pd/ex-signal1.pd b/externals/grill/flext/tutorial/pd/ex-signal1.pd index 9187d586..b1c085d2 100644 --- a/externals/grill/flext/tutorial/pd/ex-signal1.pd +++ b/externals/grill/flext/tutorial/pd/ex-signal1.pd @@ -1,25 +1,25 @@ -#N canvas 335 232 575 335 12; -#X obj 137 137 hsl 128 15 0 1 0 0 empty empty empty 20 8 0 8 -261681 --1 -1 0 1; -#X obj 31 92 osc~ 440; -#X obj 34 279 dac~; -#X obj 126 92 osc~ 880; -#X obj 44 206 signal1~; -#X obj 16 8 cnv 15 550 40 empty empty signal1 10 22 0 24 -260818 -1 -0; -#X text 175 28 http://www.parasitaere-kapazitaeten.net; -#X text 276 151 control the mixing; -#X text 113 241 adjust the volume; -#X obj 44 240 *~ 0.5; -#X text 28 73 source 1; -#X text 128 72 source 2; -#X obj 135 159 nbx 5 16 0 1 0 0 empty empty empty 0 -6 0 12 -261681 --1 -1 0 256; -#X text 175 8 flext tutorial \, (C)2002 \, 2003 Thomas Grill; -#X connect 0 0 12 0; -#X connect 1 0 4 0; -#X connect 3 0 4 1; -#X connect 4 0 9 0; -#X connect 9 0 2 0; -#X connect 9 0 2 1; -#X connect 12 0 4 2; +#N canvas 335 232 584 289 12;
+#X obj 253 92 hsl 128 15 0 1 0 0 empty empty empty 20 8 0 8 -261681
+-1 -1 5800 1;
+#X obj 31 92 osc~ 440;
+#X obj 90 246 dac~;
+#X obj 126 92 osc~ 880;
+#X obj 100 173 signal1~;
+#X obj 16 8 cnv 15 550 40 empty empty signal1 10 22 0 24 -260818 -1
+0;
+#X text 175 28 http://www.parasitaere-kapazitaeten.net;
+#X text 345 109 control the mixing;
+#X text 169 208 adjust the volume;
+#X obj 100 207 *~ 0.5;
+#X text 28 73 source 1;
+#X text 128 72 source 2;
+#X obj 251 114 nbx 5 16 0 1 0 0 empty empty empty 0 -6 0 12 -261681
+-1 -1 0.456693 256;
+#X text 175 8 flext tutorial \, (C)2002 \, 2003 Thomas Grill;
+#X connect 0 0 12 0;
+#X connect 1 0 4 0;
+#X connect 3 0 4 1;
+#X connect 4 0 9 0;
+#X connect 9 0 2 0;
+#X connect 9 0 2 1;
+#X connect 12 0 4 2;
diff --git a/externals/grill/flext/tutorial/pd/ex-signal2.pd b/externals/grill/flext/tutorial/pd/ex-signal2.pd index c081c3b5..bdf834b3 100644 --- a/externals/grill/flext/tutorial/pd/ex-signal2.pd +++ b/externals/grill/flext/tutorial/pd/ex-signal2.pd @@ -1,25 +1,25 @@ -#N canvas 41 125 583 263 12; -#X obj 81 133 signal2~; -#X obj 76 88 bng 25 250 50 0 empty empty empty 0 -6 0 8 -261681 -1 --1; -#X text 108 94 bang to get audio system parameters; -#X text 233 212 channels in and out; -#X obj 16 8 cnv 15 550 40 empty empty signal2 10 22 0 24 -260818 -1 -0; -#X text 175 28 http://www.parasitaere-kapazitaeten.net; -#X obj 38 191 nbx 5 16 -1e+37 1e+37 0 0 empty empty empty 0 -6 0 12 --228992 -1 -1 0 256; -#X obj 130 191 nbx 5 16 -1e+37 1e+37 0 0 empty empty empty 0 -6 0 12 --228992 -1 -1 0 256; -#X obj 233 191 nbx 5 16 -1e+37 1e+37 0 0 empty empty empty 0 -6 0 12 --228992 -1 -1 0 256; -#X obj 325 191 nbx 5 16 -1e+37 1e+37 0 0 empty empty empty 0 -6 0 12 --228992 -1 -1 0 256; -#X text 12 211 samplerate; -#X text 128 211 blocksize; -#X text 173 10 flext tutorial \, (C)2002 \, 2003 Thomas Grill; -#X connect 0 0 6 0; -#X connect 0 1 7 0; -#X connect 0 2 8 0; -#X connect 0 3 9 0; -#X connect 1 0 0 0; +#N canvas 41 125 585 250 12;
+#X obj 109 126 signal2~;
+#X obj 104 81 bng 25 250 50 0 empty empty empty 0 -6 0 8 -261681 -1
+-1;
+#X text 136 87 bang to get audio system parameters;
+#X text 261 205 channels in and out;
+#X obj 16 8 cnv 15 550 40 empty empty signal2 10 22 0 24 -260818 -1
+0;
+#X text 175 28 http://www.parasitaere-kapazitaeten.net;
+#X obj 66 184 nbx 5 16 -1e+037 1e+037 0 0 empty empty empty 0 -6 0
+12 -228992 -1 -1 0 256;
+#X obj 158 184 nbx 5 16 -1e+037 1e+037 0 0 empty empty empty 0 -6 0
+12 -228992 -1 -1 0 256;
+#X obj 261 184 nbx 5 16 -1e+037 1e+037 0 0 empty empty empty 0 -6 0
+12 -228992 -1 -1 0 256;
+#X obj 353 184 nbx 5 16 -1e+037 1e+037 0 0 empty empty empty 0 -6 0
+12 -228992 -1 -1 0 256;
+#X text 40 204 samplerate;
+#X text 156 204 blocksize;
+#X text 173 10 flext tutorial \, (C)2002 \, 2003 Thomas Grill;
+#X connect 0 0 6 0;
+#X connect 0 1 7 0;
+#X connect 0 2 8 0;
+#X connect 0 3 9 0;
+#X connect 1 0 0 0;
diff --git a/externals/grill/flext/tutorial/pd/ex-simple1.pd b/externals/grill/flext/tutorial/pd/ex-simple1.pd index 9c090fac..5020ea00 100644 --- a/externals/grill/flext/tutorial/pd/ex-simple1.pd +++ b/externals/grill/flext/tutorial/pd/ex-simple1.pd @@ -1,14 +1,14 @@ -#N canvas 85 178 588 251 12;
+#N canvas 85 178 590 226 12;
#X msg 29 92 help;
-#X text 203 187 inverse;
+#X text 203 169 inverse;
#X text 169 96 input;
-#X obj 113 141 simple1;
+#X obj 113 131 simple1;
#X obj 16 8 cnv 15 550 40 empty empty simple1 10 22 0 24 -260818 -1
0;
#X text 167 30 http://www.parasitaere-kapazitaeten.net;
#X obj 114 96 nbx 4 16 -999 999 0 0 empty empty empty 0 -6 0 12 -261681
-1 -1 0 256;
-#X obj 112 190 nbx 7 16 -1e+037 1e+037 0 0 empty empty empty 0 -6 0
+#X obj 114 170 nbx 7 16 -1e+037 1e+037 0 0 empty empty empty 0 -6 0
12 -228992 -1 -1 0 256;
#X text 167 10 flext tutorial \, (C)2002 \, 2003 Thomas Grill;
#X connect 0 0 3 0;
diff --git a/externals/grill/flext/tutorial/pd/ex-stk2.pd b/externals/grill/flext/tutorial/pd/ex-stk2.pd index fff665b9..a06db3e2 100644 --- a/externals/grill/flext/tutorial/pd/ex-stk2.pd +++ b/externals/grill/flext/tutorial/pd/ex-stk2.pd @@ -1,11 +1,11 @@ -#N canvas 245 28 592 386 12;
+#N canvas 245 28 594 364 12;
#X obj 68 318 dac~;
#X obj 15 8 cnv 15 550 40 empty empty stk2 10 22 0 24 -260818 -1 0
;
#X text 175 28 http://www.parasitaere-kapazitaeten.net;
#X text 193 229 adjust the volume;
#X obj 194 212 hsl 128 15 0.01 1 1 0 empty empty empty -2 -6 0 8 -261681
--1 -1 9000 1;
+-1 -1 0 1;
#X obj 68 263 *~ 0.3;
#X text 175 8 flext tutorial \, (C)2002-2003 Thomas Grill;
#X obj 68 215 stk2~;
@@ -13,9 +13,9 @@ #X msg 183 139 shL \$1;
#X msg 241 139 shR \$1;
#X obj 267 77 hsl 128 15 0.5 2 1 0 empty empty empty -2 -6 0 8 -261681
--1 -1 5700 1;
+-1 -1 0 1;
#X obj 267 95 hsl 128 15 0.5 2 1 0 empty empty empty -2 -6 0 8 -261681
--1 -1 9300 1;
+-1 -1 0 1;
#X text 172 73 pitch left;
#X text 172 93 pitch right;
#X obj 68 78 osc~ 442;
diff --git a/externals/grill/flext/tutorial/pd/ex-thread1.pd b/externals/grill/flext/tutorial/pd/ex-thread1.pd index ff2d9f38..db04938d 100644 --- a/externals/grill/flext/tutorial/pd/ex-thread1.pd +++ b/externals/grill/flext/tutorial/pd/ex-thread1.pd @@ -1,10 +1,10 @@ -#N canvas 105 266 708 351 12;
+#N canvas 105 266 608 311 12;
#X obj 39 91 bng 25 250 50 0 empty empty start 0 -6 0 8 -261681 -1
-1;
-#X obj 130 246 thread1;
-#X obj 228 248 thread1;
-#X obj 324 246 thread1;
-#X obj 422 247 thread1;
+#X obj 130 231 thread1;
+#X obj 228 233 thread1;
+#X obj 324 231 thread1;
+#X obj 422 232 thread1;
#X obj 131 185 delay 200;
#X obj 228 185 delay 200;
#X obj 325 185 delay 200;
@@ -15,16 +15,16 @@ second time); #X obj 16 8 cnv 15 550 40 empty empty thread1 10 22 0 24 -260818 -1
0;
#X text 170 29 http://www.parasitaere-kapazitaeten.net;
-#X obj 131 277 nbx 5 16 -1e+037 1e+037 0 0 empty empty empty 0 -6 0
+#X obj 131 262 nbx 5 16 -1e+037 1e+037 0 0 empty empty empty 0 -6 0
12 -228992 -1 -1 0 256;
-#X obj 229 278 nbx 5 16 -1e+037 1e+037 0 0 empty empty empty 0 -6 0
+#X obj 229 263 nbx 5 16 -1e+037 1e+037 0 0 empty empty empty 0 -6 0
12 -228992 -1 -1 0 256;
-#X obj 323 276 nbx 5 16 -1e+037 1e+037 0 0 empty empty empty 0 -6 0
+#X obj 323 261 nbx 5 16 -1e+037 1e+037 0 0 empty empty empty 0 -6 0
12 -228992 -1 -1 0 256;
-#X obj 423 276 nbx 5 16 -1e+037 1e+037 0 0 empty empty empty 0 -6 0
+#X obj 423 261 nbx 5 16 -1e+037 1e+037 0 0 empty empty empty 0 -6 0
12 -228992 -1 -1 0 256;
-#X obj 39 244 thread1;
-#X obj 39 277 nbx 5 16 -1e+037 1e+037 0 0 empty empty empty 0 -6 0
+#X obj 39 229 thread1;
+#X obj 39 262 nbx 5 16 -1e+037 1e+037 0 0 empty empty empty 0 -6 0
12 -228992 -1 -1 0 256;
#X text 170 11 flext tutorial \, (C)2002 \, 2003 Thomas Grill;
#X connect 0 0 5 0;
diff --git a/externals/grill/flext/tutorial/simple1/main.cpp b/externals/grill/flext/tutorial/simple1/main.cpp index 9f0f43e8..ed3c3ea3 100755 --- a/externals/grill/flext/tutorial/simple1/main.cpp +++ b/externals/grill/flext/tutorial/simple1/main.cpp @@ -32,10 +32,36 @@ class simple1: public: // constructor - simple1(); + simple1() + { + // define inlets: + // first inlet must always be of type anything (or signal for dsp objects) + AddInAnything(); // add one inlet for any message + + // define outlets: + AddOutFloat(); // add one float outlet (has index 0) + + // register methods + FLEXT_ADDMETHOD(0,m_float); // register method (for float messages) "m_float" for inlet 0 + } protected: - void m_float(float f); // method for float values + void m_float(float input) // method for float values + { + float result; + + if(input == 0) { + // special case 0 + post("%s - zero can't be inverted!",thisName()); + result = 0; + } + else + // normal case + result = 1/input; + + // output value to outlet + ToOutFloat(0,result); // (0 stands for the outlet index 0 - the leftmost outlet) + } private: FLEXT_CALLBACK_1(m_float,float) // callback for method "m_float" (with one float argument) @@ -45,32 +71,3 @@ private: FLEXT_NEW("simple1",simple1) -simple1::simple1() -{ - // define inlets: - // first inlet must always be of type anything (or signal for dsp objects) - AddInAnything(); // add one inlet for any message - - // define outlets: - AddOutFloat(); // add one float outlet (has index 0) - - // register methods - FLEXT_ADDMETHOD(0,m_float); // register method (for float messages) "m_float" for inlet 0 -} - -void simple1::m_float(float f) -{ - float res; - if(f == 0) { - // special case 0 - post("%s - zero can't be inverted!",thisName()); - res = 0; - } - else - // normal case - res = 1/f; - - // output value to outlet - ToOutFloat(0,res); // (0 stands for the outlet index 0 - the leftmost outlet) -} - |