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/flext/tutorial/bind1 | |
parent | d97d46e2806969c994647ee8e3ce64b4f3d1d9f6 (diff) |
""
svn path=/trunk/; revision=687
Diffstat (limited to 'externals/grill/flext/tutorial/bind1')
-rwxr-xr-x | externals/grill/flext/tutorial/bind1/bind1.cw | bin | 0 -> 148873 bytes | |||
-rwxr-xr-x | externals/grill/flext/tutorial/bind1/bind1.dsp | 95 | ||||
-rwxr-xr-x | externals/grill/flext/tutorial/bind1/main.cpp | 146 |
3 files changed, 241 insertions, 0 deletions
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); +} + + |