aboutsummaryrefslogtreecommitdiff
path: root/externals/grill/fftease/src/swinger~.cpp
blob: 4660058da43a76cab04b191887a05ef9235586b3 (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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
/*

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>


// add quality switch

class swinger:
	public fftease
{
	FLEXT_HEADER(swinger,fftease)
	
public:
	swinger(I argc,const t_atom *argv);

protected:

	BL _qual;

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

FLEXT_LIB_DSP_V("swinger~",swinger)


swinger::swinger(I argc,const t_atom *argv):
	fftease(2,F_STEREO|F_BITSHUFFLE|F_NOPH1|F_NOAMP2),
	_qual(false)
{
	/* parse and set object's options given */
	if(argc >= 1) {
		if(CanbeBool(argv[0]))
			_qual = GetABool(argv[0]);
		else
			post("%s - Quality must be a boolean value - set to %0i",thisName(),_qual?1:0);
	}

	if(_qual) {
		Mult(4);
		_flags |= F_BALANCED;
	}
	else
		Mult(2);

	AddInSignal("Messages and input signal");
	AddInSignal("Signal to supply phase information");
	AddOutSignal("Transformed signal");
}


V swinger::Transform(I _N,S *const *)
{
	for (I i = 0; i <= _N; i += 2) _channel1[i+1] = _channel2[i+1];
}