diff options
author | Thomas Grill <xovo@users.sourceforge.net> | 2002-10-22 23:07:10 +0000 |
---|---|---|
committer | Thomas Grill <xovo@users.sourceforge.net> | 2002-10-22 23:07:10 +0000 |
commit | d62e56f4df9594f72ce501f5e19c974fd18e7295 (patch) | |
tree | 635d4af7a7c2425098e60ca277086ec436b617f7 /externals/grill/flext/tutorial/signal2/main.cpp | |
parent | c6f373c281ecb5cd1f4aa7a070e15cc61ab8793c (diff) |
This commit was generated by cvs2svn to compensate for changes in r186,
which included commits to RCS files with non-trunk default branches.
svn path=/trunk/; revision=187
Diffstat (limited to 'externals/grill/flext/tutorial/signal2/main.cpp')
-rw-r--r-- | externals/grill/flext/tutorial/signal2/main.cpp | 80 |
1 files changed, 80 insertions, 0 deletions
diff --git a/externals/grill/flext/tutorial/signal2/main.cpp b/externals/grill/flext/tutorial/signal2/main.cpp new file mode 100644 index 00000000..1517b536 --- /dev/null +++ b/externals/grill/flext/tutorial/signal2/main.cpp @@ -0,0 +1,80 @@ +/* +flext tutorial - signal 2 + +Copyright (c) 2002 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 object showing varous parameters of the pd audio system +*/ + +// include flext header +#include <flext.h> + +// check for appropriate flext version +#if !defined(FLEXT_VERSION) || (FLEXT_VERSION < 300) +#error You need at least flext version 0.3.0 +#endif + + +// define the class that stands for a pd/Max object +// Attention: the class name must be the same as the object name!! (without the ~) + +class signal2: + // inherit from flext dsp class + public flext_dsp +{ + // obligatory flext header (class name,base class name) + FLEXT_HEADER(signal2,flext_dsp) + +public: + // constructor + signal2(); + +protected: + void m_bang(); // method for bang + + // this virtual function is obligatory for objects derived from flext_dsp + virtual void m_signal(int n, float *const *in, float *const *out); + +private: + FLEXT_CALLBACK(m_bang); // callback for method "m_bang" +}; + +// instantiate the class +FLEXT_NEW_DSP("signal2~",signal2) + + +signal2::signal2() +{ + // define inlets: + // first inlet must always by of type anything (or signal for dsp objects) + AddInAnything(); // add one inlet for any message + + // add outlets for sample rate, block size, audio in and out channel count + AddOutFloat(1); + AddOutInt(3); // although PD knows no int type, flext does! + + // set up inlets and outlets - obligatory! + SetupInOut(); + + // register methods + FLEXT_ADDBANG(0,m_bang); // register method "m_bang" for bang message into inlet 0 +} + +void signal2::m_bang() +{ + // output various parameters of the pd audio system + ToOutFloat(0,Samplerate()); + ToOutInt(1,Blocksize()); + ToOutInt(2,ChannelsIn()); + ToOutInt(3,ChannelsOut()); +} + +void signal2::m_signal(int, float *const *, float *const *) +{ + // do no dsp work +} + |