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