connect lv2 output controls
[goodguy/history.git] / cinelerra-5.1 / cinelerra / pluginlv2.h
1 #ifndef __PLUGINLV2_H__
2 #define __PLUGINLV2_H__
3
4 #define LV2_SEQ_SIZE  9624
5 #include "forkbase.h"
6 #include "pluginlv2config.h"
7 #include "samples.inc"
8
9 #include <lilv/lilv.h>
10 #define NS_EXT "http://lv2plug.in/ns/ext/"
11
12 typedef struct {
13         int64_t sz;
14         int samples, done;
15         int nb_inputs, nb_outputs;
16 } shm_bfr_t;
17
18 #define PORTS_AUDIO   0x01
19 #define PORTS_CONTROL 0x02
20 #define PORTS_ATOM    0x04
21 #define PORTS_ALL (PORTS_AUDIO | PORTS_CONTROL | PORTS_ATOM)
22 #define PORTS_INPUT   0x08
23 #define PORTS_OUTPUT  0x10
24 #define PORTS_UPDATE  0x20
25
26 class PluginLV2
27 {
28 public:
29         PluginLV2();
30         virtual ~PluginLV2();
31
32         shm_bfr_t *shm_bfr;
33         int use_shm, shmid;
34         float **in_buffers, **out_buffers;
35         int *iport, *oport;
36         int nb_inputs, nb_outputs;
37         int max_bufsz, ui_features;
38
39         void reset_lv2();
40         int load_lv2(const char *path,char *title=0);
41         int init_lv2(PluginLV2ClientConfig &conf, int sample_rate);
42
43         static LV2_URID uri_table_map(LV2_URID_Map_Handle handle, const char *uri);
44         static const char *uri_table_unmap(LV2_URID_Map_Handle handle, LV2_URID urid);
45         void connect_ports(PluginLV2ClientConfig &conf, int ports);
46         void del_buffer();
47         void new_buffer(int64_t sz);
48         shm_bfr_t *shm_buffer(int shmid);
49         void init_buffer(int samples);
50         void map_buffer();
51
52         LilvWorld         *world;
53         const LilvPlugin  *lilv;
54         LilvUIs           *lilv_uis;
55
56         PluginLV2UriTable  uri_table;
57         LV2_URID_Map       map;
58         LV2_Feature        map_feature;
59         LV2_URID_Unmap     unmap;
60         LV2_Feature        unmap_feature;
61         Lv2Features        features;
62         LV2_Atom_Sequence  seq_in[2];
63         LV2_Atom_Sequence  *seq_out;
64
65         LilvInstance *inst;
66         SuilInstance *sinst;
67         SuilHost *ui_host;
68
69         LilvNode *atom_AtomPort;
70         LilvNode *atom_Sequence;
71         LilvNode *lv2_AudioPort;
72         LilvNode *lv2_CVPort;
73         LilvNode *lv2_ControlPort;
74         LilvNode *lv2_Optional;
75         LilvNode *lv2_InputPort;
76         LilvNode *lv2_OutputPort;
77         LilvNode *powerOf2BlockLength;
78         LilvNode *fixedBlockLength;
79         LilvNode *boundedBlockLength;
80 };
81
82 typedef struct { int sample_rate;  char path[1]; } open_bfr_t;
83
84 enum { NO_COMMAND,
85         LV2_OPEN,
86         LV2_LOAD,
87         LV2_UPDATE,
88         LV2_SHOW,
89         LV2_HIDE,
90         LV2_SHMID,
91         NB_COMMANDS };
92
93 #endif