-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlv2-ecl-internal.h
78 lines (57 loc) · 2.16 KB
/
lv2-ecl-internal.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
#ifndef _LV2_ECL_H
#define _LV2_ECL_H
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ecl/ecl.h>
#include "lv2/lv2plug.in/ns/lv2core/lv2.h"
#define TRUE 1
#define FALSE 0
// What I return as an index for things in arrays when I can't find a good one.
#define NONE -1
// I choose to use arrays for things instead of hash-tables. This reduces the
// code I have to write, but introduces limitations to the number of existing
// objects.
// There can be this many total descriptors
#define NUM_DESCRIPTORS 1024
// Each descriptr can make this number of instances of something.
#define NUM_INSTANCES (1024 * NUM_DESCRIPTORS)
typedef struct _DescAssoc
{
int initialized;
// The C descriptor we're going to give to the caller.
LV2_Descriptor lv2_desc;
// The association with the lisp version of it.
cl_object lisp_lv2_desc;
} DescAssoc;
// We need to reverse map an LV2_Handle to the LV2_Description type which
// ultimately produced it.
typedef struct _HandleDescAssoc
{
int initialized;
// Which index in the DescAssoc array made this instance?
int lv2_desc_index;
// When we finally return an instance handle back to the host, it'll be
// this one as it is uniquely initialized per structure. Later, we'll use
// it to remap the handle back to the lisp_handle and the lv2_desc_index.
LV2_Handle handle;
// The real instance handle as returned from the lisp plguin.
cl_object lisp_handle;
} HandleDescAssoc;
// Needed plugin prototypes
const LV2_Descriptor* lv2_descriptor(uint32_t index);
static LV2_Handle instantiate(const LV2_Descriptor *descriptor,
double rate, const char* bundle_path,
const LV2_Feature* const* features);
static void connect_port(LV2_Handle instance, uint32_t port, void *data);
static void activate(LV2_Handle instance);
static void run(LV2_Handle instance, uint32_t n_samples);
static void deactivate(LV2_Handle instance);
static void cleanup(LV2_Handle instance);
static const void* extension_data(const char* uri);
// Stuff internal to the plugin
// Stuff to mess with the DescAssoc
static int da_allocate(void);
static void da_associate(int index, cl_object lisp_obj);
static LV2_Descriptor* da_get_address(int index);
#endif