1 /*
2   Copyright 2008-2011 David Robillard <http://drobilla.net>
3   Copyright 1999-2000 Paul Kellett (Maxim Digital Audio)
4 
5   This is free software: you can redistribute it and/or modify it
6   under the terms of the GNU General Public License as published by
7   the Free Software Foundation, either version 3 of the License,
8   or (at your option) any later version.
9 
10   This software is distributed in the hope that it will be useful,
11   but WITHOUT ANY WARRANTY; without even the implied warranty of
12   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13   See the GNU General Public License for more details.
14 
15   You should have received a copy of the GNU General Public License
16   along with this software. If not, see <http://www.gnu.org/licenses/>.
17 */
18 
19 #ifndef __mdaLeslie_H
20 #define __mdaLeslie_H
21 
22 #include "audioeffectx.h"
23 
24 #include <cstdint>
25 
26 #define NPARAMS  9      //number of parameters
27 #define NPROGS   3      //number of programs
28 
29 class mdaLeslieProgram
30 {
31 public:
32 	mdaLeslieProgram();
33 private:
34 	friend class mdaLeslie;
35     float param[NPARAMS];
36 	char name[24];
37 };
38 
39 class mdaLeslie : public AudioEffectX
40 {
41 public:
42 	mdaLeslie(audioMasterCallback audioMaster);
43 	~mdaLeslie();
44 
45 	virtual void process(float **inputs, float **outputs, int32_t sampleFrames);
46 	virtual void processReplacing(float **inputs, float **outputs, int32_t sampleFrames);
47 	virtual void setProgram(int32_t program);
48 	virtual void setProgramName(char *name);
49 	virtual void getProgramName(char *name);
50 	virtual bool getProgramNameIndexed (int32_t category, int32_t index, char* name);
51 	virtual void setParameter(int32_t index, float value);
52 	virtual float getParameter(int32_t index);
53 	virtual void getParameterLabel(int32_t index, char *label);
54 	virtual void getParameterDisplay(int32_t index, char *text);
55 	virtual void getParameterName(int32_t index, char *text);
56 	virtual void suspend();
57 
58 	virtual bool getEffectName(char *name);
59 	virtual bool getVendorString(char *text);
60 	virtual bool getProductString(char *text);
getVendorVersion()61 	virtual int32_t getVendorVersion() { return 1000; }
62 
63 protected:
64     void update();
65 	mdaLeslieProgram *programs;
66 
67   float filo; //crossover filter coeff
68   float fbuf1, fbuf2; //filter buffers
69   float twopi; //speed, target, momentum, phase, width, ampmod, freqmod...
70   float hspd, hset, hmom, hphi, hwid, hlev, hdep;
71   float lspd, lset, lmom, lphi, lwid, llev, gain;
72   float *hbuf;  //HF delay buffer
73 	int32_t size, hpos; //buffer length & pointer
74 
75   float chp, dchp, clp, dclp, shp, dshp, slp, dslp;
76 };
77 
78 #endif
79