From 0e2151f42d9f0f5a4a25cf8bb90316a16a09191d Mon Sep 17 00:00:00 2001 From: Thomas Grill Date: Mon, 6 Jan 2003 04:32:24 +0000 Subject: "" svn path=/trunk/; revision=323 --- externals/grill/flext/examples/examples.dsw | 33 +++++++ externals/grill/flext/examples/pd/ex-henon.pd | 87 +++++++++++++++++ externals/grill/flext/examples/source/henon.cpp | 121 ++++++++++++++++++++++++ externals/grill/flext/examples/source/henon.cw | Bin 0 -> 101183 bytes externals/grill/flext/examples/source/henon.dsp | 95 +++++++++++++++++++ 5 files changed, 336 insertions(+) create mode 100644 externals/grill/flext/examples/examples.dsw create mode 100644 externals/grill/flext/examples/pd/ex-henon.pd create mode 100644 externals/grill/flext/examples/source/henon.cpp create mode 100644 externals/grill/flext/examples/source/henon.cw create mode 100644 externals/grill/flext/examples/source/henon.dsp (limited to 'externals/grill/flext/examples') diff --git a/externals/grill/flext/examples/examples.dsw b/externals/grill/flext/examples/examples.dsw new file mode 100644 index 00000000..6f52bde2 --- /dev/null +++ b/externals/grill/flext/examples/examples.dsw @@ -0,0 +1,33 @@ +Microsoft Developer Studio Workspace File, Format Version 6.00 +# WARNUNG: DIESE ARBEITSBEREICHSDATEI DARF NICHT BEARBEITET ODER GELÖSCHT WERDEN! + +############################################################################### + +Project: "henon"=.\source\henon.dsp - Package Owner=<4> + +Package=<5> +{{{ + begin source code control + max/flext/examples/source + .\source + end source code control +}}} + +Package=<4> +{{{ +}}} + +############################################################################### + +Global: + +Package=<5> +{{{ +}}} + +Package=<3> +{{{ +}}} + +############################################################################### + diff --git a/externals/grill/flext/examples/pd/ex-henon.pd b/externals/grill/flext/examples/pd/ex-henon.pd new file mode 100644 index 00000000..a70ec540 --- /dev/null +++ b/externals/grill/flext/examples/pd/ex-henon.pd @@ -0,0 +1,87 @@ +#N canvas 412 48 465 467 12; +#X obj 18 43 bng 25 250 50 0 empty empty reset 0 -10 0 14 -261689 -1 +-1; +#X obj 99 44 bng 25 250 50 0 empty empty trigger 0 -10 0 14 -261689 +-1 -1; +#X obj 206 43 nbx 4 18 0 1 0 1 empty empty pre-alpha 0 -10 0 14 -225271 +-1 -1 0.75 256; +#X obj 322 44 nbx 4 18 0 1 0 1 empty empty pre-beta 0 -10 0 14 -225271 +-1 -1 0.41 256; +#X obj 60 264 nbx 5 18 -1e+037 1e+037 0 0 empty empty result 0 -10 +0 14 -228992 -1 -1 0 256; +#N canvas 0 0 458 522 henon 0; +#X text 115 130 x; +#X text 190 129 y; +#X obj 157 166 *; +#X obj 47 158 t f f; +#X obj 48 189 *; +#X obj 77 215 *; +#X obj 130 248 +; +#X obj 113 281 + 1; +#X obj 85 131 f 0; +#X obj 158 130 f 0; +#X obj 33 23 inlet; +#X obj 263 27 inlet; +#X obj 368 28 inlet; +#X text 264 7 alpha; +#X text 373 7 beta; +#X text 28 5 commands; +#X obj 31 50 route reset bang; +#X obj 112 445 outlet; +#X obj 100 86 t b b; +#X obj 31 76 t 0; +#X obj 241 55 * 1.5; +#X obj 241 80 - 2.5; +#X obj 361 55 - 0.5; +#X obj 114 342 + 1; +#X obj 114 369 / 2; +#X obj 113 394 max 0; +#X obj 113 418 min 1; +#X connect 2 0 6 1; +#X connect 3 0 4 0; +#X connect 3 1 4 1; +#X connect 4 0 5 0; +#X connect 5 0 6 0; +#X connect 6 0 7 0; +#X connect 7 0 8 1; +#X connect 7 0 23 0; +#X connect 8 0 3 0; +#X connect 8 0 9 1; +#X connect 9 0 2 0; +#X connect 10 0 16 0; +#X connect 11 0 20 0; +#X connect 12 0 22 0; +#X connect 16 0 19 0; +#X connect 16 1 18 0; +#X connect 18 0 8 0; +#X connect 18 1 9 0; +#X connect 19 0 8 1; +#X connect 19 0 9 1; +#X connect 20 0 21 0; +#X connect 21 0 5 1; +#X connect 22 0 2 1; +#X connect 23 0 24 0; +#X connect 24 0 25 0; +#X connect 25 0 26 0; +#X connect 26 0 17 0; +#X restore 60 208 pd henon; +#X msg 18 77 reset; +#X obj 294 201 henon; +#X obj 292 259 nbx 5 18 -1e+037 1e+037 0 0 empty empty result 0 -10 +0 14 -228992 -1 -1 0 256; +#X text 17 331 alpha and beta can also be initialized; +#X text 18 350 at creation time; +#X obj 45 426 henon @alpha 0.7 @beta 0.2; +#X text 15 403 or \, using attributes; +#X obj 45 377 henon 0.7 0.2; +#X connect 0 0 6 0; +#X connect 1 0 5 0; +#X connect 1 0 7 0; +#X connect 2 0 7 1; +#X connect 2 0 5 1; +#X connect 3 0 7 2; +#X connect 3 0 5 2; +#X connect 5 0 4 0; +#X connect 6 0 5 0; +#X connect 6 0 7 0; +#X connect 7 0 8 0; diff --git a/externals/grill/flext/examples/source/henon.cpp b/externals/grill/flext/examples/source/henon.cpp new file mode 100644 index 00000000..39d446eb --- /dev/null +++ b/externals/grill/flext/examples/source/henon.cpp @@ -0,0 +1,121 @@ +/* +flext examples - henon + +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 a simple external featuring the chaotic Henon attractor. + +See also http://improv.sapp.org/doc/examples/synthImprov/henontune/henontune.html +Thanks to David Casal for the pointer! + +*/ + +// 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 + +// check for appropriate flext version +#if !defined(FLEXT_VERSION) || (FLEXT_VERSION < 401) +#error You need at least flext version 0.4.1 +#endif + + +class henon: + public flext_base +{ + FLEXT_HEADER_S(henon,flext_base,Setup) + +public: + // constructor + henon(int argc,const t_atom *argv); + +protected: + void m_bang(); + void m_reset() { x = y = 0; } + + void m_alpha(float a) { alpha = a; } + void m_beta(float b) { beta = b; } + + float alpha,beta; + float x,y; + +private: + static void Setup(t_classid c); + + // method callbacks + FLEXT_CALLBACK(m_reset) + FLEXT_CALLBACK(m_bang) + FLEXT_CALLBACK_F(m_alpha) + FLEXT_CALLBACK_F(m_beta) + + // define attribute callbacks for variables alpha and beta (with GET and SET properties) + FLEXT_ATTRVAR_F(alpha) + FLEXT_ATTRVAR_F(beta) +}; + +// instantiate the class +FLEXT_NEW_V("henon",henon) + + +henon::henon(int argc,const t_atom *argv): + alpha(0),beta(0),x(0),y(0) // initializations +{ + // define inlets + AddInAnything("reset,bang,..."); + AddInFloat("alpha"); + AddInFloat("beta"); + + // define outlets + AddOutFloat(); + + // processing command line + if(argc == 2 && CanbeFloat(argv[0]) && CanbeFloat(argv[1])) { + // two float args + alpha = GetAFloat(argv[0]); + beta = GetAFloat(argv[1]); + } +} + +void henon::Setup(t_classid c) +{ + // register methods + FLEXT_CADDBANG(c,0,m_bang); + FLEXT_CADDMETHOD_(c,0,"reset",m_reset); + + FLEXT_CADDMETHOD(c,1,m_alpha); + FLEXT_CADDMETHOD(c,2,m_beta); + + // register attributes + FLEXT_CADDATTR_VAR1(c,"alpha",alpha); // register attribute "alpha" + FLEXT_CADDATTR_VAR1(c,"beta",beta); // register attribute "beta" +} + +// Trigger output +void henon::m_bang() +{ + float _alpha_ = alpha*1.5f-2.5f; + float _beta_ = beta-0.5f; + + float newx = 1 + _alpha_ * x * x + _beta_ * y; + float newy = x; + x = newx; + y = newy; + + float output = (x + 1.0f)/2.0f; + if(output < 0) + output = 0; + else if(output > 1) + output = 1; + + // output value to outlet + ToOutFloat(0,output); // (0 stands for the outlet index 0) +} diff --git a/externals/grill/flext/examples/source/henon.cw b/externals/grill/flext/examples/source/henon.cw new file mode 100644 index 00000000..cf880938 Binary files /dev/null and b/externals/grill/flext/examples/source/henon.cw differ diff --git a/externals/grill/flext/examples/source/henon.dsp b/externals/grill/flext/examples/source/henon.dsp new file mode 100644 index 00000000..24cbdfcf --- /dev/null +++ b/externals/grill/flext/examples/source/henon.dsp @@ -0,0 +1,95 @@ +# Microsoft Developer Studio Project File - Name="henon" - Package Owner=<4> +# Microsoft Developer Studio Generated Build File, Format Version 6.00 +# ** NICHT BEARBEITEN ** + +# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102 + +CFG=henon - 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 "henon.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 "henon.mak" CFG="henon - Win32 Debug" +!MESSAGE +!MESSAGE Für die Konfiguration stehen zur Auswahl: +!MESSAGE +!MESSAGE "henon - Win32 Release" (basierend auf "Win32 (x86) Dynamic-Link Library") +!MESSAGE "henon - Win32 Debug" (basierend auf "Win32 (x86) Dynamic-Link Library") +!MESSAGE + +# Begin Project +# PROP AllowPerConfigDependencies 0 +# PROP Scc_ProjName "henon" +# PROP Scc_LocalPath "." +CPP=cl.exe +MTL=midl.exe +RSC=rc.exe + +!IF "$(CFG)" == "henon - 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 "..\..\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/henon.dll" /libpath:"..\..\pd-msvc" + +!ELSEIF "$(CFG)" == "henon - 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 "..\..\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 /pdbtype:sept /libpath:"..\..\pd-msvc" + +!ENDIF + +# Begin Target + +# Name "henon - Win32 Release" +# Name "henon - Win32 Debug" +# Begin Source File + +SOURCE=.\henon.cpp +# End Source File +# End Target +# End Project -- cgit v1.2.1