diff options
author | Thomas Grill <xovo@users.sourceforge.net> | 2003-06-10 02:33:37 +0000 |
---|---|---|
committer | Thomas Grill <xovo@users.sourceforge.net> | 2003-06-10 02:33:37 +0000 |
commit | 5a33517fef170ceb104b35aa690fdadcb0cf292b (patch) | |
tree | 0c5740af99d57fbf9e8de3bfe8cd05e150c70df0 /externals/grill | |
parent | d97d46e2806969c994647ee8e3ce64b4f3d1d9f6 (diff) |
""
svn path=/trunk/; revision=687
Diffstat (limited to 'externals/grill')
22 files changed, 674 insertions, 41 deletions
diff --git a/externals/grill/flext/.cvsignore b/externals/grill/flext/.cvsignore new file mode 100755 index 00000000..51cbd3a7 --- /dev/null +++ b/externals/grill/flext/.cvsignore @@ -0,0 +1,9 @@ +max-os9 +max-osx +pd-darwin +pd-msvc +doc +build +flext Data +.DS_Store + diff --git a/externals/grill/flext/flext.cw b/externals/grill/flext/flext.cw Binary files differindex 50286875..544a5198 100644 --- a/externals/grill/flext/flext.cw +++ b/externals/grill/flext/flext.cw diff --git a/externals/grill/flext/flext.pbproj/project.pbxproj b/externals/grill/flext/flext.pbproj/project.pbxproj index 7435967e..58f090cd 100755 --- a/externals/grill/flext/flext.pbproj/project.pbxproj +++ b/externals/grill/flext/flext.pbproj/project.pbxproj @@ -2852,13 +2852,14 @@ DYLIB_COMPATIBILITY_VERSION = 1; DYLIB_CURRENT_VERSION = 1; HEADER_SEARCH_PATHS = /usr/local/pd/src; - LIBRARY_STYLE = BUNDLE; + INSTALL_PATH = /usr/local/lib; + LIBRARY_STYLE = DYNAMIC; OPTIMIZATION_CFLAGS = "-O3"; OTHER_CFLAGS = "-D FLEXT_SYS_PD -D FLEXT_SHARED -D FLEXT_THREADS -D FLEXT_USE_SIMD -Wno-switch -Wno-long-double"; - OTHER_LDFLAGS = "-bundle_loader /usr/local/pd/bin/pd"; + OTHER_LDFLAGS = "-lgcc -lstdc++ -flat_namespace -undefined suppress"; OTHER_LIBTOOL_FLAGS = ""; OTHER_REZFLAGS = ""; - PRODUCT_NAME = flext.dylib; + PRODUCT_NAME = libflext.dylib; REZ_EXECUTABLE = YES; SECTORDER_FLAGS = ""; WARNING_CFLAGS = "-Wmost -Wno-four-char-constants -Wno-unknown-pragmas"; @@ -2868,6 +2869,7 @@ ); isa = PBXLibraryTarget; name = "PD@OSX shared"; + productInstallPath = /usr/local/lib; productName = "PD@OSX"; productReference = F5CBC5B704757A5901A0C81C; shouldUseHeadermap = 0; @@ -3139,7 +3141,7 @@ }; F5CBC5B704757A5901A0C81C = { isa = PBXLibraryReference; - path = flext.dylib; + path = libflext.dylib; refType = 3; }; F5CBC5B804757BC801A0C81C = { @@ -3825,13 +3827,14 @@ DYLIB_COMPATIBILITY_VERSION = 1; DYLIB_CURRENT_VERSION = 1; HEADER_SEARCH_PATHS = /usr/local/pd/src; - LIBRARY_STYLE = BUNDLE; + INSTALL_PATH = /usr/local/lib; + LIBRARY_STYLE = DYNAMIC; OPTIMIZATION_CFLAGS = "-O0"; OTHER_CFLAGS = "-DFLEXT_SYS_PD -DFLEXT_DEBUG -DFLEXT_SHARED -DFLEXT_THREADS -DFLEXT_USE_SIMD -Wno-switch -Wno-long-double"; - OTHER_LDFLAGS = "-bundle_loader /usr/local/pd/bin/pd"; + OTHER_LDFLAGS = "-lgcc -lstdc++ -flat_namespace -undefined suppress"; OTHER_LIBTOOL_FLAGS = ""; OTHER_REZFLAGS = ""; - PRODUCT_NAME = flext_d.dylib; + PRODUCT_NAME = libflext_d.dylib; REZ_EXECUTABLE = YES; SECTORDER_FLAGS = ""; WARNING_CFLAGS = "-Wmost -Wno-four-char-constants -Wno-unknown-pragmas"; @@ -3841,6 +3844,7 @@ ); isa = PBXLibraryTarget; name = "PD@OSX shared debug"; + productInstallPath = /usr/local/lib; productName = "PD@OSX"; productReference = F5CBC69B047584CD01A0C81C; shouldUseHeadermap = 0; @@ -4190,7 +4194,7 @@ }; F5CBC69B047584CD01A0C81C = { isa = PBXLibraryReference; - path = flext_d.dylib; + path = libflext_d.dylib; refType = 3; }; }; diff --git a/externals/grill/flext/makefile.pd-darwin b/externals/grill/flext/makefile.pd-darwin index 440bfa31..c97f96db 100644 --- a/externals/grill/flext/makefile.pd-darwin +++ b/externals/grill/flext/makefile.pd-darwin @@ -19,7 +19,7 @@ FLAGS+=${UFLAGS} CFLAGS=-O6 CFLAGS_D=-g CFLAGS_T=-DFLEXT_THREADS -LIBS= +LIBS=gcc # ---------------------------------------------- @@ -45,17 +45,17 @@ HDRS+=$(HDRS_STK) endif # for FLEXT_USE_SIMD -CFLAGS+=-framework veclib -Fveclib +CFLAGS+=-framework Carbon -framework veclib -Fveclib -FCarbon MAKEFILE=makefile.pd-darwin -TARGET=$(TARGDIR)/$(NAME).a -TARGET_D=$(TARGDIR)/$(NAME)_d.a -TARGET_T=$(TARGDIR)/$(NAME)_t.a -TARGET_TD=$(TARGDIR)/$(NAME)_td.a -TARGET_S=$(TARGDIR)/$(NAME).dylib -TARGET_SD=$(TARGDIR)/$(NAME)_d.dylib +TARGET=$(TARGDIR)/lib$(NAME).a +TARGET_D=$(TARGDIR)/lib$(NAME)_d.a +TARGET_T=$(TARGDIR)/lib$(NAME)_t.a +TARGET_TD=$(TARGDIR)/lib$(NAME)_td.a +TARGET_S=$(TARGDIR)/lib$(NAME).dylib +TARGET_SD=$(TARGDIR)/lib$(NAME)_d.dylib -all: $(TARGDIR) $(TARGET) $(TARGET_D) $(TARGET_T) $(TARGET_TD) # $(TARGET_S) $(TARGET_SD) +all: $(TARGDIR) $(TARGET) $(TARGET_D) $(TARGET_T) $(TARGET_TD) $(TARGET_S) $(TARGET_SD) $(TARGDIR): mkdir $(TARGDIR) @@ -64,22 +64,22 @@ $(patsubst %,$(SRCDIR)/%,$(SRCS)): $(patsubst %,$(SRCDIR)/%,$(HDRS)) $(patsubst touch $@ $(TARGDIR)/%.o : $(SRCDIR)/%.cpp - $(CXX) -c $(CFLAGS) $(FLAGS) $(patsubst %,-I%,$(INCLUDES) $(SRCDIR)) $< -o $@ + $(CXX) -c -dynamic $(CFLAGS) $(FLAGS) $(patsubst %,-I%,$(INCLUDES) $(SRCDIR)) $< -o $@ $(TARGDIR)/%.do : $(SRCDIR)/%.cpp - $(CXX) -c $(CFLAGS_D) $(FLAGS) $(patsubst %,-I%,$(INCLUDES) $(SRCDIR)) $< -o $@ + $(CXX) -c -dynamic $(CFLAGS_D) $(FLAGS) $(patsubst %,-I%,$(INCLUDES) $(SRCDIR)) $< -o $@ $(TARGDIR)/%.to : $(SRCDIR)/%.cpp - $(CXX) -c $(CFLAGS) $(CFLAGS_T) $(FLAGS) $(patsubst %,-I%,$(INCLUDES) $(SRCDIR)) $< -o $@ + $(CXX) -c -dynamic $(CFLAGS) $(CFLAGS_T) $(FLAGS) $(patsubst %,-I%,$(INCLUDES) $(SRCDIR)) $< -o $@ $(TARGDIR)/%.tdo : $(SRCDIR)/%.cpp - $(CXX) -c $(CFLAGS_D) $(CFLAGS_T) $(FLAGS) $(patsubst %,-I%,$(INCLUDES) $(SRCDIR)) $< -o $@ + $(CXX) -c -dynamic $(CFLAGS_D) $(CFLAGS_T) $(FLAGS) $(patsubst %,-I%,$(INCLUDES) $(SRCDIR)) $< -o $@ $(TARGDIR)/%.so : $(SRCDIR)/%.cpp - $(CXX) -c -dynamic $(CFLAGS) $(CFLAGS_T) $(FLAGS) $(patsubst %,-I%,$(INCLUDES) $(SRCDIR)) $< -o $@ + $(CXX) -c -dynamic $(CFLAGS) $(CFLAGS_T) $(FLAGS) -DFLEXT_SHARED $(patsubst %,-I%,$(INCLUDES) $(SRCDIR)) $< -o $@ $(TARGDIR)/%.sdo : $(SRCDIR)/%.cpp - $(CXX) -c -dyanmic $(CFLAGS_D) $(CFLAGS_T) $(FLAGS) $(patsubst %,-I%,$(INCLUDES) $(SRCDIR)) $< -o $@ + $(CXX) -c -dynamic $(CFLAGS_D) $(CFLAGS_T) $(FLAGS) -DFLEXT_SHARED $(patsubst %,-I%,$(INCLUDES) $(SRCDIR)) $< -o $@ $(TARGET) : $(patsubst %.cpp,$(TARGDIR)/%.o,$(SRCS)) libtool -static -o $@ $^ @@ -94,10 +94,10 @@ $(TARGET_TD) : $(patsubst %.cpp,$(TARGDIR)/%.tdo,$(SRCS)) libtool -static -o $@ $^ $(TARGET_S) : $(patsubst %.cpp,$(TARGDIR)/%.so,$(SRCS)) - libtool -dynamic -flat_namespace -undefined suppress -o $@ $^ + ld -dylib -dynamic -flat_namespace -undefined suppress -lgcc -lstdc++ -ldylib1.o -o $@ $^ $(TARGET_SD) : $(patsubst %.cpp,$(TARGDIR)/%.sdo,$(SRCS)) - libtool -dynamic -flat_namespace -undefined suppress -o $@ $^ + ld -dylib -dynamic -flat_namespace -undefined suppress -lgcc -lstdc++ -ldylib1.o -o $@ $^ .PHONY: clean install @@ -111,8 +111,9 @@ $(INSTDIR): install:: $(INSTDIR) endif -install:: $(TARGET) $(TARGET_D) $(TARGET_T) $(TARGET_TD) $(patsubst %,$(SRCDIR)/%,$(HDRS)) # $(TARGET_S) $(TARGET_SD) +install:: $(TARGET) $(TARGET_D) $(TARGET_T) $(TARGET_TD) $(TARGET_S) $(TARGET_SD) $(patsubst %,$(SRCDIR)/%,$(HDRS)) cp $^ $(INSTDIR) + mv $(INSTDIR)/lib*.dylib /usr/local/lib ranlib $(INSTDIR)/*.a # have to rerun ranlib at install dir ?! # chmod 755 $(patsubst %,$(INSTDIR)/%,$(notdir $^)) # chgrp admin $(patsubst %,$(INSTDIR)/%,$(notdir $^)) 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"):<br> 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: <li>Libraries of externals in Max/MSP <li>More than 3 typed creation arguments possible for Max/MSP <li>Any input to any object's inlet (with the exception of signal streams) +<li>Control of the object state by use of Max/Jitter-like "attributes" </ul> Naturally there are some cons, too: <ul> <li>Introduces a small overhead to speed of message handling -<li>Overhead in object size (due to possibly unneeded library code) +<li>Overhead in object size (due to possibly unneeded library code) when statically linked </ul> 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<BR> Also see the file license.txt for notes on +in the file gpl.txt<BR> +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: diff --git a/externals/grill/flext/tutorial/attr1/attr1.cw b/externals/grill/flext/tutorial/attr1/attr1.cw Binary files differindex a597bf1e..32e4ec8f 100755 --- a/externals/grill/flext/tutorial/attr1/attr1.cw +++ b/externals/grill/flext/tutorial/attr1/attr1.cw diff --git a/externals/grill/flext/tutorial/attr2/attr2.cw b/externals/grill/flext/tutorial/attr2/attr2.cw Binary files differindex f1dbec3b..c2713289 100755 --- a/externals/grill/flext/tutorial/attr2/attr2.cw +++ b/externals/grill/flext/tutorial/attr2/attr2.cw diff --git a/externals/grill/flext/tutorial/attr3/attr3.cw b/externals/grill/flext/tutorial/attr3/attr3.cw Binary files differindex 9384e993..644c96a6 100755 --- a/externals/grill/flext/tutorial/attr3/attr3.cw +++ b/externals/grill/flext/tutorial/attr3/attr3.cw diff --git a/externals/grill/flext/tutorial/bind1/bind1.cw b/externals/grill/flext/tutorial/bind1/bind1.cw Binary files differnew file mode 100755 index 00000000..750d275b --- /dev/null +++ b/externals/grill/flext/tutorial/bind1/bind1.cw diff --git a/externals/grill/flext/tutorial/bind1/bind1.dsp b/externals/grill/flext/tutorial/bind1/bind1.dsp new file mode 100755 index 00000000..d4095c8f --- /dev/null +++ b/externals/grill/flext/tutorial/bind1/bind1.dsp @@ -0,0 +1,95 @@ +# Microsoft Developer Studio Project File - Name="bind1" - Package Owner=<4> +# Microsoft Developer Studio Generated Build File, Format Version 6.00 +# ** NICHT BEARBEITEN ** + +# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102 + +CFG=bind1 - Win32 Debug +!MESSAGE Dies ist kein gültiges Makefile. Zum Erstellen dieses Projekts mit NMAKE +!MESSAGE verwenden Sie den Befehl "Makefile exportieren" und führen Sie den Befehl +!MESSAGE +!MESSAGE NMAKE /f "bind1.mak". +!MESSAGE +!MESSAGE Sie können beim Ausführen von NMAKE eine Konfiguration angeben +!MESSAGE durch Definieren des Makros CFG in der Befehlszeile. Zum Beispiel: +!MESSAGE +!MESSAGE NMAKE /f "bind1.mak" CFG="bind1 - Win32 Debug" +!MESSAGE +!MESSAGE Für die Konfiguration stehen zur Auswahl: +!MESSAGE +!MESSAGE "bind1 - Win32 Release" (basierend auf "Win32 (x86) Dynamic-Link Library") +!MESSAGE "bind1 - Win32 Debug" (basierend auf "Win32 (x86) Dynamic-Link Library") +!MESSAGE + +# Begin Project +# PROP AllowPerConfigDependencies 0 +# PROP Scc_ProjName "max/flext/tutorial/bind1" +# PROP Scc_LocalPath "." +CPP=cl.exe +MTL=midl.exe +RSC=rc.exe + +!IF "$(CFG)" == "bind1 - Win32 Release" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "Release" +# PROP BASE Intermediate_Dir "Release" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "msvc" +# PROP Intermediate_Dir "msvc" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /YX /FD /c +# ADD CPP /nologo /W3 /O2 /I "c:\programme\audio\pd\src" /I "..\..\source" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "PD" /YX /FD /c +# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 +# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 +# ADD BASE RSC /l 0xc07 /d "NDEBUG" +# ADD RSC /l 0xc07 /d "NDEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib /nologo /dll /machine:I386 +# ADD LINK32 kernel32.lib user32.lib pd.lib flext-pdwin.lib /nologo /dll /machine:I386 /out:"../pd-msvc/bind1.dll" /libpath:"..\..\pd-msvc" + +!ELSEIF "$(CFG)" == "bind1 - Win32 Debug" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "Debug" +# PROP BASE Intermediate_Dir "Debug" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "msvc-debug" +# PROP Intermediate_Dir "msvc-debug" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /YX /FD /GZ /c +# ADD CPP /nologo /W3 /Gm /ZI /Od /I "c:\programme\audio\pd\src" /I "..\..\source" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "PD" /Fr /YX /FD /GZ /c +# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 +# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 +# ADD BASE RSC /l 0xc07 /d "_DEBUG" +# ADD RSC /l 0xc07 /d "_DEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept +# ADD LINK32 kernel32.lib user32.lib pd.lib flext_d-pdwin.lib /nologo /dll /debug /machine:I386 /out:"msvc-debug/bind1.dll" /pdbtype:sept /libpath:"..\..\pd-msvc" + +!ENDIF + +# Begin Target + +# Name "bind1 - Win32 Release" +# Name "bind1 - Win32 Debug" +# Begin Source File + +SOURCE=.\main.cpp +# End Source File +# End Target +# End Project diff --git a/externals/grill/flext/tutorial/bind1/main.cpp b/externals/grill/flext/tutorial/bind1/main.cpp new file mode 100755 index 00000000..35459fc4 --- /dev/null +++ b/externals/grill/flext/tutorial/bind1/main.cpp @@ -0,0 +1,146 @@ +/* +flext tutorial - bind 1 + +Copyright (c) 2003 Thomas Grill (xovo@gmx.net) +For information on usage and redistribution, and for a DISCLAIMER OF ALL +WARRANTIES, see the file, "license.txt," in this distribution. + +------------------------------------------------------------------------- + +This is an example of a simple object demonstrating method to symbol binding and message forwarding +*/ + + +// include flext header +#include <flext.h> + +// check for appropriate flext version +#if !defined(FLEXT_VERSION) || (FLEXT_VERSION < 400) +#error You need at least flext version 0.4.0 +#endif + + +// define the class that stands for a pd/Max object + +class bind1: + // inherit from basic flext class + public flext_base +{ + // obligatory flext header (class name,base class name) featuring a setup function + FLEXT_HEADER_S(bind1,flext_base,setup) + +public: + // constructor with no arguments + bind1(); + +protected: + const t_symbol *bufname; + buffer *buf; + + // bind object + void m_bind(const t_symbol *s); + // unbind object + void m_unbind(const t_symbol *s); + // bind method + void m_bindmethod(const t_symbol *s); + // unbind method + void m_unbindmethod(const t_symbol *s); + + // forward message + void m_forward(const t_symbol *s,int argc,const t_atom *argv); + + // method for symbol-bound messages + void m_bound(const t_symbol *sym,int argc,const t_atom *argv,void *data); + + // method for binding test + void m_test(float value); + +private: + static void setup(t_classid c); + + 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) + FLEXT_CALLBACK_S(m_bindmethod) // wrapper for method m_bindmethod (with symbol argument) + FLEXT_CALLBACK_S(m_unbindmethod) // wrapper for method m_unbindmethod (with symbol argument) + + FLEXT_CALLBACK_A(m_forward) // wrapper for method m_forward (with anything argument) + + FLEXT_CALLBACK_AX(m_bound) // wrapper for method m_bound (anything+data arguments) + FLEXT_CALLBACK_F(m_test) // wrapper for method m_test (one float argument) +}; + +// instantiate the class +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/buffer1/buffer1.cw b/externals/grill/flext/tutorial/buffer1/buffer1.cw Binary files differnew file mode 100755 index 00000000..31671b11 --- /dev/null +++ b/externals/grill/flext/tutorial/buffer1/buffer1.cw diff --git a/externals/grill/flext/tutorial/buffer1/buffer1.dsp b/externals/grill/flext/tutorial/buffer1/buffer1.dsp new file mode 100755 index 00000000..0dfa0e4f --- /dev/null +++ b/externals/grill/flext/tutorial/buffer1/buffer1.dsp @@ -0,0 +1,95 @@ +# Microsoft Developer Studio Project File - Name="buffer1" - Package Owner=<4> +# Microsoft Developer Studio Generated Build File, Format Version 6.00 +# ** NICHT BEARBEITEN ** + +# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102 + +CFG=buffer1 - Win32 Debug +!MESSAGE Dies ist kein gültiges Makefile. Zum Erstellen dieses Projekts mit NMAKE +!MESSAGE verwenden Sie den Befehl "Makefile exportieren" und führen Sie den Befehl +!MESSAGE +!MESSAGE NMAKE /f "buffer1.mak". +!MESSAGE +!MESSAGE Sie können beim Ausführen von NMAKE eine Konfiguration angeben +!MESSAGE durch Definieren des Makros CFG in der Befehlszeile. Zum Beispiel: +!MESSAGE +!MESSAGE NMAKE /f "buffer1.mak" CFG="buffer1 - Win32 Debug" +!MESSAGE +!MESSAGE Für die Konfiguration stehen zur Auswahl: +!MESSAGE +!MESSAGE "buffer1 - Win32 Release" (basierend auf "Win32 (x86) Dynamic-Link Library") +!MESSAGE "buffer1 - Win32 Debug" (basierend auf "Win32 (x86) Dynamic-Link Library") +!MESSAGE + +# Begin Project +# PROP AllowPerConfigDependencies 0 +# PROP Scc_ProjName "max/flext/tutorial/buffer1" +# PROP Scc_LocalPath "." +CPP=cl.exe +MTL=midl.exe +RSC=rc.exe + +!IF "$(CFG)" == "buffer1 - Win32 Release" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "Release" +# PROP BASE Intermediate_Dir "Release" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "msvc" +# PROP Intermediate_Dir "msvc" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /YX /FD /c +# ADD CPP /nologo /W3 /O2 /I "c:\programme\audio\pd\src" /I "..\..\source" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "PD" /YX /FD /c +# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 +# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 +# ADD BASE RSC /l 0xc07 /d "NDEBUG" +# ADD RSC /l 0xc07 /d "NDEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib /nologo /dll /machine:I386 +# ADD LINK32 kernel32.lib user32.lib pd.lib flext-pdwin.lib /nologo /dll /machine:I386 /out:"../pd-msvc/buffer1.dll" /libpath:"..\..\pd-msvc" + +!ELSEIF "$(CFG)" == "buffer1 - Win32 Debug" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "Debug" +# PROP BASE Intermediate_Dir "Debug" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "msvc-debug" +# PROP Intermediate_Dir "msvc-debug" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /YX /FD /GZ /c +# ADD CPP /nologo /W3 /Gm /ZI /Od /I "c:\programme\audio\pd\src" /I "..\..\source" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "PD" /Fr /YX /FD /GZ /c +# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 +# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 +# ADD BASE RSC /l 0xc07 /d "_DEBUG" +# ADD RSC /l 0xc07 /d "_DEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept +# ADD LINK32 kernel32.lib user32.lib pd.lib flext_d-pdwin.lib /nologo /dll /debug /machine:I386 /out:"msvc-debug/buffer1.dll" /pdbtype:sept /libpath:"..\..\pd-msvc" + +!ENDIF + +# Begin Target + +# Name "buffer1 - Win32 Release" +# Name "buffer1 - Win32 Debug" +# Begin Source File + +SOURCE=.\main.cpp +# End Source File +# End Target +# End Project diff --git a/externals/grill/flext/tutorial/buffer1/main.cpp b/externals/grill/flext/tutorial/buffer1/main.cpp new file mode 100755 index 00000000..7f604c87 --- /dev/null +++ b/externals/grill/flext/tutorial/buffer1/main.cpp @@ -0,0 +1,257 @@ +/* +flext tutorial - buffer 1 + +Copyright (c) 2003 Thomas Grill (xovo@gmx.net) +For information on usage and redistribution, and for a DISCLAIMER OF ALL +WARRANTIES, see the file, "license.txt," in this distribution. + +------------------------------------------------------------------------- + +This is an example of a simple object doing some basic buffer operation +*/ + + +// IMPORTANT: enable attribute processing (specify before inclusion of flext headers!) +// For clarity, this is done here, but you'd better specify it as a compiler definition +// FLEXT_ATTRIBUTES must be 0 or 1, +#define FLEXT_ATTRIBUTES 1 + + +// include flext header +#include <flext.h> + +// check for appropriate flext version +#if !defined(FLEXT_VERSION) || (FLEXT_VERSION < 400) +#error You need at least flext version 0.4.0 +#endif + + +// define the class that stands for a pd/Max object + +class buffer1: + // inherit from basic flext class + public flext_base +{ + // obligatory flext header (class name,base class name) featuring a setup function + FLEXT_HEADER_S(buffer1,flext_base,setup) + +public: + // constructor with a variable argument list + buffer1(int argc,const t_atom *argv); + +protected: + const t_symbol *bufname; + buffer *buf; + + // set new buffer (or none if name omitted) + void m_set(int argc,const t_atom *argv); + + // get buffer name + void mg_buf(AtomList &lst) const; + // set buffer name (simply reuse m_set method) + inline void ms_buf(const AtomList &lst) { m_set(lst.Count(),lst.Atoms()); } + + // get buffer channels + inline void mg_chns(int &chns) { chns = Check()?buf->Channels():0; } + + // get buffer length in frames + inline void mg_frames(int &frames) { frames = Check()?buf->Frames():0; } + // set buffer length in frames + inline void ms_frames(int frames) { if(Check()) buf->Frames(frames); } + + // get sample (index channel) + void m_peek(int argc,const t_atom *argv); + // set sample (index value channel) + void m_poke(int argc,const t_atom *argv); + + // delete eventual existing buffer + void Clear(); + + // check and eventually update buffer reference (return true if valid) + bool Check(); + +private: + static void setup(t_classid c); + + FLEXT_CALLBACK_V(m_set) // wrapper for method m_set (with variable argument list) + FLEXT_CALLBACK_V(m_peek) // wrapper for method m_peek (with variable argument list) + FLEXT_CALLBACK_V(m_poke) // wrapper for method m_poke (with variable argument list) + + FLEXT_CALLVAR_V(mg_buf,ms_buf) // wrappers for attribute getter/setter mg_buffer/ms_buffer (with variable argument list) + FLEXT_CALLGET_I(mg_chns) // wrappers for attribute getter mg_chns (with integer arguments) + FLEXT_CALLVAR_I(mg_frames,ms_frames) // wrappers for attribute getter/setter mg_frames/ms_frames (with integer arguments) +}; + +// instantiate the class +FLEXT_NEW_V("buffer1",buffer1) + + +void buffer1::setup(t_classid c) +{ + // register methods and attributes + + FLEXT_CADDMETHOD_(c,0,"set",m_set); // register method "set" for inlet 0 + FLEXT_CADDMETHOD_(c,0,"peek",m_peek); // register method "peek" for inlet 0 + FLEXT_CADDMETHOD_(c,0,"poke",m_poke); // register method "poke" for inlet 0 + + FLEXT_CADDATTR_VAR(c,"buffer",mg_buf,ms_buf); // register attribute "buffer" + FLEXT_CADDATTR_GET(c,"channels",mg_chns); // register attribute "channels" + FLEXT_CADDATTR_VAR(c,"frames",mg_frames,ms_frames); // register attribute "frames" +} + + +buffer1::buffer1(int argc,const t_atom *argv): + // clear buffer + buf(NULL),bufname(NULL) +{ + // define inlets: + // first inlet must always be of type anything (or signal for dsp objects) + AddInAnything("message inlet"); // add one inlet for any message + + // peek outlet + AddOutFloat("peek value outlet"); + + // set buffer according to creation arguments + m_set(argc,argv); +} + + +void buffer1::Clear() +{ + if(buf) { + delete buf; + buf = NULL; bufname = NULL; + } +} + +bool buffer1::Check() +{ + if(!buf || !buf->Valid()) { + post("%s (%s) - no valid buffer defined",thisName(),GetString(thisTag())); + // return zero length + return false; + } + else { + if(buf->Update()) { + // buffer parameters have been updated + if(buf->Valid()) { + post("%s (%s) - updated buffer reference",thisName(),GetString(thisTag())); + return true; + } + else { + post("%s (%s) - buffer has become invalid",thisName(),GetString(thisTag())); + return false; + } + } + else + return true; + } +} + +void buffer1::m_set(int argc,const t_atom *argv) +{ + if(argc == 0) { + // argument list is empty + + // clear existing buffer + Clear(); + } + else if(argc == 1 && IsSymbol(argv[0])) { + // one symbol given as argument + + // clear existing buffer + Clear(); + // save buffer name + bufname = GetSymbol(argv[0]); + // make new reference to system buffer object + buf = new buffer(bufname); + + if(!buf->Ok()) { + post("%s (%s) - warning: buffer is currently not valid!",thisName(),GetString(thisTag())); + } + } + else { + // invalid argument list, leave buffer as is but issue error message to console + post("%s (%s) - message argument must be a symbol (or left blank)",thisName(),GetString(thisTag())); + } +} + +void buffer1::mg_buf(AtomList &lst) const +{ + if(buf) { + // buffer exists: return buffer name + lst(1); SetSymbol(lst[0],bufname); + } + else + // no buffer: set empty list + lst(0); +} + + +void buffer1::m_poke(int argc,const t_atom *argv) +{ + // if buffer is invalid bail out + if(!Check()) return; + + bool ok = true; + int ix,chn = 0; + float val; + + if(argc == 3) { + if(CanbeInt(argv[2])) + // get channel index + chn = GetAInt(argv[2]); + else + ok = false; + } + + if(ok && (argc == 2 || argc == 3) && CanbeInt(argv[0]) && CanbeFloat(argv[1])) { + // get frame index + ix = GetAInt(argv[0]); + // get value + val = GetAFloat(argv[1]); + } + else + ok = false; + + if(ok) { + // correct syntax, set sample + buf->Data()[ix] = val; + } + else + post("%s (%s) - syntax error - use \"poke index value [channel]\"",thisName(),GetString(thisTag())); +} + +void buffer1::m_peek(int argc,const t_atom *argv) +{ + // if buffer is invalid bail out + if(!Check()) return; + + bool ok = true; + int ix,chn = 0; + + if(argc == 2) { + if(CanbeInt(argv[1])) + // get channel index + chn = GetAInt(argv[1]); + else + ok = false; + } + + if(ok && (argc == 1 || argc == 2) && CanbeInt(argv[0])) { + // get frame index + ix = GetAInt(argv[0]); + } + else + ok = false; + + if(ok) + // correct syntax, output value + ToOutFloat(0,buf->Data()[ix]); + else + post("%s (%s) - syntax error - use \"peek index [channel]\"",thisName(),GetString(thisTag())); +} + + + + diff --git a/externals/grill/flext/tutorial/simple1/main.cpp b/externals/grill/flext/tutorial/simple1/main.cpp index 6099a792..9f0f43e8 100755 --- a/externals/grill/flext/tutorial/simple1/main.cpp +++ b/externals/grill/flext/tutorial/simple1/main.cpp @@ -48,7 +48,7 @@ FLEXT_NEW("simple1",simple1) simple1::simple1() { // define inlets: - // first inlet must always by of type anything (or signal for dsp objects) + // first inlet must always be of type anything (or signal for dsp objects) AddInAnything(); // add one inlet for any message // define outlets: diff --git a/externals/grill/flext/tutorial/simple1/simple1.cw b/externals/grill/flext/tutorial/simple1/simple1.cw Binary files differindex e6b451be..6e778ba5 100755 --- a/externals/grill/flext/tutorial/simple1/simple1.cw +++ b/externals/grill/flext/tutorial/simple1/simple1.cw |