4 * Copyright (C) 2008 Adam Williams <broadcast at earthling dot net>
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.
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.
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
22 #ifndef PLUGINLV2CLIENT_H
23 #define PLUGINLV2CLIENT_H
25 #include "pluginaclient.h"
26 #include "pluginlv2config.h"
27 #include "pluginlv2client.inc"
28 #include "pluginlv2gui.h"
29 #include "samples.inc"
31 #define LV2_SEQ_SIZE 9624
33 class PluginLV2Client_OptPanel : public BC_ListBox
36 PluginLV2Client_OptPanel(PluginLV2ClientWindow *gui, int x, int y, int w, int h);
37 ~PluginLV2Client_OptPanel();
39 PluginLV2ClientWindow *gui;
40 ArrayList<BC_ListBoxItem*> items[2];
41 ArrayList<BC_ListBoxItem*> &opts;
42 ArrayList<BC_ListBoxItem*> &vals;
44 int selection_changed();
48 class PluginLV2ClientText : public BC_TextBox {
50 PluginLV2ClientWindow *gui;
52 PluginLV2ClientText(PluginLV2ClientWindow *gui, int x, int y, int w);
53 ~PluginLV2ClientText();
57 class PluginLV2ClientReset : public BC_GenericButton
60 PluginLV2ClientWindow *gui;
62 PluginLV2ClientReset(PluginLV2ClientWindow *gui, int x, int y);
63 ~PluginLV2ClientReset();
67 class PluginLV2ClientUI : public BC_GenericButton {
69 PluginLV2ClientWindow *gui;
71 PluginLV2ClientUI(PluginLV2ClientWindow *gui, int x, int y);
76 class PluginLV2ClientApply : public BC_GenericButton {
78 PluginLV2ClientWindow *gui;
80 PluginLV2ClientApply(PluginLV2ClientWindow *gui, int x, int y);
81 ~PluginLV2ClientApply();
85 class PluginLV2ClientPot : public BC_FPot
88 PluginLV2ClientPot(PluginLV2ClientWindow *gui, int x, int y);
90 PluginLV2ClientWindow *gui;
93 class PluginLV2ClientSlider : public BC_FSlider
96 PluginLV2ClientSlider(PluginLV2ClientWindow *gui, int x, int y);
98 PluginLV2ClientWindow *gui;
101 class PluginLV2ClientWindow : public PluginClientWindow
104 PluginLV2ClientWindow(PluginLV2Client *plugin);
105 ~PluginLV2ClientWindow();
107 void create_objects();
108 int resize_event(int w, int h);
109 void update_selected();
110 void update_selected(float v);
111 int scalar(float f, char *rp);
112 void update(PluginLV2Client_Opt *opt);
114 PluginLV2Client *plugin;
115 PluginLV2ClientUI *ui;
116 PluginLV2ClientReset *reset;
117 PluginLV2ClientApply *apply;
118 PluginLV2ClientPot *pot;
119 PluginLV2ClientSlider *slider;
120 PluginLV2ClientText *text;
121 BC_Title *varbl, *range;
122 PluginLV2Client_OptPanel *panel;
123 PluginLV2Client_Opt *selected;
127 class PluginLV2Client : public PluginAClient
130 PluginLV2Client(PluginServer *server);
133 int process_realtime(int64_t size,
135 Samples *output_ptr);
136 int process_realtime(int64_t size,
138 Samples **output_ptr);
139 // Update output pointers as well
141 int is_multichannel();
144 char* to_string(char *string, const char *input);
145 void save_data(KeyFrame *keyframe);
146 void read_data(KeyFrame *keyframe);
148 int load_lv2(const char *path);
150 int open_lv2_gui(PluginLV2ClientWindow *gui);
154 void lv2_update(float *vals);
155 void lv2_set(int idx, float val);
157 PLUGIN_CLASS_MEMBERS(PluginLV2ClientConfig)
158 char title[BCSTRLEN];
159 int bfrsz, nb_in_bfrs, nb_out_bfrs;
160 float **in_buffers, **out_buffers;
162 void delete_buffers();
163 void init_plugin(int size);
164 void connect_ports();
165 static LV2_URID uri_table_map(LV2_URID_Map_Handle handle, const char *uri);
166 static const char *uri_table_unmap(LV2_URID_Map_Handle handle, LV2_URID urid);
170 const LilvPlugin *lilv;
171 int nb_inputs, nb_outputs;
174 PluginLV2UriTable uri_table;
176 LV2_Feature map_feature;
177 LV2_URID_Unmap unmap;
178 LV2_Feature unmap_feature;
179 Lv2Features features;
180 LV2_Atom_Sequence seq_in[2];
181 LV2_Atom_Sequence *seq_out;
183 LilvInstance *instance;
184 LilvNode *atom_AtomPort;
185 LilvNode *atom_Sequence;
186 LilvNode *lv2_AudioPort;
187 LilvNode *lv2_CVPort;
188 LilvNode *lv2_ControlPort;
189 LilvNode *lv2_Optional;
190 LilvNode *lv2_InputPort;
191 LilvNode *lv2_OutputPort;
192 LilvNode *powerOf2BlockLength;
193 LilvNode *fixedBlockLength;
194 LilvNode *boundedBlockLength;
196 PluginLV2ParentGUI *parent_gui;