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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
use std::mem::transmute;
use atomutils::*;
pub static LV2_ATOM_URI: &'static [u8] = b"http://lv2plug.in/ns/ext/atom\0";
pub static LV2_ATOM_PREFIX: &'static [u8] = b"http://lv2plug.in/ns/ext/atom#\0";
pub static LV2_ATOM__ATOM : &'static [u8] = b"http://lv2plug.in/ns/ext/atom#Atom\0";
pub static LV2_ATOM__ATOMPORT : &'static [u8] = b"http://lv2plug.in/ns/ext/atom#AtomPort\0";
pub static LV2_ATOM__BLANK : &'static [u8] = b"http://lv2plug.in/ns/ext/atom#Blank\0";
pub static LV2_ATOM__BOOL : &'static [u8] = b"http://lv2plug.in/ns/ext/atom#Bool\0";
pub static LV2_ATOM__CHUNK : &'static [u8] = b"http://lv2plug.in/ns/ext/atom#Chunk\0";
pub static LV2_ATOM__DOUBLE : &'static [u8] = b"http://lv2plug.in/ns/ext/atom#Double\0";
pub static LV2_ATOM__EVENT : &'static [u8] = b"http://lv2plug.in/ns/ext/atom#Event\0";
pub static LV2_ATOM__FLOAT : &'static [u8] = b"http://lv2plug.in/ns/ext/atom#Float\0";
pub static LV2_ATOM__INT : &'static [u8] = b"http://lv2plug.in/ns/ext/atom#Int\0";
pub static LV2_ATOM__LITERAL : &'static [u8] = b"http://lv2plug.in/ns/ext/atom#Literal\0";
pub static LV2_ATOM__LONG : &'static [u8] = b"http://lv2plug.in/ns/ext/atom#Long\0";
pub static LV2_ATOM__NUMBER : &'static [u8] = b"http://lv2plug.in/ns/ext/atom#Number\0";
pub static LV2_ATOM__OBJECT : &'static [u8] = b"http://lv2plug.in/ns/ext/atom#Object\0";
pub static LV2_ATOM__PATH : &'static [u8] = b"http://lv2plug.in/ns/ext/atom#Path\0";
pub static LV2_ATOM__PROPERTY : &'static [u8] = b"http://lv2plug.in/ns/ext/atom#Property\0";
pub static LV2_ATOM__RESOURCE : &'static [u8] = b"http://lv2plug.in/ns/ext/atom#Resource\0";
pub static LV2_ATOM__SEQUENCE : &'static [u8] = b"http://lv2plug.in/ns/ext/atom#Sequence\0";
pub static LV2_ATOM__SOUND : &'static [u8] = b"http://lv2plug.in/ns/ext/atom#Sound\0";
pub static LV2_ATOM__STRING : &'static [u8] = b"http://lv2plug.in/ns/ext/atom#String\0";
pub static LV2_ATOM__TUPLE : &'static [u8] = b"http://lv2plug.in/ns/ext/atom#Tuple\0";
pub static LV2_ATOM__URI : &'static [u8] = b"http://lv2plug.in/ns/ext/atom#URI\0";
pub static LV2_ATOM__URID : &'static [u8] = b"http://lv2plug.in/ns/ext/atom#URID\0";
pub static LV2_ATOM__VECTOR : &'static [u8] = b"http://lv2plug.in/ns/ext/atom#Vector\0";
pub static LV2_ATOM__ATOMTRANSFER : &'static [u8] = b"http://lv2plug.in/ns/ext/atom#atomTransfer\0";
pub static LV2_ATOM__BEATTIME : &'static [u8] = b"http://lv2plug.in/ns/ext/atom#beatTime\0";
pub static LV2_ATOM__BUFFERTYPE : &'static [u8] = b"http://lv2plug.in/ns/ext/atom#bufferType\0";
pub static LV2_ATOM__CHILDTYPE : &'static [u8] = b"http://lv2plug.in/ns/ext/atom#childType\0";
pub static LV2_ATOM__EVENTTRANSFER : &'static [u8] = b"http://lv2plug.in/ns/ext/atom#eventTransfer\0";
pub static LV2_ATOM__FRAMETIME : &'static [u8] = b"http://lv2plug.in/ns/ext/atom#frameTime\0";
pub static LV2_ATOM__SUPPORTS : &'static [u8] = b"http://lv2plug.in/ns/ext/atom#supports\0";
pub static LV2_ATOM__TIMEUNIT : &'static [u8] = b"http://lv2plug.in/ns/ext/atom#timeUnit\0";
#[repr(C)]
pub struct LV2Atom {
pub size: u32,
pub mytype: u32,
}
#[repr(C)]
pub struct LV2AtomInt {
pub atom: LV2Atom,
pub body: i32
}
#[repr(C)]
pub struct LV2AtomLong {
pub atom: LV2Atom,
pub body: i64
}
#[repr(C)]
pub struct LV2AtomFloat {
pub atom: LV2Atom,
pub body: f32
}
#[repr(C)]
pub struct LV2AtomDouble {
pub atom: LV2Atom,
pub body: f64
}
pub type LV2AtomBool = LV2AtomInt;
#[repr(C)]
pub struct LV2AtomURID {
pub atom: LV2Atom,
pub body: u32
}
#[repr(C)]
pub struct LV2AtomString {
pub atom: LV2Atom
}
#[repr(C)]
pub struct LV2AtomLiteralBody {
pub datatype: u32,
pub lang: u32
}
#[repr(C)]
pub struct LV2AtomLiteral {
pub atom: LV2Atom,
pub body: LV2AtomLiteralBody
}
#[repr(C)]
pub struct LV2AtomTuple {
pub atom: LV2Atom,
}
#[repr(C)]
pub struct LV2AtomVectorBody {
pub child_size: u32,
pub child_type: u32
}
#[repr(C)]
pub struct LV2AtomVector {
pub atom: LV2Atom,
pub body: LV2AtomVectorBody
}
#[repr(C)]
pub struct LV2AtomPropertyBody {
pub key: u32,
pub context: u32,
pub value: LV2Atom
}
#[repr(C)]
pub struct LV2AtomProperty {
pub atom: LV2Atom,
pub body: LV2AtomPropertyBody
}
#[repr(C)]
pub struct LV2AtomObjectBody {
pub id: u32,
pub otype: u32
}
#[repr(C)]
pub struct LV2AtomObject {
pub atom: LV2Atom,
pub body: LV2AtomObjectBody
}
impl LV2AtomObject {
pub unsafe fn foreach<F>(&mut self, mut closure: F) -> ()
where F: FnMut(*mut LV2AtomPropertyBody) -> bool {
let body = &(self.body);
let mut it = lv2_atom_object_begin(body);
while !lv2_atom_object_is_end(body, self.atom.size, it) {
let res = closure(it);
if res { break; }
it = lv2_atom_object_next(it);
}
}
}
#[repr(C)]
pub struct LV2AtomEvent {
pub time_in_frames: i64,
pub body: LV2Atom,
}
impl LV2AtomEvent {
pub fn time_as_frames(&self) -> i64 {
self.time_in_frames
}
pub fn time_as_beats(&self) -> f64 {
unsafe { transmute::<i64, f64>(self.time_in_frames) }
}
}
#[repr(C)]
pub struct LV2AtomSequenceBody {
pub unit: u32,
pub pad: u32,
}
#[repr(C)]
pub struct LV2AtomSequence {
pub atom: LV2Atom,
pub body: LV2AtomSequenceBody,
}
impl LV2AtomSequence {
pub unsafe fn foreach<F>(&mut self, mut closure: F) -> ()
where F: FnMut(*const LV2AtomEvent) -> () {
let body = &(self.body);
let mut it = lv2_atom_sequence_begin(body);
while !lv2_atom_sequence_is_end(body, self.atom.size, it) {
closure(it);
it = lv2_atom_sequence_next(it);
}
}
}