2c206a2cfcb5cf82b73108d58addd069e29d8f1d
[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 "vframe.h"
36
37 #include <math.h>
38 #include <stdint.h>
39 #include <string.h>
40
41
42
43
44 #define SMEAR 0
45 #define BLACKEN 1
46
47 #define RESET_DEFAULT_SETTINGS 10
48 #define RESET_ALL        0
49 #define RESET_AMPLITUDE  1
50 #define RESET_PHASE      2
51 #define RESET_WAVELENGTH 3
52
53 class WaveEffect;
54 class WaveWindow;
55 class WaveReset;
56 class WaveDefaultSettings;
57 class WaveSliderClr;
58
59 class WaveConfig
60 {
61 public:
62         WaveConfig();
63
64         void reset(int clear);
65         void copy_from(WaveConfig &src);
66         int equivalent(WaveConfig &src);
67         void interpolate(WaveConfig &prev,
68                 WaveConfig &next,
69                 long prev_frame,
70                 long next_frame,
71                 long current_frame);
72         int mode;
73         int reflective;
74         float amplitude;
75         float phase;
76         float wavelength;
77 };
78
79 class WaveSmear : public BC_Radial
80 {
81 public:
82         WaveSmear(WaveEffect *plugin, WaveWindow *window, int x, int y);
83         int handle_event();
84         WaveEffect *plugin;
85         WaveWindow *window;
86 };
87
88 class WaveBlacken : public BC_Radial
89 {
90 public:
91         WaveBlacken(WaveEffect *plugin, WaveWindow *window, int x, int y);
92         int handle_event();
93         WaveEffect *plugin;
94         WaveWindow *window;
95 };
96
97
98 class WaveReflective : public BC_CheckBox
99 {
100 public:
101         WaveReflective(WaveEffect *plugin, int x, int y);
102         int handle_event();
103         WaveEffect *plugin;
104 };
105
106 class WaveAmplitude : public BC_FSlider
107 {
108 public:
109         WaveAmplitude(WaveEffect *plugin, int x, int y);
110         int handle_event();
111         WaveEffect *plugin;
112 };
113
114 class WavePhase : public BC_FSlider
115 {
116 public:
117         WavePhase(WaveEffect *plugin, int x, int y);
118         int handle_event();
119         WaveEffect *plugin;
120 };
121
122 class WaveLength : public BC_FSlider
123 {
124 public:
125         WaveLength(WaveEffect *plugin, int x, int y);
126         int handle_event();
127         WaveEffect *plugin;
128 };
129
130 class WaveReset : public BC_GenericButton
131 {
132 public:
133         WaveReset(WaveEffect *plugin, WaveWindow *gui, int x, int y);
134         ~WaveReset();
135         int handle_event();
136         WaveEffect *plugin;
137         WaveWindow *gui;
138 };
139
140 class WaveDefaultSettings : public BC_GenericButton
141 {
142 public:
143         WaveDefaultSettings(WaveEffect *plugin, WaveWindow *gui, int x, int y, int w);
144         ~WaveDefaultSettings();
145         int handle_event();
146         WaveEffect *plugin;
147         WaveWindow *gui;
148 };
149
150 class WaveSliderClr : public BC_GenericButton
151 {
152 public:
153         WaveSliderClr(WaveEffect *plugin, WaveWindow *gui, int x, int y, int w, int clear);
154         ~WaveSliderClr();
155         int handle_event();
156         WaveEffect *plugin;
157         WaveWindow *gui;
158         int clear;
159 };
160
161
162
163
164
165 class WaveWindow : public PluginClientWindow
166 {
167 public:
168         WaveWindow(WaveEffect *plugin);
169         ~WaveWindow();
170         void create_objects();
171         void update_mode();
172         void update_gui(int clear);
173
174         WaveEffect *plugin;
175 //      WaveSmear *smear;
176 //      WaveBlacken *blacken;
177 //      WaveReflective *reflective;
178         WaveAmplitude *amplitude;
179         WavePhase *phase;
180         WaveLength *wavelength;
181         WaveReset *reset;
182         WaveDefaultSettings *default_settings;
183         WaveSliderClr *amplitudeClr;
184         WaveSliderClr *phaseClr;
185         WaveSliderClr *wavelengthClr;
186 };
187
188
189
190
191
192
193
194 class WaveServer : public LoadServer
195 {
196 public:
197         WaveServer(WaveEffect *plugin, int cpus);
198         void init_packages();
199         LoadClient* new_client();
200         LoadPackage* new_package();
201         WaveEffect *plugin;
202 };
203
204 class WavePackage : public LoadPackage
205 {
206 public:
207         WavePackage();
208         int row1, row2;
209 };
210
211 class WaveUnit : public LoadClient
212 {
213 public:
214         WaveUnit(WaveEffect *plugin, WaveServer *server);
215         void process_package(LoadPackage *package);
216         WaveEffect *plugin;
217 };
218
219
220
221
222
223
224
225
226
227 class WaveEffect : public PluginVClient
228 {
229 public:
230         WaveEffect(PluginServer *server);
231         ~WaveEffect();
232
233         PLUGIN_CLASS_MEMBERS(WaveConfig)
234         int process_realtime(VFrame *input, VFrame *output);
235         int is_realtime();
236         void save_data(KeyFrame *keyframe);
237         void read_data(KeyFrame *keyframe);
238         void update_gui();
239
240         VFrame *temp_frame;
241         VFrame *input, *output;
242         WaveServer *engine;
243 };
244
245 #endif
246