4 * Copyright (C) 2011 Adam Williams <broadcast at earthling dot net>
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
30 #include "pluginaclient.h"
34 // This parametric EQ multiplies the data by a gaussian curve in frequency domain.
35 // It causes significant delay but is useful.
39 #define MAXMAGNITUDE 15
40 #define MAX_WINDOW 262144
44 class ParametricConfig;
45 class ParametricThread;
47 class ParametricQuality;
48 class ParametricMagnitude;
49 class ParametricBandGUI;
50 class ParametricWindow;
62 int equivalent(ParametricBand &that);
63 void copy_from(ParametricBand &that);
64 void interpolate(ParametricBand &prev,
84 class ParametricConfig
89 int equivalent(ParametricConfig &that);
90 void copy_from(ParametricConfig &that);
91 void interpolate(ParametricConfig &prev,
92 ParametricConfig &next,
95 int64_t current_frame);
97 ParametricBand band[BANDS];
106 class ParametricFreq : public BC_QPot
109 ParametricFreq(ParametricEQ *plugin, int x, int y, int band);
114 ParametricEQ *plugin;
118 class ParametricQuality : public BC_FPot
121 ParametricQuality(ParametricEQ *plugin, int x, int y, int band);
126 ParametricEQ *plugin;
130 class ParametricMagnitude : public BC_FPot
133 ParametricMagnitude(ParametricEQ *plugin, int x, int y, int band);
138 ParametricEQ *plugin;
144 class ParametricMode : public BC_PopupMenu
147 ParametricMode(ParametricEQ *plugin, int x, int y, int band);
149 void create_objects();
151 static int text_to_mode(char *text);
152 static const char* mode_to_text(int mode);
155 ParametricEQ *plugin;
162 class ParametricBandGUI
165 ParametricBandGUI(ParametricEQ *plugin,
166 ParametricWindow *window,
170 ~ParametricBandGUI();
172 void create_objects();
177 ParametricEQ *plugin;
178 ParametricWindow *window;
179 ParametricFreq *freq;
180 ParametricQuality *quality;
181 ParametricMagnitude *magnitude;
182 ParametricMode *mode;
186 class ParametricSize : public BC_PopupMenu
189 ParametricSize(ParametricWindow *window, ParametricEQ *plugin, int x, int y);
192 void create_objects(); // add initial items
193 void update(int size);
195 ParametricWindow *window;
196 ParametricEQ *plugin;
202 class ParametricWetness : public BC_FPot
205 ParametricWetness(ParametricEQ *plugin, int x, int y);
207 ParametricEQ *plugin;
211 class ParametricWindow : public PluginClientWindow
214 ParametricWindow(ParametricEQ *plugin);
217 void create_objects();
219 void update_canvas();
221 BC_SubWindow *canvas;
222 ParametricEQ *plugin;
223 ParametricBandGUI* bands[BANDS];
224 ParametricWetness *wetness;
225 ParametricSize *size;
229 class ParametricGUIFrame : public PluginClientFrame
232 ParametricGUIFrame(int window_size, int sample_rate);
233 virtual ~ParametricGUIFrame();
235 // Maximum of window in frequency domain
237 // Maximum of window in time domain
243 class ParametricFFT : public CrossfadeFFT
246 ParametricFFT(ParametricEQ *plugin);
249 int signal_process();
251 int read_samples(int64_t output_sample,
255 ParametricEQ *plugin;
256 // Current GUI frame being filled
257 ParametricGUIFrame *frame;
261 class ParametricEQ : public PluginAClient
264 ParametricEQ(PluginServer *server);
268 void read_data(KeyFrame *keyframe);
269 void save_data(KeyFrame *keyframe);
270 int process_buffer(int64_t size,
272 int64_t start_position,
279 double calculate_envelope();
280 double gauss(double sigma, double a, double x);
283 int need_reconfigure;
284 PLUGIN_CLASS_MEMBERS(ParametricConfig)
286 // For refreshing the canvas
287 ParametricGUIFrame *last_frame;