r105: This commit was manufactured by cvs2svn to create tag
[cinelerra_cv/mob.git] / hvirtual / plugins / parametric / parametric.h
blob21619aabfa5a9a84612375a40573ffb618dfaf59
1 #ifndef PARAMETRIC_H
2 #define PARAMETRIC_H
5 #include "defaults.inc"
6 #include "fourier.h"
7 #include "guicast.h"
8 #include "mutex.h"
9 #include "pluginaclient.h"
10 #include "vframe.inc"
13 // This parametric EQ multiplies the data by a gaussian curve in frequency domain.
14 // It causes significant delay but is useful.
17 #define BANDS 3
18 #define WINDOW_SIZE 16384
19 #define MAXMAGNITUDE 15
23 class ParametricConfig;
24 class ParametricThread;
25 class ParametricFreq;
26 class ParametricQuality;
27 class ParametricMagnitude;
28 class ParametricBandGUI;
29 class ParametricWindow;
30 class ParametricFFT;
31 class ParametricEQ;
36 class ParametricBand
38 public:
39 ParametricBand();
41 int equivalent(ParametricBand &that);
42 void copy_from(ParametricBand &that);
43 void interpolate(ParametricBand &prev,
44 ParametricBand &next,
45 double prev_scale,
46 double next_scale);
48 enum
50 NONE,
51 LOWPASS,
52 HIGHPASS,
53 BANDPASS
56 int freq;
57 float quality;
58 float magnitude;
59 int mode;
63 class ParametricConfig
65 public:
66 ParametricConfig();
68 int equivalent(ParametricConfig &that);
69 void copy_from(ParametricConfig &that);
70 void interpolate(ParametricConfig &prev,
71 ParametricConfig &next,
72 int64_t prev_frame,
73 int64_t next_frame,
74 int64_t current_frame);
76 ParametricBand band[BANDS];
77 float wetness;
83 PLUGIN_THREAD_HEADER(ParametricEQ, ParametricThread, ParametricWindow)
86 class ParametricFreq : public BC_QPot
88 public:
89 ParametricFreq(ParametricEQ *plugin, int x, int y, int band);
91 int handle_event();
93 int band;
94 ParametricEQ *plugin;
98 class ParametricQuality : public BC_FPot
100 public:
101 ParametricQuality(ParametricEQ *plugin, int x, int y, int band);
103 int handle_event();
105 int band;
106 ParametricEQ *plugin;
110 class ParametricMagnitude : public BC_FPot
112 public:
113 ParametricMagnitude(ParametricEQ *plugin, int x, int y, int band);
115 int handle_event();
117 int band;
118 ParametricEQ *plugin;
124 class ParametricMode : public BC_PopupMenu
126 public:
127 ParametricMode(ParametricEQ *plugin, int x, int y, int band);
129 void create_objects();
130 int handle_event();
131 static int text_to_mode(char *text);
132 static char* mode_to_text(int mode);
134 int band;
135 ParametricEQ *plugin;
142 class ParametricBandGUI
144 public:
145 ParametricBandGUI(ParametricEQ *plugin,
146 ParametricWindow *window,
147 int x,
148 int y,
149 int band);
150 ~ParametricBandGUI();
152 void create_objects();
153 void update_gui();
155 int band;
156 int x, y;
157 ParametricEQ *plugin;
158 ParametricWindow *window;
159 ParametricFreq *freq;
160 ParametricQuality *quality;
161 ParametricMagnitude *magnitude;
162 ParametricMode *mode;
167 class ParametricWetness : public BC_FPot
169 public:
170 ParametricWetness(ParametricEQ *plugin, int x, int y);
171 int handle_event();
172 ParametricEQ *plugin;
176 class ParametricWindow : public BC_Window
178 public:
179 ParametricWindow(ParametricEQ *plugin, int x, int y);
180 ~ParametricWindow();
182 void create_objects();
183 int close_event();
184 void update_gui();
185 void update_canvas();
187 BC_SubWindow *canvas;
188 ParametricEQ *plugin;
189 ParametricBandGUI* bands[BANDS];
190 ParametricWetness *wetness;
193 class ParametricFFT : public CrossfadeFFT
195 public:
196 ParametricFFT(ParametricEQ *plugin);
197 ~ParametricFFT();
199 int signal_process();
201 ParametricEQ *plugin;
205 class ParametricEQ : public PluginAClient
207 public:
208 ParametricEQ(PluginServer *server);
209 ~ParametricEQ();
211 int is_realtime();
212 void read_data(KeyFrame *keyframe);
213 void save_data(KeyFrame *keyframe);
214 int process_realtime(int64_t size, double *input_ptr, double *output_ptr);
216 int load_defaults();
217 int save_defaults();
218 void reset();
219 void reconfigure();
220 void update_gui();
222 double calculate_envelope();
223 double gauss(double sigma, double a, double x);
225 double envelope[WINDOW_SIZE / 2];
226 int need_reconfigure;
227 PLUGIN_CLASS_MEMBERS(ParametricConfig, ParametricThread)
228 ParametricFFT *fft;
233 #endif