diff options
Diffstat (limited to 'externals/grill/flext/tutorial')
-rwxr-xr-x | externals/grill/flext/tutorial/bind1/main.cpp | 144 | ||||
-rwxr-xr-x | externals/grill/flext/tutorial/maxmsp/ex-adv1.pat (renamed from externals/grill/flext/tutorial/maxmsp/ex-adv1) | bin | 540 -> 540 bytes | |||
-rwxr-xr-x | externals/grill/flext/tutorial/maxmsp/ex-adv2.pat (renamed from externals/grill/flext/tutorial/maxmsp/ex-adv2) | bin | 726 -> 726 bytes | |||
-rwxr-xr-x | externals/grill/flext/tutorial/maxmsp/ex-adv3.pat (renamed from externals/grill/flext/tutorial/maxmsp/ex-adv3) | bin | 801 -> 801 bytes | |||
-rwxr-xr-x | externals/grill/flext/tutorial/maxmsp/ex-attr1.pat (renamed from externals/grill/flext/tutorial/maxmsp/ex-attr1) | bin | 1050 -> 1050 bytes | |||
-rwxr-xr-x | externals/grill/flext/tutorial/maxmsp/ex-attr2.pat (renamed from externals/grill/flext/tutorial/maxmsp/ex-attr2) | bin | 1389 -> 1389 bytes | |||
-rwxr-xr-x | externals/grill/flext/tutorial/maxmsp/ex-attr3.pat (renamed from externals/grill/flext/tutorial/maxmsp/ex-attr3) | bin | 1358 -> 1358 bytes | |||
-rwxr-xr-x | externals/grill/flext/tutorial/maxmsp/ex-lib1.pat (renamed from externals/grill/flext/tutorial/maxmsp/ex-lib1) | bin | 1440 -> 1440 bytes | |||
-rwxr-xr-x | externals/grill/flext/tutorial/maxmsp/ex-signal1.pat (renamed from externals/grill/flext/tutorial/maxmsp/ex-signal1) | bin | 740 -> 740 bytes | |||
-rwxr-xr-x | externals/grill/flext/tutorial/maxmsp/ex-signal2.pat (renamed from externals/grill/flext/tutorial/maxmsp/ex-signal2) | bin | 708 -> 708 bytes | |||
-rwxr-xr-x | externals/grill/flext/tutorial/maxmsp/ex-simple1.pat (renamed from externals/grill/flext/tutorial/maxmsp/ex-simple1) | bin | 725 -> 725 bytes | |||
-rwxr-xr-x | externals/grill/flext/tutorial/maxmsp/ex-simple2.pat (renamed from externals/grill/flext/tutorial/maxmsp/ex-simple2) | bin | 668 -> 668 bytes | |||
-rwxr-xr-x | externals/grill/flext/tutorial/maxmsp/ex-simple3.pat (renamed from externals/grill/flext/tutorial/maxmsp/ex-simple3) | bin | 662 -> 662 bytes | |||
-rwxr-xr-x | externals/grill/flext/tutorial/maxmsp/ex-thread1.pat (renamed from externals/grill/flext/tutorial/maxmsp/ex-thread1) | bin | 1004 -> 1004 bytes | |||
-rwxr-xr-x | externals/grill/flext/tutorial/maxmsp/ex-thread2.pat (renamed from externals/grill/flext/tutorial/maxmsp/ex-thread2) | bin | 874 -> 874 bytes | |||
-rwxr-xr-x | externals/grill/flext/tutorial/maxmsp/ex-timer1.pat (renamed from externals/grill/flext/tutorial/maxmsp/ex-timer1) | bin | 1247 -> 1247 bytes | |||
-rw-r--r-- | externals/grill/flext/tutorial/pd/ex-signal1.pd | 50 | ||||
-rw-r--r-- | externals/grill/flext/tutorial/pd/ex-signal2.pd | 50 | ||||
-rw-r--r-- | externals/grill/flext/tutorial/pd/ex-simple1.pd | 8 | ||||
-rw-r--r-- | externals/grill/flext/tutorial/pd/ex-stk2.pd | 8 | ||||
-rw-r--r-- | externals/grill/flext/tutorial/pd/ex-thread1.pd | 22 | ||||
-rwxr-xr-x | externals/grill/flext/tutorial/simple1/main.cpp | 59 |
22 files changed, 160 insertions, 181 deletions
diff --git a/externals/grill/flext/tutorial/bind1/main.cpp b/externals/grill/flext/tutorial/bind1/main.cpp index 2532556a..debfa68a 100755 --- a/externals/grill/flext/tutorial/bind1/main.cpp +++ b/externals/grill/flext/tutorial/bind1/main.cpp @@ -31,11 +31,19 @@ class bind1: public: // constructor with no arguments - 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 + } /* - no constructor necessary here: - flext frees all eventually still bound symbols when the object is destroyed + no destructor necessary here: + flext frees all eventually remaining bound symbols when the object is destroyed (but NOT the data that can be passed via the FLEXT_BINDMETHOD call!) */ @@ -44,25 +52,69 @@ protected: buffer *buf; // bind object - void m_bind(const t_symbol *s); + void m_bind(const t_symbol *s) + { + if(!Bind(s)) { + post("%s (%s) - Binding failed",thisName(),GetString(thisTag())); + } + } + // unbind object - void m_unbind(const t_symbol *s); + void m_unbind(const t_symbol *s) + { + if(!Unbind(s)) { + post("%s (%s) - Binding failed",thisName(),GetString(thisTag())); + } + } + // bind method - void m_bindmethod(const t_symbol *s); + void m_bindmethod(const t_symbol *s) + { + if(!FLEXT_BINDMETHOD(s,m_bound,NULL)) { + post("%s (%s) - Binding failed",thisName(),GetString(thisTag())); + } + } + // unbind method - void m_unbindmethod(const t_symbol *s); + void m_unbindmethod(const t_symbol *s) + { + if(!FLEXT_UNBINDMETHOD(s)) { + post("%s (%s) - Binding failed",thisName(),GetString(thisTag())); + } + } // forward message - void m_forward(const t_symbol *s,int argc,const t_atom *argv); + void m_forward(const t_symbol *s,int argc,const t_atom *argv) + { + Forward(s,argc,argv); + } // method for symbol-bound messages - void m_bound(const t_symbol *sym,int argc,const t_atom *argv,void *data); + void m_bound(const t_symbol *sym,int argc,const t_atom *argv,void *data) + { + ToOutAnything(0,sym,argc,argv); + } // method for binding test - void m_test(float value); + void m_test(float value) + { + post("%s - TEST METHOD: value %f",thisName(),value); + } private: - static void setup(t_classid c); + static void 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 + } 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) @@ -79,74 +131,4 @@ private: 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); -} - diff --git a/externals/grill/flext/tutorial/maxmsp/ex-adv1 b/externals/grill/flext/tutorial/maxmsp/ex-adv1.pat Binary files differindex f086ab57..f086ab57 100755 --- a/externals/grill/flext/tutorial/maxmsp/ex-adv1 +++ b/externals/grill/flext/tutorial/maxmsp/ex-adv1.pat diff --git a/externals/grill/flext/tutorial/maxmsp/ex-adv2 b/externals/grill/flext/tutorial/maxmsp/ex-adv2.pat Binary files differindex b6aa0065..b6aa0065 100755 --- a/externals/grill/flext/tutorial/maxmsp/ex-adv2 +++ b/externals/grill/flext/tutorial/maxmsp/ex-adv2.pat diff --git a/externals/grill/flext/tutorial/maxmsp/ex-adv3 b/externals/grill/flext/tutorial/maxmsp/ex-adv3.pat Binary files differindex 1f041257..1f041257 100755 --- a/externals/grill/flext/tutorial/maxmsp/ex-adv3 +++ b/externals/grill/flext/tutorial/maxmsp/ex-adv3.pat diff --git a/externals/grill/flext/tutorial/maxmsp/ex-attr1 b/externals/grill/flext/tutorial/maxmsp/ex-attr1.pat Binary files differindex 5dc46f10..5dc46f10 100755 --- a/externals/grill/flext/tutorial/maxmsp/ex-attr1 +++ b/externals/grill/flext/tutorial/maxmsp/ex-attr1.pat diff --git a/externals/grill/flext/tutorial/maxmsp/ex-attr2 b/externals/grill/flext/tutorial/maxmsp/ex-attr2.pat Binary files differindex aab02c92..aab02c92 100755 --- a/externals/grill/flext/tutorial/maxmsp/ex-attr2 +++ b/externals/grill/flext/tutorial/maxmsp/ex-attr2.pat diff --git a/externals/grill/flext/tutorial/maxmsp/ex-attr3 b/externals/grill/flext/tutorial/maxmsp/ex-attr3.pat Binary files differindex 7ef7292f..7ef7292f 100755 --- a/externals/grill/flext/tutorial/maxmsp/ex-attr3 +++ b/externals/grill/flext/tutorial/maxmsp/ex-attr3.pat diff --git a/externals/grill/flext/tutorial/maxmsp/ex-lib1 b/externals/grill/flext/tutorial/maxmsp/ex-lib1.pat Binary files differindex 26f65f2b..26f65f2b 100755 --- a/externals/grill/flext/tutorial/maxmsp/ex-lib1 +++ b/externals/grill/flext/tutorial/maxmsp/ex-lib1.pat diff --git a/externals/grill/flext/tutorial/maxmsp/ex-signal1 b/externals/grill/flext/tutorial/maxmsp/ex-signal1.pat Binary files differindex aa50e2e3..aa50e2e3 100755 --- a/externals/grill/flext/tutorial/maxmsp/ex-signal1 +++ b/externals/grill/flext/tutorial/maxmsp/ex-signal1.pat diff --git a/externals/grill/flext/tutorial/maxmsp/ex-signal2 b/externals/grill/flext/tutorial/maxmsp/ex-signal2.pat Binary files differindex 21c12f88..21c12f88 100755 --- a/externals/grill/flext/tutorial/maxmsp/ex-signal2 +++ b/externals/grill/flext/tutorial/maxmsp/ex-signal2.pat diff --git a/externals/grill/flext/tutorial/maxmsp/ex-simple1 b/externals/grill/flext/tutorial/maxmsp/ex-simple1.pat Binary files differindex 133eefe9..133eefe9 100755 --- a/externals/grill/flext/tutorial/maxmsp/ex-simple1 +++ b/externals/grill/flext/tutorial/maxmsp/ex-simple1.pat diff --git a/externals/grill/flext/tutorial/maxmsp/ex-simple2 b/externals/grill/flext/tutorial/maxmsp/ex-simple2.pat Binary files differindex acc74744..acc74744 100755 --- a/externals/grill/flext/tutorial/maxmsp/ex-simple2 +++ b/externals/grill/flext/tutorial/maxmsp/ex-simple2.pat diff --git a/externals/grill/flext/tutorial/maxmsp/ex-simple3 b/externals/grill/flext/tutorial/maxmsp/ex-simple3.pat Binary files differindex 7dda678c..7dda678c 100755 --- a/externals/grill/flext/tutorial/maxmsp/ex-simple3 +++ b/externals/grill/flext/tutorial/maxmsp/ex-simple3.pat diff --git a/externals/grill/flext/tutorial/maxmsp/ex-thread1 b/externals/grill/flext/tutorial/maxmsp/ex-thread1.pat Binary files differindex cd204b4a..cd204b4a 100755 --- a/externals/grill/flext/tutorial/maxmsp/ex-thread1 +++ b/externals/grill/flext/tutorial/maxmsp/ex-thread1.pat diff --git a/externals/grill/flext/tutorial/maxmsp/ex-thread2 b/externals/grill/flext/tutorial/maxmsp/ex-thread2.pat Binary files differindex d68690c4..d68690c4 100755 --- a/externals/grill/flext/tutorial/maxmsp/ex-thread2 +++ b/externals/grill/flext/tutorial/maxmsp/ex-thread2.pat diff --git a/externals/grill/flext/tutorial/maxmsp/ex-timer1 b/externals/grill/flext/tutorial/maxmsp/ex-timer1.pat Binary files differindex d3828986..d3828986 100755 --- a/externals/grill/flext/tutorial/maxmsp/ex-timer1 +++ b/externals/grill/flext/tutorial/maxmsp/ex-timer1.pat diff --git a/externals/grill/flext/tutorial/pd/ex-signal1.pd b/externals/grill/flext/tutorial/pd/ex-signal1.pd index 9187d586..b1c085d2 100644 --- a/externals/grill/flext/tutorial/pd/ex-signal1.pd +++ b/externals/grill/flext/tutorial/pd/ex-signal1.pd @@ -1,25 +1,25 @@ -#N canvas 335 232 575 335 12; -#X obj 137 137 hsl 128 15 0 1 0 0 empty empty empty 20 8 0 8 -261681 --1 -1 0 1; -#X obj 31 92 osc~ 440; -#X obj 34 279 dac~; -#X obj 126 92 osc~ 880; -#X obj 44 206 signal1~; -#X obj 16 8 cnv 15 550 40 empty empty signal1 10 22 0 24 -260818 -1 -0; -#X text 175 28 http://www.parasitaere-kapazitaeten.net; -#X text 276 151 control the mixing; -#X text 113 241 adjust the volume; -#X obj 44 240 *~ 0.5; -#X text 28 73 source 1; -#X text 128 72 source 2; -#X obj 135 159 nbx 5 16 0 1 0 0 empty empty empty 0 -6 0 12 -261681 --1 -1 0 256; -#X text 175 8 flext tutorial \, (C)2002 \, 2003 Thomas Grill; -#X connect 0 0 12 0; -#X connect 1 0 4 0; -#X connect 3 0 4 1; -#X connect 4 0 9 0; -#X connect 9 0 2 0; -#X connect 9 0 2 1; -#X connect 12 0 4 2; +#N canvas 335 232 584 289 12;
+#X obj 253 92 hsl 128 15 0 1 0 0 empty empty empty 20 8 0 8 -261681
+-1 -1 5800 1;
+#X obj 31 92 osc~ 440;
+#X obj 90 246 dac~;
+#X obj 126 92 osc~ 880;
+#X obj 100 173 signal1~;
+#X obj 16 8 cnv 15 550 40 empty empty signal1 10 22 0 24 -260818 -1
+0;
+#X text 175 28 http://www.parasitaere-kapazitaeten.net;
+#X text 345 109 control the mixing;
+#X text 169 208 adjust the volume;
+#X obj 100 207 *~ 0.5;
+#X text 28 73 source 1;
+#X text 128 72 source 2;
+#X obj 251 114 nbx 5 16 0 1 0 0 empty empty empty 0 -6 0 12 -261681
+-1 -1 0.456693 256;
+#X text 175 8 flext tutorial \, (C)2002 \, 2003 Thomas Grill;
+#X connect 0 0 12 0;
+#X connect 1 0 4 0;
+#X connect 3 0 4 1;
+#X connect 4 0 9 0;
+#X connect 9 0 2 0;
+#X connect 9 0 2 1;
+#X connect 12 0 4 2;
diff --git a/externals/grill/flext/tutorial/pd/ex-signal2.pd b/externals/grill/flext/tutorial/pd/ex-signal2.pd index c081c3b5..bdf834b3 100644 --- a/externals/grill/flext/tutorial/pd/ex-signal2.pd +++ b/externals/grill/flext/tutorial/pd/ex-signal2.pd @@ -1,25 +1,25 @@ -#N canvas 41 125 583 263 12; -#X obj 81 133 signal2~; -#X obj 76 88 bng 25 250 50 0 empty empty empty 0 -6 0 8 -261681 -1 --1; -#X text 108 94 bang to get audio system parameters; -#X text 233 212 channels in and out; -#X obj 16 8 cnv 15 550 40 empty empty signal2 10 22 0 24 -260818 -1 -0; -#X text 175 28 http://www.parasitaere-kapazitaeten.net; -#X obj 38 191 nbx 5 16 -1e+37 1e+37 0 0 empty empty empty 0 -6 0 12 --228992 -1 -1 0 256; -#X obj 130 191 nbx 5 16 -1e+37 1e+37 0 0 empty empty empty 0 -6 0 12 --228992 -1 -1 0 256; -#X obj 233 191 nbx 5 16 -1e+37 1e+37 0 0 empty empty empty 0 -6 0 12 --228992 -1 -1 0 256; -#X obj 325 191 nbx 5 16 -1e+37 1e+37 0 0 empty empty empty 0 -6 0 12 --228992 -1 -1 0 256; -#X text 12 211 samplerate; -#X text 128 211 blocksize; -#X text 173 10 flext tutorial \, (C)2002 \, 2003 Thomas Grill; -#X connect 0 0 6 0; -#X connect 0 1 7 0; -#X connect 0 2 8 0; -#X connect 0 3 9 0; -#X connect 1 0 0 0; +#N canvas 41 125 585 250 12;
+#X obj 109 126 signal2~;
+#X obj 104 81 bng 25 250 50 0 empty empty empty 0 -6 0 8 -261681 -1
+-1;
+#X text 136 87 bang to get audio system parameters;
+#X text 261 205 channels in and out;
+#X obj 16 8 cnv 15 550 40 empty empty signal2 10 22 0 24 -260818 -1
+0;
+#X text 175 28 http://www.parasitaere-kapazitaeten.net;
+#X obj 66 184 nbx 5 16 -1e+037 1e+037 0 0 empty empty empty 0 -6 0
+12 -228992 -1 -1 0 256;
+#X obj 158 184 nbx 5 16 -1e+037 1e+037 0 0 empty empty empty 0 -6 0
+12 -228992 -1 -1 0 256;
+#X obj 261 184 nbx 5 16 -1e+037 1e+037 0 0 empty empty empty 0 -6 0
+12 -228992 -1 -1 0 256;
+#X obj 353 184 nbx 5 16 -1e+037 1e+037 0 0 empty empty empty 0 -6 0
+12 -228992 -1 -1 0 256;
+#X text 40 204 samplerate;
+#X text 156 204 blocksize;
+#X text 173 10 flext tutorial \, (C)2002 \, 2003 Thomas Grill;
+#X connect 0 0 6 0;
+#X connect 0 1 7 0;
+#X connect 0 2 8 0;
+#X connect 0 3 9 0;
+#X connect 1 0 0 0;
diff --git a/externals/grill/flext/tutorial/pd/ex-simple1.pd b/externals/grill/flext/tutorial/pd/ex-simple1.pd index 9c090fac..5020ea00 100644 --- a/externals/grill/flext/tutorial/pd/ex-simple1.pd +++ b/externals/grill/flext/tutorial/pd/ex-simple1.pd @@ -1,14 +1,14 @@ -#N canvas 85 178 588 251 12;
+#N canvas 85 178 590 226 12;
#X msg 29 92 help;
-#X text 203 187 inverse;
+#X text 203 169 inverse;
#X text 169 96 input;
-#X obj 113 141 simple1;
+#X obj 113 131 simple1;
#X obj 16 8 cnv 15 550 40 empty empty simple1 10 22 0 24 -260818 -1
0;
#X text 167 30 http://www.parasitaere-kapazitaeten.net;
#X obj 114 96 nbx 4 16 -999 999 0 0 empty empty empty 0 -6 0 12 -261681
-1 -1 0 256;
-#X obj 112 190 nbx 7 16 -1e+037 1e+037 0 0 empty empty empty 0 -6 0
+#X obj 114 170 nbx 7 16 -1e+037 1e+037 0 0 empty empty empty 0 -6 0
12 -228992 -1 -1 0 256;
#X text 167 10 flext tutorial \, (C)2002 \, 2003 Thomas Grill;
#X connect 0 0 3 0;
diff --git a/externals/grill/flext/tutorial/pd/ex-stk2.pd b/externals/grill/flext/tutorial/pd/ex-stk2.pd index fff665b9..a06db3e2 100644 --- a/externals/grill/flext/tutorial/pd/ex-stk2.pd +++ b/externals/grill/flext/tutorial/pd/ex-stk2.pd @@ -1,11 +1,11 @@ -#N canvas 245 28 592 386 12;
+#N canvas 245 28 594 364 12;
#X obj 68 318 dac~;
#X obj 15 8 cnv 15 550 40 empty empty stk2 10 22 0 24 -260818 -1 0
;
#X text 175 28 http://www.parasitaere-kapazitaeten.net;
#X text 193 229 adjust the volume;
#X obj 194 212 hsl 128 15 0.01 1 1 0 empty empty empty -2 -6 0 8 -261681
--1 -1 9000 1;
+-1 -1 0 1;
#X obj 68 263 *~ 0.3;
#X text 175 8 flext tutorial \, (C)2002-2003 Thomas Grill;
#X obj 68 215 stk2~;
@@ -13,9 +13,9 @@ #X msg 183 139 shL \$1;
#X msg 241 139 shR \$1;
#X obj 267 77 hsl 128 15 0.5 2 1 0 empty empty empty -2 -6 0 8 -261681
--1 -1 5700 1;
+-1 -1 0 1;
#X obj 267 95 hsl 128 15 0.5 2 1 0 empty empty empty -2 -6 0 8 -261681
--1 -1 9300 1;
+-1 -1 0 1;
#X text 172 73 pitch left;
#X text 172 93 pitch right;
#X obj 68 78 osc~ 442;
diff --git a/externals/grill/flext/tutorial/pd/ex-thread1.pd b/externals/grill/flext/tutorial/pd/ex-thread1.pd index ff2d9f38..db04938d 100644 --- a/externals/grill/flext/tutorial/pd/ex-thread1.pd +++ b/externals/grill/flext/tutorial/pd/ex-thread1.pd @@ -1,10 +1,10 @@ -#N canvas 105 266 708 351 12;
+#N canvas 105 266 608 311 12;
#X obj 39 91 bng 25 250 50 0 empty empty start 0 -6 0 8 -261681 -1
-1;
-#X obj 130 246 thread1;
-#X obj 228 248 thread1;
-#X obj 324 246 thread1;
-#X obj 422 247 thread1;
+#X obj 130 231 thread1;
+#X obj 228 233 thread1;
+#X obj 324 231 thread1;
+#X obj 422 232 thread1;
#X obj 131 185 delay 200;
#X obj 228 185 delay 200;
#X obj 325 185 delay 200;
@@ -15,16 +15,16 @@ second time); #X obj 16 8 cnv 15 550 40 empty empty thread1 10 22 0 24 -260818 -1
0;
#X text 170 29 http://www.parasitaere-kapazitaeten.net;
-#X obj 131 277 nbx 5 16 -1e+037 1e+037 0 0 empty empty empty 0 -6 0
+#X obj 131 262 nbx 5 16 -1e+037 1e+037 0 0 empty empty empty 0 -6 0
12 -228992 -1 -1 0 256;
-#X obj 229 278 nbx 5 16 -1e+037 1e+037 0 0 empty empty empty 0 -6 0
+#X obj 229 263 nbx 5 16 -1e+037 1e+037 0 0 empty empty empty 0 -6 0
12 -228992 -1 -1 0 256;
-#X obj 323 276 nbx 5 16 -1e+037 1e+037 0 0 empty empty empty 0 -6 0
+#X obj 323 261 nbx 5 16 -1e+037 1e+037 0 0 empty empty empty 0 -6 0
12 -228992 -1 -1 0 256;
-#X obj 423 276 nbx 5 16 -1e+037 1e+037 0 0 empty empty empty 0 -6 0
+#X obj 423 261 nbx 5 16 -1e+037 1e+037 0 0 empty empty empty 0 -6 0
12 -228992 -1 -1 0 256;
-#X obj 39 244 thread1;
-#X obj 39 277 nbx 5 16 -1e+037 1e+037 0 0 empty empty empty 0 -6 0
+#X obj 39 229 thread1;
+#X obj 39 262 nbx 5 16 -1e+037 1e+037 0 0 empty empty empty 0 -6 0
12 -228992 -1 -1 0 256;
#X text 170 11 flext tutorial \, (C)2002 \, 2003 Thomas Grill;
#X connect 0 0 5 0;
diff --git a/externals/grill/flext/tutorial/simple1/main.cpp b/externals/grill/flext/tutorial/simple1/main.cpp index 9f0f43e8..ed3c3ea3 100755 --- a/externals/grill/flext/tutorial/simple1/main.cpp +++ b/externals/grill/flext/tutorial/simple1/main.cpp @@ -32,10 +32,36 @@ class simple1: public: // constructor - simple1(); + simple1() + { + // define inlets: + // first inlet must always be of type anything (or signal for dsp objects) + AddInAnything(); // add one inlet for any message + + // define outlets: + AddOutFloat(); // add one float outlet (has index 0) + + // register methods + FLEXT_ADDMETHOD(0,m_float); // register method (for float messages) "m_float" for inlet 0 + } protected: - void m_float(float f); // method for float values + void m_float(float input) // method for float values + { + float result; + + if(input == 0) { + // special case 0 + post("%s - zero can't be inverted!",thisName()); + result = 0; + } + else + // normal case + result = 1/input; + + // output value to outlet + ToOutFloat(0,result); // (0 stands for the outlet index 0 - the leftmost outlet) + } private: FLEXT_CALLBACK_1(m_float,float) // callback for method "m_float" (with one float argument) @@ -45,32 +71,3 @@ private: FLEXT_NEW("simple1",simple1) -simple1::simple1() -{ - // define inlets: - // first inlet must always be of type anything (or signal for dsp objects) - AddInAnything(); // add one inlet for any message - - // define outlets: - AddOutFloat(); // add one float outlet (has index 0) - - // register methods - FLEXT_ADDMETHOD(0,m_float); // register method (for float messages) "m_float" for inlet 0 -} - -void simple1::m_float(float f) -{ - float res; - if(f == 0) { - // special case 0 - post("%s - zero can't be inverted!",thisName()); - res = 0; - } - else - // normal case - res = 1/f; - - // output value to outlet - ToOutFloat(0,res); // (0 stands for the outlet index 0 - the leftmost outlet) -} - |