remove whitespace at eol
[goodguy/history.git] / cinelerra-5.1 / plugins / dbx / dbx.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 DBX_H
23 #define DBX_H
24
25
26
27 #include "bchash.inc"
28 #include "guicast.h"
29 #include "mutex.h"
30 #include "pluginaclient.h"
31 #include "vframe.inc"
32
33 class DBXEffect;
34
35
36
37
38
39 class DBXSize : public BC_TextBox
40 {
41 public:
42         DBXSize(DBXEffect *plugin, int x, int y);
43         int handle_events();
44         DBXEffect *plugin;
45 };
46
47
48 class DBXGain : public BC_TextBox
49 {
50 public:
51         DBXGain(DBXEffect *plugin, int x, int y);
52         int handle_events();
53         DBXEffect *plugin;
54 };
55
56
57 class DBXWindow : public BC_Window
58 {
59 public:
60         DBXWindow(DBXEffect *plugin, int x, int y);
61         void create_objects();
62         void update();
63         void update_textboxes();
64         void update_canvas();
65         int close_event();
66         void draw_scales();
67
68
69         DBXCanvas *canvas;
70         DBXPreview *preview;
71         DBXReaction *reaction;
72         DBXClear *clear;
73         DBXX *x_text;
74         DBXY *y_text;
75         DBXTrigger *trigger;
76         DBXEffect *plugin;
77 };
78
79 class DBXThread : public Thread
80 {
81 public:
82         DBXThread(DBXEffect *plugin);
83         ~DBXThread();
84         void run();
85         Mutex completion;
86         DBXWindow *window;
87         DBXEffect *plugin;
88 };
89
90
91 typedef struct
92 {
93 // Units are linear from 0 - 1
94         double x, y;
95 } compressor_point_t;
96
97 class DBXConfig
98 {
99 public:
100         DBXConfig();
101
102         int total_points();
103         void remove_point(int number);
104         void optimize();
105         double get_y(int number);
106         double get_x(int number);
107 // Returns linear output given linear input
108         double calculate_linear(double x);
109         int set_point(double x, double y);
110         void dump();
111
112         int trigger;
113         double min_db;
114         double preview_len;
115         double reaction_len;
116         double min_x, min_y;
117         double max_x, max_y;
118         ArrayList<compressor_point_t> levels;
119 };
120
121 class DBXEffect : public PluginAClient
122 {
123 public:
124         DBXEffect(PluginServer *server);
125         ~DBXEffect();
126
127         char* plugin_title();
128         int is_multichannel();
129         int is_realtime();
130         void read_data(KeyFrame *keyframe);
131         void save_data(KeyFrame *keyframe);
132         int process_realtime(long size, double **input_ptr, double **output_ptr);
133         int show_gui();
134         void raise_window();
135         int set_string();
136
137
138
139
140         int load_defaults();
141         int save_defaults();
142         void load_configuration();
143         void reset();
144         void update_gui();
145         void delete_dsp();
146
147
148         double **input_buffer;
149         long input_size;
150         long input_allocated;
151         double *reaction_buffer;
152         long reaction_allocated;
153         long reaction_position;
154         double current_coef;
155
156 // Same coefs are applied to all channels
157         double *coefs;
158         long coefs_allocated;
159
160
161
162         BC_Hash *defaults;
163         DBXThread *thread;
164         DBXConfig config;
165 };
166
167
168 #endif