add auto zoombar/status color, fix 3 batchrender boobies, rotate plugin tweaks, add...
[goodguy/cinelerra.git] / cinelerra-5.1 / plugins / rumbler / rumbler.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 RUMBLER_H
23 #define RUMBLER_H
24
25 #include "bcdisplayinfo.h"
26 #include "affine.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 "pluginvclient.h"
34 #include "vframe.h"
35
36 #include <math.h>
37 #include <string.h>
38 #include <stdint.h>
39
40
41 class Rumbler;
42 class RumblerConfig;
43 class RumblerRate;
44 class RumblerSeq;
45 class RumblerWindow;
46 class RumblerReset;
47
48
49 class RumblerConfig
50 {
51 public:
52         RumblerConfig();
53         void reset();
54         float time_rumble, time_rate;
55         float space_rumble, space_rate;
56         int sequence;
57         void copy_from(RumblerConfig &that);
58         int equivalent(RumblerConfig &that);
59         void interpolate(RumblerConfig &prev, RumblerConfig &next,
60                 int64_t prev_frame, int64_t next_frame, int64_t current_frame);
61 };
62
63 class RumblerRate : public BC_TextBox
64 {
65 public:
66         RumblerRate(Rumbler *plugin, RumblerWindow *gui,
67                 float &value, int x, int y);
68         int handle_event();
69         Rumbler *plugin;
70         RumblerWindow *gui;
71         float *value;
72 };
73
74 class RumblerSeq : public BC_TextBox
75 {
76 public:
77         RumblerSeq(Rumbler *plugin, RumblerWindow *gui,
78                 int &value, int x, int y);
79         int handle_event();
80         Rumbler *plugin;
81         RumblerWindow *gui;
82         int *value;
83 };
84
85 class RumblerReset : public BC_GenericButton
86 {
87 public:
88         RumblerReset(Rumbler *plugin, RumblerWindow *gui, int x, int y);
89         ~RumblerReset();
90         int handle_event();
91         Rumbler *plugin;
92         RumblerWindow *gui;
93 };
94
95
96 class RumblerWindow : public PluginClientWindow
97 {
98 public:
99         RumblerWindow(Rumbler *plugin);
100         ~RumblerWindow();
101         void create_objects();
102         void update();
103
104         Rumbler *plugin;
105         RumblerRate *time_rumble, *time_rate;
106         RumblerRate *space_rumble, *space_rate;
107         RumblerSeq *seq;
108         RumblerReset *reset;
109 };
110
111 class Rumbler : public PluginVClient
112 {
113 public:
114         Rumbler(PluginServer *server);
115         ~Rumbler();
116
117         PLUGIN_CLASS_MEMBERS(RumblerConfig)
118
119         int process_buffer(VFrame *frame, int64_t start_position, double frame_rate);
120         int is_realtime();
121         void save_data(KeyFrame *keyframe);
122         void read_data(KeyFrame *keyframe);
123         void update_gui();
124         int handle_opengl();
125         static double rumble(int64_t seq, double cur, double per, double amp);
126
127         VFrame *input, *output, *temp;
128         float x1,y1, x2,y2, x3,y3, x4,y4;
129         AffineEngine *engine;
130 };
131
132 #endif