4 * Copyright (C) 1997-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
27 #include "pluginaclient.h"
30 #define MAX_WINDOW 262144
31 //#define WINDOW_SIZE 16384
32 #define MAXMAGNITUDE 15
61 int equivalent(GraphicConfig &that);
62 void copy_from(GraphicConfig &that);
63 void interpolate(GraphicConfig &prev,
67 int64_t current_frame);
68 void insert_point(GraphicPoint *point);
69 void delete_point(int number);
71 ArrayList<GraphicPoint*> points;
78 class GraphicCanvas : public BC_SubWindow
81 GraphicCanvas(GraphicEQ *plugin, GraphicGUI *gui, int x, int y, int w, int h);
82 virtual ~GraphicCanvas();
83 int button_press_event();
84 int cursor_motion_event();
85 int button_release_event();
86 void process(int buttonpress, int motion, int draw);
87 int freq_to_y(int freq,
88 ArrayList<GraphicPoint*> *points,
90 void insert_point(GraphicPoint *point);
94 // Temporary envelope when editing
98 ArrayList<GraphicPoint*> temp_points;
99 double temp_envelope[MAX_WINDOW / 2];
113 class FreqTextBox : public BC_TextBox
116 FreqTextBox(GraphicEQ *plugin,
122 void update(int freq);
127 class ValueTextBox : public BC_TextBox
130 ValueTextBox(GraphicEQ *plugin,
136 void update(float value);
141 class GraphicReset : public BC_GenericButton
144 GraphicReset(GraphicEQ *plugin,
154 class GraphicSize : public BC_PopupMenu
157 GraphicSize(GraphicGUI *window, GraphicEQ *plugin, int x, int y);
160 void create_objects(); // add initial items
161 void update(int size);
168 class GraphicWetness : public BC_FPot
171 GraphicWetness(GraphicGUI *window, GraphicEQ *plugin, int x, int y);
178 class GraphicGUI : public PluginClientWindow
181 GraphicGUI(GraphicEQ *plugin);
184 void create_objects();
185 int keypress_event();
186 void update_canvas();
187 int resize_event(int w, int h);
189 void update_textboxes();
191 FreqTextBox *freq_text;
192 ValueTextBox *value_text;
193 BC_Title *freq_title;
194 BC_Title *level_title;
195 BC_Title *size_title;
197 GraphicCanvas *canvas;
200 // GraphicWetness *wetness;
208 class GraphicGUIFrame : public PluginClientFrame
211 GraphicGUIFrame(int window_size, int sample_rate);
212 virtual ~GraphicGUIFrame();
214 // Maximum of window in frequency domain
216 // Maximum of window in time domain
223 class GraphicFFT : public CrossfadeFFT
226 GraphicFFT(GraphicEQ *plugin);
230 int signal_process();
231 int read_samples(int64_t output_sample,
234 // Current GUI frame being filled
235 GraphicGUIFrame *frame;
242 class GraphicEQ : public PluginAClient
245 GraphicEQ(PluginServer *server);
249 void read_data(KeyFrame *keyframe);
250 void save_data(KeyFrame *keyframe);
251 int process_buffer(int64_t size,
253 int64_t start_position,
256 double freq_to_magnitude(double frequency,
257 ArrayList<GraphicPoint*> *points,
259 void calculate_envelope(ArrayList<GraphicPoint*> *points,
261 int active_point_exists();
265 PLUGIN_CLASS_MEMBERS(GraphicConfig)
269 double envelope[MAX_WINDOW / 2];
271 // For refreshing the canvas
272 GraphicGUIFrame *last_frame;
274 int need_reconfigure;