aboutsummaryrefslogtreecommitdiff
path: root/externals/grill/flext/tutorial/sndobj1
diff options
context:
space:
mode:
authorThomas Grill <xovo@users.sourceforge.net>2003-01-02 04:37:31 +0000
committerThomas Grill <xovo@users.sourceforge.net>2003-01-02 04:37:31 +0000
commit10e0265429983876e2fd69950df4d51c8faf5635 (patch)
tree3e1c45e40bedd1b92225696ce955b902c4daf8e0 /externals/grill/flext/tutorial/sndobj1
parent59e66762250fe61d570c5baf6c9ce6896a09e027 (diff)
""
svn path=/trunk/; revision=316
Diffstat (limited to 'externals/grill/flext/tutorial/sndobj1')
-rw-r--r--externals/grill/flext/tutorial/sndobj1/main.cpp30
1 files changed, 18 insertions, 12 deletions
diff --git a/externals/grill/flext/tutorial/sndobj1/main.cpp b/externals/grill/flext/tutorial/sndobj1/main.cpp
index 7e6c7663..2a339ee6 100644
--- a/externals/grill/flext/tutorial/sndobj1/main.cpp
+++ b/externals/grill/flext/tutorial/sndobj1/main.cpp
@@ -1,7 +1,7 @@
/*
flext tutorial - sndobj 1
-Copyright (c) 2002 Thomas Grill (xovo@gmx.net)
+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.
@@ -10,7 +10,9 @@ WARRANTIES, see the file, "license.txt," in this distribution.
This is an example of an external using the SndObj library.
See http://www.may.ie/academic/music/musictec/SndObj/
-This object shows simple stereo pitch shifting.
+The SndObj library should be compiled multithreaded.
+
+This external features simple stereo pitch shifting.
*/
@@ -26,15 +28,13 @@ This object shows simple stereo pitch shifting.
class sndobj1:
public flext_sndobj
{
- FLEXT_HEADER(sndobj1,flext_sndobj)
+ FLEXT_HEADER_S(sndobj1,flext_sndobj,Setup)
public:
sndobj1();
-protected:
-
// these are obligatory!
- virtual void NewObjs();
+ virtual bool NewObjs();
virtual void FreeObjs();
virtual void ProcessObjs();
@@ -43,6 +43,9 @@ protected:
float sh1,sh2;
+private:
+ static void Setup(t_class *c);
+
FLEXT_ATTRVAR_F(sh1)
FLEXT_ATTRVAR_F(sh2)
};
@@ -51,23 +54,26 @@ FLEXT_NEW_DSP("sndobj1~",sndobj1)
sndobj1::sndobj1():
- sh1(1),sh2(1)
+ sh1(1),sh2(1),
+ obj1(NULL),obj2(NULL)
{
AddInSignal(2); // audio ins
AddOutSignal(2); // audio outs
+}
- obj1 = obj2 = NULL;
-
- FLEXT_ADDATTR_VAR1("shL",sh1);
- FLEXT_ADDATTR_VAR1("shR",sh2);
+void sndobj1::Setup(t_class *c)
+{
+ FLEXT_CADDATTR_VAR1(c,"shL",sh1);
+ FLEXT_CADDATTR_VAR1(c,"shR",sh2);
}
// construct needed SndObjs
-void sndobj1::NewObjs()
+bool sndobj1::NewObjs()
{
// set up objects
obj1 = new Pitch(.1f,&InObj(0),sh1,Blocksize(),Samplerate());
obj2 = new Pitch(.1f,&InObj(1),sh2,Blocksize(),Samplerate());
+ return true;
}
// destroy the SndObjs