improved plugins with added Tumbler box and visible values
[goodguy/cinelerra.git] / cinelerra-5.1 / plugins / wave / wave.h
1
2 /*
3  * CINELERRA
4  * Copyright (C) 2008 Adam Williams <broadcast at earthling dot net>
5  *
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.
10  *
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.
15  *
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
19  *
20  */
21
22 #ifndef WAVE_H
23 #define WAVE_H
24
25
26 #include "bcdisplayinfo.h"
27 #include "clip.h"
28 #include "bchash.h"
29 #include "filexml.h"
30 #include "guicast.h"
31 #include "keyframe.h"
32 #include "language.h"
33 #include "loadbalance.h"
34 #include "pluginvclient.h"
35 #include "theme.h"
36 #include "vframe.h"
37
38 #include <math.h>
39 #include <stdint.h>
40 #include <string.h>
41
42
43
44
45 #define SMEAR 0
46 #define BLACKEN 1
47
48 #define RESET_DEFAULT_SETTINGS 10
49 #define RESET_ALL        0
50 #define RESET_AMPLITUDE  1
51 #define RESET_PHASE      2
52 #define RESET_WAVELENGTH 3
53
54 #define AMPLITUDE_MIN    0.00
55 #define AMPLITUDE_MAX  100.00
56 #define PHASE_MIN        0.00
57 #define PHASE_MAX      360.00
58 #define WAVELENGTH_MIN   0.00
59 #define WAVELENGTH_MAX  50.00
60
61 class WaveEffect;
62 class WaveWindow;
63 class WaveFText;
64 class WaveFSlider;
65 class WaveReset;
66 class WaveDefaultSettings;
67 class WaveClr;
68
69 class WaveConfig
70 {
71 public:
72         WaveConfig();
73
74         void reset(int clear);
75         void copy_from(WaveConfig &src);
76         int equivalent(WaveConfig &src);
77         void interpolate(WaveConfig &prev,
78                 WaveConfig &next,
79                 long prev_frame,
80                 long next_frame,
81                 long current_frame);
82         int mode;
83         int reflective;
84         float amplitude;
85         float phase;
86         float wavelength;
87 };
88
89 class WaveSmear : public BC_Radial
90 {
91 public:
92         WaveSmear(WaveEffect *plugin, WaveWindow *window, int x, int y);
93         int handle_event();
94         WaveEffect *plugin;
95         WaveWindow *window;
96 };
97
98 class WaveBlacken : public BC_Radial
99 {
100 public:
101         WaveBlacken(WaveEffect *plugin, WaveWindow *window, int x, int y);
102         int handle_event();
103         WaveEffect *plugin;
104         WaveWindow *window;
105 };
106
107
108 class WaveReflective : public BC_CheckBox
109 {
110 public:
111         WaveReflective(WaveEffect *plugin, int x, int y);
112         int handle_event();
113         WaveEffect *plugin;
114 };
115
116
117 class WaveFText : public BC_TumbleTextBox
118 {
119 public:
120         WaveFText(WaveWindow *gui, WaveEffect *plugin,
121                 WaveFSlider *slider, float *output, int x, int y, float min, float max);
122         ~WaveFText();
123         int handle_event();
124         WaveWindow *gui;
125         WaveEffect *plugin;
126         WaveFSlider *slider;
127         float *output;
128         float min, max;
129 };
130
131 class WaveFSlider : public BC_FSlider
132 {
133 public:
134         WaveFSlider(WaveEffect *plugin,
135                 WaveFText *text, float *output, int x, int y,
136                 float min, float max);
137         ~WaveFSlider();
138         int handle_event();
139         WaveEffect *plugin;
140         WaveFText *text;
141         float *output;
142 };
143
144 class WaveReset : public BC_GenericButton
145 {
146 public:
147         WaveReset(WaveEffect *plugin, WaveWindow *gui, int x, int y);
148         ~WaveReset();
149         int handle_event();
150         WaveEffect *plugin;
151         WaveWindow *gui;
152 };
153
154 class WaveDefaultSettings : public BC_GenericButton
155 {
156 public:
157         WaveDefaultSettings(WaveEffect *plugin, WaveWindow *gui, int x, int y, int w);
158         ~WaveDefaultSettings();
159         int handle_event();
160         WaveEffect *plugin;
161         WaveWindow *gui;
162 };
163
164 class WaveClr : public BC_Button
165 {
166 public:
167         WaveClr(WaveEffect *plugin, WaveWindow *gui, int x, int y, int clear);
168         ~WaveClr();
169         int handle_event();
170         WaveEffect *plugin;
171         WaveWindow *gui;
172         int clear;
173 };
174
175
176
177
178
179 class WaveWindow : public PluginClientWindow
180 {
181 public:
182         WaveWindow(WaveEffect *plugin);
183         ~WaveWindow();
184         void create_objects();
185         void update_mode();
186         void update_gui(int clear);
187
188         WaveEffect *plugin;
189 //      WaveSmear *smear;
190 //      WaveBlacken *blacken;
191 //      WaveReflective *reflective;
192
193         WaveFText *amplitude_text;
194         WaveFSlider *amplitude_slider;
195         WaveClr *amplitude_Clr;
196
197         WaveFText *phase_text;
198         WaveFSlider *phase_slider;
199         WaveClr *phase_Clr;
200
201         WaveFText *wavelength_text;
202         WaveFSlider *wavelength_slider;
203         WaveClr *wavelength_Clr;
204
205         WaveReset *reset;
206         WaveDefaultSettings *default_settings;
207 };
208
209
210
211
212
213
214
215 class WaveServer : public LoadServer
216 {
217 public:
218         WaveServer(WaveEffect *plugin, int cpus);
219         void init_packages();
220         LoadClient* new_client();
221         LoadPackage* new_package();
222         WaveEffect *plugin;
223 };
224
225 class WavePackage : public LoadPackage
226 {
227 public:
228         WavePackage();
229         int row1, row2;
230 };
231
232 class WaveUnit : public LoadClient
233 {
234 public:
235         WaveUnit(WaveEffect *plugin, WaveServer *server);
236         void process_package(LoadPackage *package);
237         WaveEffect *plugin;
238 };
239
240
241
242
243
244
245
246
247
248 class WaveEffect : public PluginVClient
249 {
250 public:
251         WaveEffect(PluginServer *server);
252         ~WaveEffect();
253
254         PLUGIN_CLASS_MEMBERS(WaveConfig)
255         int process_realtime(VFrame *input, VFrame *output);
256         int is_realtime();
257         void save_data(KeyFrame *keyframe);
258         void read_data(KeyFrame *keyframe);
259         void update_gui();
260
261         VFrame *temp_frame;
262         VFrame *input, *output;
263         WaveServer *engine;
264 };
265
266 #endif
267