diff options
Diffstat (limited to 'externals/grill/flext/tutorial/stk2')
-rw-r--r-- | externals/grill/flext/tutorial/stk2/main.cpp | 109 | ||||
-rw-r--r-- | externals/grill/flext/tutorial/stk2/stk2.dsp | 95 |
2 files changed, 204 insertions, 0 deletions
diff --git a/externals/grill/flext/tutorial/stk2/main.cpp b/externals/grill/flext/tutorial/stk2/main.cpp new file mode 100644 index 00000000..5d6cb72c --- /dev/null +++ b/externals/grill/flext/tutorial/stk2/main.cpp @@ -0,0 +1,109 @@ +/* +flext tutorial - stk 2 + +Copyright (c) 2002,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 external using the STK ("synthesis toolkit") library. +For STK see http://ccrma-www.stanford.edu/software/stk + +STK needs C++ exceptions switched on. + +The STK tutorial examples assume that a static stk library exists which contains all the +source files (except rt*.cpp) of the stk/src directory. +The library should be compiled multithreaded and with the appropriate compiler flags for +the respective platform (e.g. __OS_WINDOWS__ and __LITTLE_ENDIAN__ for Windows) + +*/ + +#include <flstk.h> + +#if !defined(FLEXT_VERSION) || (FLEXT_VERSION < 401) +#error You need at least flext version 0.4.1 +#endif + +#include "PitShift.h" + + +class stk2: + public flext_stk +{ + FLEXT_HEADER_S(stk2,flext_stk,Setup) + +public: + stk2(); + + void m_sh1(float f) { if(inst[0]) inst[0]->setShift(f); } + void m_sh2(float f) { if(inst[1]) inst[1]->setShift(f); } + + // these are obligatory! + virtual bool NewObjs(); // create STK instruments + virtual void FreeObjs(); // destroy STK instruments + virtual void ProcessObjs(int n); // do DSP processing + + PitShift *inst[2]; + +private: + static void Setup(t_class *c); + + FLEXT_CALLBACK_F(m_sh1) + FLEXT_CALLBACK_F(m_sh2) +}; + +FLEXT_NEW_DSP("stk2~",stk2) + + +stk2::stk2() +{ + AddInSignal(); + AddOutSignal(2); + + inst[0] = inst[1] = NULL; +} + +void stk2::Setup(t_class *c) +{ + FLEXT_CADDMETHOD_F(c,0,"shL",m_sh1); + FLEXT_CADDMETHOD_F(c,0,"shR",m_sh2); +} + + +// create STK instruments +bool stk2::NewObjs() +{ + bool ok = true; + + // set up objects + try { + for(int i = 0; i < 2; ++i) + inst[i] = new PitShift; + } + catch (StkError &) { + post("%s - Noise() setup failed!",thisName()); + ok = false; + } + return ok; +} + + +// destroy the STK instruments +void stk2::FreeObjs() +{ + for(int i = 0; i < 2; ++i) + if(inst[i]) delete inst[i]; +} + +// this is called on every DSP block +void stk2::ProcessObjs(int n) +{ + while(n--) { + MY_FLOAT f = Inlet(0).tick(); + for(int i = 0; i < 2; ++i) + Outlet(i).tick(inst[i]->tick(f)); + } +} + + diff --git a/externals/grill/flext/tutorial/stk2/stk2.dsp b/externals/grill/flext/tutorial/stk2/stk2.dsp new file mode 100644 index 00000000..8ace2bf9 --- /dev/null +++ b/externals/grill/flext/tutorial/stk2/stk2.dsp @@ -0,0 +1,95 @@ +# Microsoft Developer Studio Project File - Name="stk2" - Package Owner=<4> +# Microsoft Developer Studio Generated Build File, Format Version 6.00 +# ** NICHT BEARBEITEN ** + +# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102 + +CFG=stk2 - 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 "stk2.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 "stk2.mak" CFG="stk2 - Win32 Debug" +!MESSAGE +!MESSAGE Für die Konfiguration stehen zur Auswahl: +!MESSAGE +!MESSAGE "stk2 - Win32 Release" (basierend auf "Win32 (x86) Dynamic-Link Library") +!MESSAGE "stk2 - Win32 Debug" (basierend auf "Win32 (x86) Dynamic-Link Library") +!MESSAGE + +# Begin Project +# PROP AllowPerConfigDependencies 0 +# PROP Scc_ProjName "stk2" +# PROP Scc_LocalPath "." +CPP=cl.exe +MTL=midl.exe +RSC=rc.exe + +!IF "$(CFG)" == "stk2 - 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 /MT /W3 /GX /O2 /I "..\..\source" /I "f:\prog\packs\sndobj\include" /I "f:\prog\packs\stk\include" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "PD" /D "FLEXT_THREADS" /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 pthreadVC.lib flext_t-pdwin.lib stk.lib /nologo /dll /machine:I386 /out:"../pd-msvc/stk2~.dll" /libpath:"..\..\pd-msvc" /libpath:"f:\prog\packs\stk\lib" + +!ELSEIF "$(CFG)" == "stk2 - 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 /MTd /W3 /Gm /GX /ZI /Od /I "..\..\source" /I "f:\prog\packs\sndobj\include" /I "f:\prog\packs\stk\include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "PD" /D "FLEXT_THREADS" /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 pthreadVC.lib flext_td-pdwin.lib stk_d.lib /nologo /dll /debug /machine:I386 /out:"msvc-debug/stk2~.dll" /pdbtype:sept /libpath:"..\..\pd-msvc" /libpath:"f:\prog\packs\stk\lib" + +!ENDIF + +# Begin Target + +# Name "stk2 - Win32 Release" +# Name "stk2 - Win32 Debug" +# Begin Source File + +SOURCE=.\main.cpp +# End Source File +# End Target +# End Project |