aboutsummaryrefslogtreecommitdiff
path: root/externals/grill/fftease/src/cross~.cpp
blob: e794d76162f7106e967781ba608260a952092e3e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
/*

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"


class cross:
	public fftease
{
	FLEXT_HEADER(cross,fftease)
	
public:
	cross();

protected:

	virtual V Transform(I _N2,S *const *in);
};

FLEXT_LIB_DSP("fftease, cross~",cross)


cross::cross():
	fftease(2,F_STEREO|F_BALANCED|F_BITSHUFFLE|F_CONVERT)
{
	AddInSignal("Messages and driver signal");
	AddInSignal("Filter signal");
	AddInSignal("Threshold signal for cross synthesis");
	AddOutSignal("Transformed signal");
}

V cross::Transform(I _N2,S *const *in)
{
	// filled only once per signal vector!!
	register const F threshie = *in[0];

	const I _N = _N2*2;
	for (I i = 0; i <= _N; i += 2) {
		// modulate amp2 with amp1 (if over threshold)
		if(_channel1[i] > threshie ) _channel2[i] *= _channel1[i];
	}
}