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