aboutsummaryrefslogtreecommitdiff
path: root/polarizer/polarizer.hpp
diff options
context:
space:
mode:
authorN.N. <martin_pi@users.sourceforge.net>2003-02-17 14:12:16 +0000
committerN.N. <martin_pi@users.sourceforge.net>2003-02-17 14:12:16 +0000
commite7b24dd7da9de84e218f7d7be623f0cf8b9d1b9c (patch)
treed6f37e159464589e9c5c3dea8b38e4d03631794c /polarizer/polarizer.hpp
This commit was generated by cvs2svn to compensate for changes in r415,svn2git-root
which included commits to RCS files with non-trunk default branches. svn path=/trunk/externals/dfx/; revision=416
Diffstat (limited to 'polarizer/polarizer.hpp')
-rw-r--r--polarizer/polarizer.hpp78
1 files changed, 78 insertions, 0 deletions
diff --git a/polarizer/polarizer.hpp b/polarizer/polarizer.hpp
new file mode 100644
index 0000000..fb0eff4
--- /dev/null
+++ b/polarizer/polarizer.hpp
@@ -0,0 +1,78 @@
+/*---------------------------------------------------------------
+
+ © 2001, Marcberg Soft & Hard GmbH, All Rights Reserved
+
+---------------------------------------------------------------*/
+
+#ifndef __polarizer_H
+#define __polarizer_H
+
+#include <stdlib.h>
+#include <math.h>
+
+#include "flext.h"
+
+#if !defined(FLEXT_VERSION) || (FLEXT_VERSION < 202)
+#error You need at least flext version 0.2.2
+#endif
+
+#define normalize(f,a,b) ((((f < b) ? f : b) > a) ? f : a)
+
+// these are the 2 states of the process:
+enum {
+ unaffected,
+ polarized
+};
+
+//-----------------------------------------------------------------------------
+// constants
+
+const long SKIPMIN = 1;
+const long SKIPMAX = 81;
+const long SKIPRANGE = SKIPMAX - SKIPMIN;
+
+// this is for converting from parameter entries to the real values
+#define leapScaled(A) ( ((long)(powf((A),1.5f)*SKIPRANGE)) + SKIPMIN )
+
+//-----------------------------------------------------------------------------
+
+class polarizer :
+ public flext_dsp {
+
+ FLEXT_HEADER(polarizer, flext_dsp)
+
+public:
+ polarizer(int argc, t_atom *argv);
+// ~polarizer();
+
+ virtual void processReplacing(float **inputs, float **outputs, long sampleFrames);
+
+ virtual void m_signal(int, t_sample *const *, t_sample *const *);
+ virtual void m_help();
+
+protected:
+ float processSampleAmp();
+ float processOutValue(float amp, float in);
+
+ float fSkip, fAmount, fImplode; // the parameters
+ char *programName;
+ long unaffectedSamples; // sample counter
+ int state; // the state of the process
+
+ FLEXT_CALLBACK_F(setSkip)
+ void setSkip(float f) {
+ fSkip = normalize(f,0,1);
+ }
+
+ FLEXT_CALLBACK_F(setAmount)
+ void setAmount(float f) {
+ fAmount = normalize(f,0,1);
+ }
+
+ FLEXT_CALLBACK_F(setImplode)
+ void setImplode(float f) {
+ fImplode = normalize(f,0,1);
+ }
+};
+
+#endif