group selection rework, rm inv title clr, add titlebar alpha textbox, default proxy...
[goodguy/cinelerra.git] / cinelerra-5.1 / cinelerra / pluginlv2config.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 PLUGINLV2CONFIG_H
23 #define PLUGINLV2CONFIG_H
24
25 #include "arraylist.h"
26 #include "cstrdup.h"
27 #include "guicast.h"
28 #include "mutex.h"
29 #include "pluginaclient.h"
30 #include "pluginlv2.inc"
31 #include "pluginlv2config.inc"
32 #include "samples.inc"
33
34 #ifdef HAVE_LV2
35 #include <lilv/lilv.h>
36 #include <suil/suil.h>
37
38 #define NS_UI "http://lv2plug.in/ns/extensions/ui#"
39 #include <lv2/lv2plug.in/ns/extensions/ui/ui.h>
40 #include <lv2/lv2plug.in/ns/ext/atom/atom.h>
41 #include <lv2/lv2plug.in/ns/ext/urid/urid.h>
42 #include <lv2/lv2plug.in/ns/ext/state/state.h>
43 #include <lv2/lv2plug.in/ns/ext/worker/worker.h>
44 #include <lv2/lv2plug.in/ns/ext/log/log.h>
45 #include <lv2/lv2plug.in/ns/ext/options/options.h>
46 #include <lv2/lv2plug.in/ns/ext/parameters/parameters.h>
47 #include <lv2/lv2plug.in/ns/ext/buf-size/buf-size.h>
48 #include <lv2/lv2plug.in/ns/ext/uri-map/uri-map.h>
49 #include <lv2/lv2plug.in/ns/ext/data-access/data-access.h>
50
51
52 class Lv2Feature : public LV2_Feature
53 {
54 public:
55         Lv2Feature(const char *uri, void *dp) {
56                 this->URI = cstrdup(uri);  this->data = dp;
57         }
58         ~Lv2Feature() { delete [] URI; }
59 };
60 class Lv2Features : public ArrayList<Lv2Feature *>
61 {
62 public:
63         Lv2Features() {}
64         ~Lv2Features() { remove_all_objects(); }
65         operator LV2_Feature **() { return (LV2_Feature **)&values[0]; }
66 };
67
68 class PluginLV2UriTable : public ArrayList<const char *>, public Mutex
69 {
70 public:
71         PluginLV2UriTable();
72         ~PluginLV2UriTable();
73         LV2_URID map(const char *uri);
74         const char *unmap(LV2_URID urid);
75         operator LV2_URID_Map_Handle() { return (LV2_URID_Map_Handle)this; }
76 };
77
78 #endif
79
80 class PluginLV2Client_OptName : public BC_ListBoxItem
81 {
82 public:
83         PluginLV2Client_Opt *opt;
84         PluginLV2Client_OptName(PluginLV2Client_Opt *opt);
85 };
86
87 class PluginLV2Client_OptValue : public BC_ListBoxItem
88 {
89 public:
90         PluginLV2Client_Opt *opt;
91         PluginLV2Client_OptValue(PluginLV2Client_Opt *opt);
92         int update();
93 };
94
95 class PluginLV2Client_Opt
96 {
97 public:
98         int idx;
99         const char *sym;
100         PluginLV2ClientConfig *conf;
101         PluginLV2Client_OptName *item_name;
102         PluginLV2Client_OptValue *item_value;
103         float get_value();
104         const char *get_symbol();
105         void set_value(float v);
106         int update(float v);
107         const char *get_name();
108
109         PluginLV2Client_Opt(PluginLV2ClientConfig *conf, int idx);
110         ~PluginLV2Client_Opt();
111 };
112
113
114 class PluginLV2ClientConfig : public ArrayList<PluginLV2Client_Opt *>
115 {
116 public:
117         PluginLV2ClientConfig();
118         ~PluginLV2ClientConfig();
119
120         int equivalent(PluginLV2ClientConfig &that);
121         void copy_from(PluginLV2ClientConfig &that);
122         void interpolate(PluginLV2ClientConfig &prev, PluginLV2ClientConfig &next,
123                 int64_t prev_frame, int64_t next_frame, int64_t current_frame);
124         void reset();
125         void init_lv2(const LilvPlugin *lilv, PluginLV2 *lv2);
126         int update();
127         void dump(FILE *fp);
128
129         int nb_ports, *ports;
130         const char **names, **syms;
131         float *mins, *maxs, *ctls;
132 };
133
134 #endif