1 /*
2     Copyright (C) 2004-2009 Fons Adriaensen <fons@kokkinizita.net>
3 
4     This program is free software; you can redistribute it and/or modify
5     it under the terms of the GNU General Public License as published by
6     the Free Software Foundation; either version 2 of the License, or
7     (at your option) any later version.
8 
9     This program is distributed in the hope that it will be useful,
10     but WITHOUT ANY WARRANTY; without even the implied warranty of
11     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12     GNU General Public License for more details.
13 
14     You should have received a copy of the GNU General Public License
15     along with this program; if not, write to the Free Software
16     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
17 */
18 
19 
20 #ifndef __AMBISONIC2_H
21 #define __AMBISONIC2_H
22 
23 
24 #include "ladspaplugin.h"
25 
26 
27 class Ladspa_Monopan21 : public LadspaPlugin
28 {
29 public:
30 
31     enum { INP,
32            OUT_W, OUT_X, OUT_Y, OUT_U, OUT_V, OUT_Z,
33            CTL_ELEV, CTL_AZIM, NPORT  };
34 
Ladspa_Monopan21(unsigned long fsam)35     Ladspa_Monopan21 (unsigned long fsam) : LadspaPlugin (fsam) {}
36     virtual void setport (unsigned long port, LADSPA_Data *data);
37     virtual void active  (bool act);
38     virtual void runproc (unsigned long len, bool add);
~Ladspa_Monopan21(void)39     virtual ~Ladspa_Monopan21 (void) {}
40 
41 private:
42 
43     void calcpar (float az, float el);
44 
45     float     *_port [NPORT];
46     float      _xx, _yy, _zz, _uu, _vv;
47 };
48 
49 
50 
51 class Ladspa_Rotator21 : public LadspaPlugin
52 {
53 public:
54 
55     enum { INP_W, INP_X, INP_Y, INP_U, INP_V, INP_Z,
56            OUT_W, OUT_X, OUT_Y, OUT_U, OUT_V, OUT_Z,
57            CTL_AZIM, NPORT  };
58 
Ladspa_Rotator21(unsigned long fsam)59     Ladspa_Rotator21 (unsigned long fsam) : LadspaPlugin (fsam) {}
60     virtual void setport (unsigned long port, LADSPA_Data *data);
61     virtual void active  (bool act);
62     virtual void runproc (unsigned long len, bool add);
~Ladspa_Rotator21(void)63     virtual ~Ladspa_Rotator21 (void) {}
64 
65 private:
66 
67     void calcpar (float az);
68 
69     float     *_port [NPORT];
70     float      _c1, _s1, _c2, _s2;
71 };
72 
73 
74 
75 class Ladspa_Monopan22 : public LadspaPlugin
76 {
77 public:
78 
79     enum { INP,
80            OUT_W, OUT_X, OUT_Y, OUT_Z, OUT_R, OUT_S, OUT_T, OUT_U, OUT_V,
81            CTL_ELEV, CTL_AZIM, NPORT  };
82 
Ladspa_Monopan22(unsigned long fsam)83     Ladspa_Monopan22 (unsigned long fsam) : LadspaPlugin (fsam) {}
84     virtual void setport (unsigned long port, LADSPA_Data *data);
85     virtual void active  (bool act);
86     virtual void runproc (unsigned long len, bool add);
~Ladspa_Monopan22(void)87     virtual ~Ladspa_Monopan22 (void) {}
88 
89 private:
90 
91     void calcpar (float az, float el);
92 
93     float     *_port [NPORT];
94     float      _xx, _yy, _zz, _rr, _ss, _tt, _uu, _vv;
95 };
96 
97 
98 
99 class Ladspa_Rotator22 : public LadspaPlugin
100 {
101 public:
102 
103     enum { INP_W, INP_X, INP_Y, INP_Z, INP_R, INP_S, INP_T, INP_U, INP_V,
104            OUT_W, OUT_X, OUT_Y, OUT_Z, OUT_R, OUT_S, OUT_T, OUT_U, OUT_V,
105            CTL_AZIM, NPORT  };
106 
Ladspa_Rotator22(unsigned long fsam)107     Ladspa_Rotator22 (unsigned long fsam) : LadspaPlugin (fsam) {}
108     virtual void setport (unsigned long port, LADSPA_Data *data);
109     virtual void active  (bool act);
110     virtual void runproc (unsigned long len, bool add);
~Ladspa_Rotator22(void)111     virtual ~Ladspa_Rotator22 (void) {}
112 
113 private:
114 
115     void calcpar (float az);
116 
117     float     *_port [NPORT];
118     float      _c1, _s1, _c2, _s2;
119 };
120 
121 
122 #endif
123