diff options
author | Thomas Grill <xovo@users.sourceforge.net> | 2003-01-17 04:37:14 +0000 |
---|---|---|
committer | Thomas Grill <xovo@users.sourceforge.net> | 2003-01-17 04:37:14 +0000 |
commit | 478eeca99ee6f5bad3063700fbcc9d8913c770ae (patch) | |
tree | be9b6dff36c03985fe7ee6a9ba15be4427b3d035 /externals/grill/fftease/src/xsyn~.cpp | |
parent | 0623a36babf06fe897bbb59244c7d4f010d46b9c (diff) |
""
svn path=/trunk/; revision=342
Diffstat (limited to 'externals/grill/fftease/src/xsyn~.cpp')
-rw-r--r-- | externals/grill/fftease/src/xsyn~.cpp | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/externals/grill/fftease/src/xsyn~.cpp b/externals/grill/fftease/src/xsyn~.cpp new file mode 100644 index 00000000..fdb1e736 --- /dev/null +++ b/externals/grill/fftease/src/xsyn~.cpp @@ -0,0 +1,52 @@ +/* + +FFTease - A set of Live Spectral Processors +Originally written by Eric Lyon and Christopher Penrose for the Max/MSP platform + +Copyright (c)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. + +*/ + +#include "main.h" +#include <stdlib.h> + +class xsyn: + public fftease +{ + FLEXT_HEADER(xsyn,fftease) + +public: + xsyn(); + +protected: + virtual V Transform(I n,S *const *in); +}; + +FLEXT_LIB_DSP("fftease, xsyn~",xsyn) + + +xsyn::xsyn(): + fftease(2,F_STEREO|F_BITSHUFFLE|F_CONVERT) +{ + AddInSignal("Messages and Source signal 1"); + AddInSignal("Source signal 2"); + AddOutSignal("Transformed signal"); +} + + +V xsyn::Transform(I _N2,S *const *in) +{ + const I _N = _N2*2; + + F maxamp = 0; + I i; + for( i = 0; i < _N; i+= 2 ) + if(_channel2[i] > maxamp ) maxamp = _channel2[i]; + + const F f = maxamp?1./maxamp:1.; + + for( i = 0; i < _N; i+= 2 ) + _channel1[i] *= (_channel2[i] * f); +} |