add auto zoombar/status color, fix 3 batchrender boobies, rotate plugin tweaks, add...
[goodguy/cinelerra.git] / cinelerra-5.1 / plugins / reverb / reverb.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 REVERB_H
23 #define REVERB_H
24
25 class Reverb;
26 class ReverbEngine;
27
28 #include "reverbwindow.h"
29 #include "pluginaclient.h"
30
31 #define MAX_DELAY_INIT 1000
32 #define MIN_REFLECTIONS 1
33 #define MAX_REFLECTIONS 255
34 #define MAX_REFLENGTH 5000
35
36 class ReverbConfig
37 {
38 public:
39         ReverbConfig();
40
41
42         int equivalent(ReverbConfig &that);
43         void copy_from(ReverbConfig &that);
44         void interpolate(ReverbConfig &prev,
45                 ReverbConfig &next,
46                 int64_t prev_frame,
47                 int64_t next_frame,
48                 int64_t current_frame);
49         void dump();
50         void boundaries();
51
52         double level_init;
53         int64_t delay_init;
54         double ref_level1;
55         double ref_level2;
56         int64_t ref_total;
57         int64_t ref_length;
58         int64_t lowpass1, lowpass2;
59 };
60
61 class Reverb : public PluginAClient
62 {
63 public:
64         Reverb(PluginServer *server);
65         ~Reverb();
66
67         void update_gui();
68 //      int load_from_file(char *data);
69 //      int save_to_file(char *data);
70
71 // data for reverb
72         char config_directory[1024];
73
74         double **main_in, **main_out;
75         double **dsp_in;
76         int64_t **ref_channels, **ref_offsets, **ref_lowpass;
77         double **ref_levels;
78         int64_t dsp_in_length;
79         int redo_buffers;
80 // skirts for lowpass filter
81         double **lowpass_in1, **lowpass_in2;
82         DB db;
83 // required for all realtime/multichannel plugins
84
85         PLUGIN_CLASS_MEMBERS(ReverbConfig);
86         int process_realtime(int64_t size, Samples **input_ptr, Samples **output_ptr);
87         int is_realtime();
88         int is_synthesis();
89         int is_multichannel();
90         int show_gui();
91         int set_string();
92         void save_data(KeyFrame *keyframe);
93         void read_data(KeyFrame *keyframe);
94         void raise_window();
95
96         ReverbEngine **engine;
97         int initialized;
98 };
99
100 class ReverbEngine : public Thread
101 {
102 public:
103         ReverbEngine(Reverb *plugin);
104         ~ReverbEngine();
105
106         int process_overlay(double *in, double *out, double &out1, double &out2, double level, int64_t lowpass, int64_t samplerate, int64_t size);
107         int process_overlays(int output_buffer, int64_t size);
108         int wait_process_overlays();
109         void run();
110
111         Mutex input_lock, output_lock;
112         int completed;
113         int output_buffer;
114         int64_t size;
115         Reverb *plugin;
116 };
117
118 #endif