diff options
author | Thomas Grill <xovo@users.sourceforge.net> | 2003-03-03 07:57:50 +0000 |
---|---|---|
committer | Thomas Grill <xovo@users.sourceforge.net> | 2003-03-03 07:57:50 +0000 |
commit | c3ae6e7ab08db709ffa1975eea70bfc9461f1d6a (patch) | |
tree | 04f0076fb51a1ed9ff22b16385e07a4105bb34c3 /externals/grill/flext/tutorial/timer1 | |
parent | fe9b0d819d5478fa8256a612f3ba7de44894baf5 (diff) |
""
svn path=/trunk/; revision=448
Diffstat (limited to 'externals/grill/flext/tutorial/timer1')
-rwxr-xr-x | externals/grill/flext/tutorial/timer1/main.cpp | 100 | ||||
-rwxr-xr-x | externals/grill/flext/tutorial/timer1/timer1.cw | bin | 0 -> 207765 bytes | |||
-rwxr-xr-x | externals/grill/flext/tutorial/timer1/timer1.dsp | 95 |
3 files changed, 195 insertions, 0 deletions
diff --git a/externals/grill/flext/tutorial/timer1/main.cpp b/externals/grill/flext/tutorial/timer1/main.cpp new file mode 100755 index 00000000..6388eb4a --- /dev/null +++ b/externals/grill/flext/tutorial/timer1/main.cpp @@ -0,0 +1,100 @@ +/* +flext tutorial - timer 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 an object using timers +*/ + +// enable flext attributes +#define FLEXT_ATTRIBUTES 1 + +// include flext header +#include <flext.h> + +// check for appropriate flext version +#if !defined(FLEXT_VERSION) || (FLEXT_VERSION < 403) +#error You need at least flext version 0.4.3 +#endif + + +// define the class that stands for a pd/Max object + +class timer1: + // inherit from basic flext class + public flext_base +{ + // obligatory flext header (class name,base class name) + FLEXT_HEADER_S(timer1,flext_base,Setup) + +public: + // constructor + timer1(); + +protected: + // timers + Timer tmrA,tmrB; + + void m_getostime(float &f) { f = GetOSTime(); } // method for operating system time attribute + void m_getrttime(float &f) { f = GetTime(); } // method for real-time system time attribute + + void m_timerA(void *) { ToOutString(0,"Timer A"); } // timer A method + void m_timerB(void *) { ToOutString(0,"Timer B"); } // timer B method + + void m_resetA() { tmrA.Reset(); } // timer A reset + void m_resetB() { tmrB.Reset(); } // timer B reset + void m_oneshotA(int del) { tmrA.Delay(del*0.001); } // timer A one shot + void m_oneshotB(int del) { tmrB.Delay(del*0.001); } // timer B one shot + void m_periodicA(int del) { tmrA.Periodic(del*0.001); } // timer A periodic + void m_periodicB(int del) { tmrB.Periodic(del*0.001); } // timer B periodic + +private: + static void Setup(t_classid c); + + // register timer callbacks + FLEXT_CALLBACK_T(m_timerA) + FLEXT_CALLBACK_T(m_timerB) + + // register method callbacks + FLEXT_CALLGET_F(m_getostime) + FLEXT_CALLGET_F(m_getrttime) + FLEXT_CALLBACK(m_resetA) + FLEXT_CALLBACK(m_resetB) + FLEXT_CALLBACK_I(m_oneshotA) + FLEXT_CALLBACK_I(m_oneshotB) + FLEXT_CALLBACK_I(m_periodicA) + FLEXT_CALLBACK_I(m_periodicB) +}; + +// instantiate the class +FLEXT_NEW("timer1",timer1) + +// class setup function +void timer1::Setup(t_classid c) +{ + FLEXT_CADDATTR_GET(c,"ostime",m_getostime); // register attribute for OS time + FLEXT_CADDATTR_GET(c,"time",m_getrttime); // register attribute for RT time + + FLEXT_CADDMETHOD_(c,0,"resetA",m_resetA); // register reset method for timer A + FLEXT_CADDMETHOD_(c,0,"resetB",m_resetB); // register reset method for timer B + FLEXT_CADDMETHOD_(c,0,"oneshotA",m_oneshotA); // register one shot method for timer A + FLEXT_CADDMETHOD_(c,0,"oneshotB",m_oneshotB); // register one shot method for timer B + FLEXT_CADDMETHOD_(c,0,"periodicA",m_periodicA); // register periodic method for timer A + FLEXT_CADDMETHOD_(c,0,"periodicB",m_periodicB); // register periodic method for timer B +} + +// class constructor +timer1::timer1(): + tmrA(false),tmrB(false) +{ + AddInAnything("Control timers"); // add inlet for control commands + AddOutAnything("Timer output"); // add outlet for timer output + + // register methods + FLEXT_ADDTIMER(tmrA,m_timerA); // register method "m_timerA" for timer A + FLEXT_ADDTIMER(tmrB,m_timerB); // register method "m_timerB" for timer B +} diff --git a/externals/grill/flext/tutorial/timer1/timer1.cw b/externals/grill/flext/tutorial/timer1/timer1.cw Binary files differnew file mode 100755 index 00000000..08e05996 --- /dev/null +++ b/externals/grill/flext/tutorial/timer1/timer1.cw diff --git a/externals/grill/flext/tutorial/timer1/timer1.dsp b/externals/grill/flext/tutorial/timer1/timer1.dsp new file mode 100755 index 00000000..35716adc --- /dev/null +++ b/externals/grill/flext/tutorial/timer1/timer1.dsp @@ -0,0 +1,95 @@ +# Microsoft Developer Studio Project File - Name="simple1" - Package Owner=<4> +# Microsoft Developer Studio Generated Build File, Format Version 6.00 +# ** NICHT BEARBEITEN ** + +# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102 + +CFG=simple1 - 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 "simple1.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 "simple1.mak" CFG="simple1 - Win32 Debug" +!MESSAGE +!MESSAGE Für die Konfiguration stehen zur Auswahl: +!MESSAGE +!MESSAGE "simple1 - Win32 Release" (basierend auf "Win32 (x86) Dynamic-Link Library") +!MESSAGE "simple1 - Win32 Debug" (basierend auf "Win32 (x86) Dynamic-Link Library") +!MESSAGE + +# Begin Project +# PROP AllowPerConfigDependencies 0 +# PROP Scc_ProjName "simple1" +# PROP Scc_LocalPath "." +CPP=cl.exe +MTL=midl.exe +RSC=rc.exe + +!IF "$(CFG)" == "simple1 - 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/simple1.dll" /libpath:"..\..\pd-msvc" + +!ELSEIF "$(CFG)" == "simple1 - 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 "simple1 - Win32 Release" +# Name "simple1 - Win32 Debug" +# Begin Source File + +SOURCE=.\main.cpp +# End Source File +# End Target +# End Project |