version update, docs Features5 msg/txt, shuttle tweaks for build
[goodguy/cinelerra.git] / cinelerra-5.1 / cinelerra / pluginaclientlad.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 PLUGINACLIENTLAD_H
23 #define PLUGINACLIENTLAD_H
24
25 #include "bcdisplayinfo.h"
26 #include "guicast.h"
27 #include "ladspa.h"
28 #include "pluginaclient.h"
29 #include "pluginaclientlad.inc"
30 #include "samples.inc"
31
32
33 class PluginAClientConfig
34 {
35 public:
36         PluginAClientConfig();
37         ~PluginAClientConfig();
38
39         int equivalent(PluginAClientConfig &that);
40         void copy_from(PluginAClientConfig &that);
41         void interpolate(PluginAClientConfig &prev,
42                 PluginAClientConfig &next,
43                 int64_t prev_frame,
44                 int64_t next_frame,
45                 int64_t current_frame);
46         void reset();
47         void delete_objects();
48 // Create the port tables based on the LAD descriptor
49         void initialize(PluginServer *server);
50 ;
51 //  Need total_ports record to avoid saving default data buffer ports.
52         int total_ports;
53         enum
54         {
55                 PORT_NORMAL,
56                 PORT_FREQ_INDEX,
57                 PORT_TOGGLE,
58                 PORT_INTEGER
59         };
60         int *port_type;
61 // Frequencies are stored in units of frequency to aid the GUI.
62         LADSPA_Data *port_data;
63 };
64
65 class PluginACLientToggle : public BC_CheckBox
66 {
67 public:
68         PluginACLientToggle(PluginAClientLAD *plugin,
69                 int x,
70                 int y,
71                 LADSPA_Data *output);
72         int handle_event();
73         PluginAClientLAD *plugin;
74         LADSPA_Data *output;
75 };
76
77 class PluginACLientILinear : public BC_IPot
78 {
79 public:
80         PluginACLientILinear(PluginAClientLAD *plugin,
81                 int x,
82                 int y,
83                 LADSPA_Data *output,
84                 int min,
85                 int max);
86         int handle_event();
87         PluginAClientLAD *plugin;
88         LADSPA_Data *output;
89 };
90
91 class PluginACLientFLinear : public BC_FPot
92 {
93 public:
94         PluginACLientFLinear(PluginAClientLAD *plugin,
95                 int x,
96                 int y,
97                 LADSPA_Data *output,
98                 float min,
99                 float max);
100         int handle_event();
101         PluginAClientLAD *plugin;
102         LADSPA_Data *output;
103 };
104
105 class PluginACLientFreq : public BC_QPot
106 {
107 public:
108         PluginACLientFreq(PluginAClientLAD *plugin,
109                 int x,
110                 int y,
111                 LADSPA_Data *output,
112                 int translate_linear);
113         int handle_event();
114         PluginAClientLAD *plugin;
115         LADSPA_Data *output;
116 // Decode LAD frequency table
117         int translate_linear;
118 };
119
120
121 class PluginAClientWindow : public PluginClientWindow
122 {
123 public:
124         PluginAClientWindow(PluginAClientLAD *plugin);
125         ~PluginAClientWindow();
126
127         void create_objects();
128
129
130
131
132         ArrayList<PluginACLientToggle*> toggles;
133         ArrayList<PluginACLientILinear*> ipots;
134         ArrayList<PluginACLientFLinear*> fpots;
135         ArrayList<PluginACLientFreq*> freqs;
136
137         PluginAClientLAD *plugin;
138 };
139
140
141 class PluginAClientLAD : public PluginAClient
142 {
143 public:
144         PluginAClientLAD(PluginServer *server);
145         ~PluginAClientLAD();
146
147         int process_realtime(int64_t size,
148                 Samples *input_ptr,
149                 Samples *output_ptr);
150         int process_realtime(int64_t size,
151                 Samples **input_ptr,
152                 Samples **output_ptr);
153 // Update output pointers as well
154         void update_gui();
155         int is_realtime();
156         int is_multichannel();
157         int is_synthesis();
158         int uses_gui();
159         void save_data(KeyFrame *keyframe);
160         void read_data(KeyFrame *keyframe);
161
162         PLUGIN_CLASS_MEMBERS(PluginAClientConfig)
163         char title[BCSTRLEN];
164
165         static char* lad_to_string(char *string, const char *input);
166         static char* lad_to_upper(char *string, const char *input);
167         int get_inchannels();
168         int get_outchannels();
169         void delete_buffers();
170         void delete_plugin();
171         void init_plugin(int total_in, int total_out, int size);
172
173 // Temporaries for LAD data
174         LADSPA_Data **in_buffers;
175         int total_inbuffers;
176         LADSPA_Data **out_buffers;
177         int total_outbuffers;
178         int buffer_allocation;
179         LADSPA_Handle lad_instance;
180         LADSPA_Data dummy_control_output;
181 };
182
183 #endif