1 /*
2 * Copyright (c) 2015-2016 Hanspeter Portner (dev@open-music-kontrollers.ch)
3 *
4 * This is free software: you can redistribute it and/or modify
5 * it under the terms of the Artistic License 2.0 as published by
6 * The Perl Foundation.
7 *
8 * This source is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * Artistic License 2.0 for more details.
12 *
13 * You should have received a copy of the Artistic License 2.0
14 * along the source as a COPYING file. If not, obtain it from
15 * http://www.perlfoundation.org/artistic_license_2_0.
16 */
17
18 #ifndef _SYNTHPOD_PRIVATE_H
19 #define _SYNTHPOD_PRIVATE_H
20
21 #define SYNTHPOD_WORLD SYNTHPOD_PREFIX"world"
22
23 #if defined(HAS_BUILTIN_ASSUME_ALIGNED)
24 # define ASSUME_ALIGNED(PTR) __builtin_assume_aligned((PTR), 8)
25 #else
26 # define ASSUME_ALIGNED(PTR) (PTR)
27 #endif
28
29 #include <lilv/lilv.h>
30
31 #include <lv2/lv2plug.in/ns/lv2core/lv2.h>
32 #include <lv2/lv2plug.in/ns/ext/urid/urid.h>
33 #include <lv2/lv2plug.in/ns/ext/uri-map/uri-map.h>
34 #include <lv2/lv2plug.in/ns/ext/midi/midi.h>
35 #include <lv2/lv2plug.in/ns/ext/log/log.h>
36 #include <lv2/lv2plug.in/ns/ext/worker/worker.h>
37 #include <lv2/lv2plug.in/ns/ext/buf-size/buf-size.h>
38 #include <lv2/lv2plug.in/ns/ext/resize-port/resize-port.h>
39 #include <lv2/lv2plug.in/ns/ext/presets/presets.h>
40 #include <lv2/lv2plug.in/ns/ext/patch/patch.h>
41 #include <lv2/lv2plug.in/ns/ext/port-props/port-props.h>
42 #include <lv2/lv2plug.in/ns/ext/port-groups/port-groups.h>
43 #include <lv2/lv2plug.in/ns/ext/state/state.h>
44 #include <lv2/lv2plug.in/ns/ext/time/time.h>
45 #include <lv2/lv2plug.in/ns/ext/parameters/parameters.h>
46 #include <lv2/lv2plug.in/ns/ext/instance-access/instance-access.h>
47 #include <lv2/lv2plug.in/ns/ext/data-access/data-access.h>
48 #include <lv2/lv2plug.in/ns/extensions/ui/ui.h>
49 #include <lv2/lv2plug.in/ns/extensions/units/units.h>
50 #include <lv2_external_ui.h> // kxstudio kx-ui extension
51 #include <lv2_extensions.h> // ardour inline display
52
53 #include <osc.lv2/osc.h>
54 #include <canvas.lv2/canvas.h>
55
56 typedef enum _port_type_t port_type_t;
57 typedef enum _port_atom_type_t port_atom_type_t;
58 typedef enum _port_buffer_type_t port_buffer_type_t;
59 typedef enum _port_direction_t port_direction_t;
60 typedef enum _port_protocol_t port_protocol_t;
61
62 enum _port_type_t {
63 PORT_TYPE_AUDIO,
64 PORT_TYPE_CONTROL,
65 PORT_TYPE_CV,
66 PORT_TYPE_ATOM,
67
68 PORT_TYPE_NUM
69 };
70
71 enum _port_atom_type_t {
72 PORT_ATOM_TYPE_ALL = 0,
73
74 PORT_ATOM_TYPE_MIDI = (1 << 0),
75 PORT_ATOM_TYPE_OSC = (1 << 1),
76 PORT_ATOM_TYPE_TIME = (1 << 2),
77 PORT_ATOM_TYPE_PATCH = (1 << 3),
78 PORT_ATOM_TYPE_XPRESS = (1 << 4)
79 };
80
81 enum _port_buffer_type_t {
82 PORT_BUFFER_TYPE_NONE = 0,
83 PORT_BUFFER_TYPE_SEQUENCE,
84
85 PORT_BUFFER_TYPE_NUM
86 };
87
88 enum _port_direction_t {
89 PORT_DIRECTION_INPUT = 0,
90 PORT_DIRECTION_OUTPUT,
91
92 PORT_DIRECTION_NUM
93 };
94
95 enum _port_protocol_t {
96 PORT_PROTOCOL_FLOAT = 0,
97 PORT_PROTOCOL_PEAK,
98 PORT_PROTOCOL_ATOM,
99 PORT_PROTOCOL_SEQUENCE,
100
101 PORT_PROTOCOL_NUM
102 }; //TODO use this
103
104 typedef int32_t u_id_t;
105 typedef struct _reg_item_t reg_item_t;
106 typedef struct _reg_t reg_t;
107
108 struct _reg_item_t {
109 LilvNode *node;
110 LV2_URID urid;
111 };
112
113 struct _reg_t {
114 struct {
115 reg_item_t input;
116 reg_item_t output;
117
118 reg_item_t control;
119 reg_item_t audio;
120 reg_item_t cv;
121 reg_item_t atom;
122
123 // atom buffer type
124 reg_item_t sequence;
125
126 // atom sequence event types
127 reg_item_t midi;
128 reg_item_t osc_event;
129 reg_item_t time_position;
130
131 // control port property
132 reg_item_t integer;
133 reg_item_t enumeration;
134 reg_item_t toggled;
135 reg_item_t is_bitmask;
136
137 // port protocols
138 reg_item_t float_protocol;
139 reg_item_t peak_protocol;
140 reg_item_t atom_transfer;
141 reg_item_t event_transfer;
142
143 reg_item_t notification;
144 reg_item_t minimum_size;
145
146 // properties
147 reg_item_t logarithmic;
148 } port;
149
150 struct {
151 reg_item_t message;
152 reg_item_t path;
153 } osc;
154
155 struct {
156 reg_item_t property;
157 } parameter;
158
159 struct {
160 reg_item_t schedule;
161 } work;
162
163 struct {
164 reg_item_t entry;
165 reg_item_t error;
166 reg_item_t note;
167 reg_item_t trace;
168 reg_item_t warning;
169 } log;
170
171 struct {
172 reg_item_t window_title;
173 reg_item_t show_interface;
174 reg_item_t idle_interface;
175 reg_item_t kx_widget;
176 reg_item_t external;
177 reg_item_t x11;
178 reg_item_t gtk2;
179 reg_item_t gtk3;
180 reg_item_t qt4;
181 reg_item_t qt5;
182 reg_item_t plugin;
183 reg_item_t protocol;
184 reg_item_t period_start;
185 reg_item_t period_size;
186 reg_item_t peak;
187 reg_item_t port_subscribe;
188 reg_item_t port_index;
189 reg_item_t update_rate;
190 reg_item_t instance_access;
191 reg_item_t data_access;
192 reg_item_t ui;
193 } ui;
194
195 struct {
196 reg_item_t preset;
197 reg_item_t preset_bank;
198 reg_item_t bank;
199 } pset;
200
201 struct {
202 reg_item_t value;
203 reg_item_t type;
204 reg_item_t subject;
205 } rdf;
206
207 struct {
208 reg_item_t label;
209 reg_item_t range;
210 reg_item_t comment;
211 reg_item_t see_also;
212 } rdfs;
213
214 struct {
215 reg_item_t license;
216 reg_item_t name;
217 } doap;
218
219 struct {
220 reg_item_t optional_feature;
221 reg_item_t required_feature;
222 reg_item_t name;
223 reg_item_t minor_version;
224 reg_item_t micro_version;
225 reg_item_t extension_data;
226 reg_item_t control;
227 reg_item_t symbol;
228 reg_item_t index;
229 reg_item_t minimum;
230 reg_item_t maximum;
231 reg_item_t scale_point;
232 reg_item_t port;
233 reg_item_t Port;
234 reg_item_t plugin;
235 reg_item_t applies_to;
236 reg_item_t designation;
237 } core;
238
239 struct {
240 reg_item_t sample_rate;
241 reg_item_t gain;
242 } param;
243
244 struct {
245 reg_item_t nominal_block_length;
246 reg_item_t max_block_length;
247 reg_item_t min_block_length;
248 reg_item_t sequence_size;
249 } bufsz;
250
251 struct {
252 reg_item_t writable;
253 reg_item_t readable;
254 reg_item_t message;
255 reg_item_t set;
256 reg_item_t get;
257 reg_item_t subject;
258 reg_item_t body;
259 reg_item_t property;
260 reg_item_t value;
261 reg_item_t wildcard;
262 reg_item_t patch;
263 reg_item_t add;
264 reg_item_t remove;
265 reg_item_t put;
266 reg_item_t insert;
267 reg_item_t delete;
268 reg_item_t destination;
269 reg_item_t copy;
270 reg_item_t move;
271 reg_item_t sequence_number;
272 reg_item_t error;
273 reg_item_t ack;
274 } patch;
275
276 struct {
277 reg_item_t message;
278 } xpress;
279
280 struct {
281 reg_item_t graph;
282 } canvas;
283
284 struct {
285 reg_item_t group;
286 reg_item_t left;
287 reg_item_t right;
288 reg_item_t center;
289 reg_item_t side;
290 reg_item_t center_left;
291 reg_item_t center_right;
292 reg_item_t side_left;
293 reg_item_t side_right;
294 reg_item_t rear_left;
295 reg_item_t rear_right;
296 reg_item_t rear_center;
297 reg_item_t low_frequency_effects;
298 } group;
299
300 struct {
301 // properties
302 reg_item_t conversion;
303 reg_item_t prefixConversion;
304 reg_item_t render;
305 reg_item_t symbol;
306 reg_item_t unit;
307 reg_item_t Unit;
308
309 // instances;
310 reg_item_t bar;
311 reg_item_t beat;
312 reg_item_t bpm;
313 reg_item_t cent;
314 reg_item_t cm;
315 reg_item_t coef;
316 reg_item_t db;
317 reg_item_t degree;
318 reg_item_t frame;
319 reg_item_t hz;
320 reg_item_t inch;
321 reg_item_t khz;
322 reg_item_t km;
323 reg_item_t m;
324 reg_item_t mhz;
325 reg_item_t midiNote;
326 reg_item_t midiController;
327 reg_item_t mile;
328 reg_item_t min;
329 reg_item_t mm;
330 reg_item_t ms;
331 reg_item_t oct;
332 reg_item_t pc;
333 reg_item_t s;
334 reg_item_t semitone12TET;
335 } units;
336
337 struct {
338 reg_item_t state;
339 reg_item_t load_default_state;
340 reg_item_t thread_safe_restore;
341 } state;
342
343 struct {
344 reg_item_t payload;
345 reg_item_t state;
346 reg_item_t graph;
347 reg_item_t null;
348 reg_item_t stereo;
349 reg_item_t monoatom;
350
351 reg_item_t module_list;
352 reg_item_t module_supported;
353 reg_item_t module_add;
354 reg_item_t module_del;
355 reg_item_t module_move;
356 reg_item_t module_preset_load;
357 reg_item_t module_preset_save;
358 reg_item_t module_visible;
359 reg_item_t module_disabled;
360 reg_item_t module_profiling;
361 reg_item_t module_position_x;
362 reg_item_t module_position_y;
363 reg_item_t module_alias;
364 reg_item_t module_reinstantiate;
365 reg_item_t node_position_x;
366 reg_item_t node_position_y;
367 reg_item_t graph_position_x;
368 reg_item_t graph_position_y;
369 reg_item_t column_enabled;
370 reg_item_t row_enabled;
371 reg_item_t port_refresh;
372 reg_item_t bundle_load;
373 reg_item_t bundle_save;
374 reg_item_t path_get;
375 reg_item_t dsp_profiling;
376 reg_item_t cpus_available;
377 reg_item_t cpus_used;
378 reg_item_t period_size;
379 reg_item_t num_periods;
380 reg_item_t quit;
381
382 reg_item_t system_ports;
383 reg_item_t control_port;
384 reg_item_t audio_port;
385 reg_item_t cv_port;
386 reg_item_t midi_port;
387 reg_item_t osc_port;
388 reg_item_t com_port;
389
390 reg_item_t subscription_list;
391 reg_item_t notification_list;
392 reg_item_t automation_list;
393 reg_item_t connection_list;
394 reg_item_t node_list;
395
396 reg_item_t source_module;
397 reg_item_t source_symbol;
398 reg_item_t sink_module;
399 reg_item_t sink_symbol;
400
401 reg_item_t source_min;
402 reg_item_t source_max;
403 reg_item_t sink_min;
404 reg_item_t sink_max;
405
406 reg_item_t source_enabled;
407 reg_item_t sink_enabled;
408 reg_item_t learning;
409
410 reg_item_t placeholder;
411 } synthpod;
412
413 struct {
414 reg_item_t Controller;
415 reg_item_t channel;
416 reg_item_t controller_number;
417 } midi;
418
419 struct {
420 reg_item_t surface;
421 } idisp;
422 };
423
424 static inline void
_register(reg_item_t * itm,LilvWorld * world,LV2_URID_Map * map,const char * uri)425 _register(reg_item_t *itm, LilvWorld *world, LV2_URID_Map *map, const char *uri)
426 {
427 itm->node = lilv_new_uri(world, uri);
428 itm->urid = map->map(map->handle, uri);
429 }
430
431 static inline void
_register_string(reg_item_t * itm,LilvWorld * world,LV2_URID_Map * map,const char * uri)432 _register_string(reg_item_t *itm, LilvWorld *world, LV2_URID_Map *map, const char *uri)
433 {
434 itm->node = lilv_new_string(world, uri);
435 itm->urid = map->map(map->handle, uri);
436 }
437
438 static inline void
_unregister(reg_item_t * itm)439 _unregister(reg_item_t *itm)
440 {
441 if(itm->node)
442 lilv_node_free(itm->node);
443 }
444
445 static inline void
sp_regs_init(reg_t * regs,LilvWorld * world,LV2_URID_Map * map)446 sp_regs_init(reg_t *regs, LilvWorld *world, LV2_URID_Map *map)
447 {
448 _register(®s->port.input, world, map, LV2_CORE__InputPort);
449 _register(®s->port.output, world, map, LV2_CORE__OutputPort);
450
451 _register(®s->port.control, world, map, LV2_CORE__ControlPort);
452 _register(®s->port.audio, world, map, LV2_CORE__AudioPort);
453 _register(®s->port.cv, world, map, LV2_CORE__CVPort);
454 _register(®s->port.atom, world, map, LV2_ATOM__AtomPort);
455
456 _register(®s->port.sequence, world, map, LV2_ATOM__Sequence);
457 _register(®s->port.midi, world, map, LV2_MIDI__MidiEvent);
458 _register(®s->port.osc_event, world, map, LV2_OSC__Event);
459 _register(®s->port.time_position, world, map, LV2_TIME__Position);
460
461 _register(®s->port.integer, world, map, LV2_CORE__integer);
462 _register(®s->port.enumeration, world, map, LV2_CORE__enumeration);
463 _register(®s->port.toggled, world, map, LV2_CORE__toggled);
464 _register(®s->port.is_bitmask, world, map, LV2_CORE_PREFIX"isBitmask");
465
466 _register(®s->port.float_protocol, world, map, LV2_UI_PREFIX"floatProtocol");
467 _register(®s->port.peak_protocol, world, map, LV2_UI_PREFIX"peakProtocol");
468 _register(®s->port.atom_transfer, world, map, LV2_ATOM__atomTransfer);
469 _register(®s->port.event_transfer, world, map, LV2_ATOM__eventTransfer);
470 _register(®s->port.notification, world, map, LV2_UI__portNotification);
471
472 _register(®s->port.minimum_size, world, map, LV2_RESIZE_PORT__minimumSize);
473
474 _register(®s->port.logarithmic, world, map, LV2_PORT_PROPS__logarithmic);
475
476 _register(®s->parameter.property, world, map, LV2_CORE_PREFIX"parameterProperty");
477
478 _register(®s->osc.message, world, map, LV2_OSC__Message);
479 _register(®s->osc.path, world, map, LV2_OSC__messagePath);
480
481 _register(®s->work.schedule, world, map, LV2_WORKER__schedule);
482
483 _register(®s->log.entry, world, map, LV2_LOG__Entry);
484 _register(®s->log.error, world, map, LV2_LOG__Error);
485 _register(®s->log.note, world, map, LV2_LOG__Note);
486 _register(®s->log.trace, world, map, LV2_LOG__Trace);
487 _register(®s->log.warning, world, map, LV2_LOG__Warning);
488
489 _register(®s->ui.window_title, world, map, LV2_UI__windowTitle);
490 _register(®s->ui.show_interface, world, map, LV2_UI__showInterface);
491 _register(®s->ui.idle_interface, world, map, LV2_UI__idleInterface);
492 _register(®s->ui.kx_widget, world, map, LV2_EXTERNAL_UI__Widget);
493 _register(®s->ui.external, world, map, LV2_EXTERNAL_UI_DEPRECATED_URI);
494 _register(®s->ui.x11, world, map, LV2_UI__X11UI);
495 _register(®s->ui.gtk2, world, map, LV2_UI__GtkUI);
496 _register(®s->ui.gtk3, world, map, LV2_UI__Gtk3UI);
497 _register(®s->ui.qt4, world, map, LV2_UI__Qt4UI);
498 _register(®s->ui.qt5, world, map, LV2_UI_PREFIX"Qt5UI");
499 _register(®s->ui.plugin, world, map, LV2_UI__plugin);
500 _register(®s->ui.protocol, world, map, LV2_UI_PREFIX"protocol");
501 _register(®s->ui.period_start, world, map, LV2_UI_PREFIX"periodStart");
502 _register(®s->ui.period_size, world, map, LV2_UI_PREFIX"periodSize");
503 _register(®s->ui.peak, world, map, LV2_UI_PREFIX"peak");
504 _register(®s->ui.port_subscribe, world, map, LV2_UI__portSubscribe);
505 _register(®s->ui.port_index, world, map, LV2_UI__portIndex);
506 _register(®s->ui.update_rate, world, map, LV2_UI__updateRate);
507 _register(®s->ui.instance_access, world, map, LV2_INSTANCE_ACCESS_URI);
508 _register(®s->ui.data_access, world, map, LV2_DATA_ACCESS_URI);
509 _register(®s->ui.ui, world, map, LV2_UI__ui);
510
511 #ifndef LV2_PRESETS__bank
512 # define LV2_PRESETS__bank LV2_PRESETS_PREFIX "bank"
513 #endif
514 #ifndef LV2_PRESETS__Bank
515 # define LV2_PRESETS__Bank LV2_PRESETS_PREFIX "Bank"
516 #endif
517 _register(®s->pset.preset, world, map, LV2_PRESETS__Preset);
518 _register(®s->pset.preset_bank, world, map, LV2_PRESETS__bank);
519 _register(®s->pset.bank, world, map, LV2_PRESETS__Bank);
520
521 _register(®s->rdf.value, world, map, LILV_NS_RDF"value");
522 _register(®s->rdf.type, world, map, LILV_NS_RDF"type");
523 _register(®s->rdf.subject, world, map, LILV_NS_RDF"subject");
524
525 _register(®s->rdfs.label, world, map, LILV_NS_RDFS"label");
526 _register(®s->rdfs.range, world, map, LILV_NS_RDFS"range");
527 _register(®s->rdfs.comment, world, map, LILV_NS_RDFS"comment");
528 _register(®s->rdfs.see_also, world, map, LILV_NS_RDFS"seeAlso");
529
530 _register(®s->doap.license, world, map, LILV_NS_DOAP"license");
531 _register(®s->doap.name, world, map, LILV_NS_DOAP"name");
532
533 _register(®s->core.optional_feature, world, map, LV2_CORE__optionalFeature);
534 _register(®s->core.required_feature, world, map, LV2_CORE__requiredFeature);
535 _register(®s->core.name, world, map, LV2_CORE__name);
536 _register(®s->core.minor_version, world, map, LV2_CORE__minorVersion);
537 _register(®s->core.micro_version, world, map, LV2_CORE__microVersion);
538 _register(®s->core.extension_data, world, map, LV2_CORE__extensionData);
539 _register(®s->core.control, world, map, LV2_CORE__control);
540 _register(®s->core.symbol, world, map, LV2_CORE__symbol);
541 _register(®s->core.index, world, map, LV2_CORE__index);
542 _register(®s->core.minimum, world, map, LV2_CORE__minimum);
543 _register(®s->core.maximum, world, map, LV2_CORE__maximum);
544 _register(®s->core.scale_point, world, map, LV2_CORE__scalePoint);
545 _register(®s->core.port, world, map, LV2_CORE__port);
546 _register(®s->core.Port, world, map, LV2_CORE__Port);
547 _register(®s->core.plugin, world, map, LV2_CORE__Plugin);
548 _register(®s->core.applies_to, world, map, LV2_CORE__appliesTo);
549 _register(®s->core.designation, world, map, LV2_CORE__designation);
550
551 _register(®s->param.sample_rate, world, map, LV2_PARAMETERS__sampleRate);
552 _register(®s->param.gain, world, map, LV2_PARAMETERS__gain);
553
554 _register(®s->bufsz.nominal_block_length, world, map, LV2_BUF_SIZE_PREFIX "nominalBlockLength");
555 _register(®s->bufsz.max_block_length, world, map, LV2_BUF_SIZE__maxBlockLength);
556 _register(®s->bufsz.min_block_length, world, map, LV2_BUF_SIZE__minBlockLength);
557 _register(®s->bufsz.sequence_size, world, map, LV2_BUF_SIZE__sequenceSize);
558
559 _register(®s->patch.writable, world, map, LV2_PATCH__writable);
560 _register(®s->patch.readable, world, map, LV2_PATCH__readable);
561 _register(®s->patch.message, world, map, LV2_PATCH__Message);
562 _register(®s->patch.set, world, map, LV2_PATCH__Set);
563 _register(®s->patch.get, world, map, LV2_PATCH__Get);
564 _register(®s->patch.subject, world, map, LV2_PATCH__subject);
565 _register(®s->patch.body, world, map, LV2_PATCH__body);
566 _register(®s->patch.property, world, map, LV2_PATCH__property);
567 _register(®s->patch.value, world, map, LV2_PATCH__value);
568 _register(®s->patch.wildcard, world, map, LV2_PATCH__wildcard);
569 _register(®s->patch.patch, world, map, LV2_PATCH__Patch);
570 _register(®s->patch.add, world, map, LV2_PATCH__add);
571 _register(®s->patch.remove, world, map, LV2_PATCH__remove);
572 _register(®s->patch.put, world, map, LV2_PATCH__Put);
573 _register(®s->patch.insert, world, map, LV2_PATCH_PREFIX "Insert");
574 _register(®s->patch.delete, world, map, LV2_PATCH_PREFIX "Delete");
575 _register(®s->patch.destination, world, map, LV2_PATCH__destination);
576 _register(®s->patch.copy, world, map, LV2_PATCH__Copy);
577 _register(®s->patch.move, world, map, LV2_PATCH__Move);
578 _register(®s->patch.sequence_number, world, map, LV2_PATCH__sequenceNumber);
579 _register(®s->patch.error, world, map, LV2_PATCH__Error);
580 _register(®s->patch.ack, world, map, LV2_PATCH__Ack);
581
582 _register(®s->xpress.message, world, map, "http://open-music-kontrollers.ch/lv2/xpress#Message");
583
584 _register(®s->canvas.graph, world, map, CANVAS__graph);
585
586 _register(®s->group.group, world, map, LV2_PORT_GROUPS__group);
587 _register(®s->group.left, world, map, LV2_PORT_GROUPS__left);
588 _register(®s->group.right, world, map, LV2_PORT_GROUPS__right);
589 _register(®s->group.center, world, map, LV2_PORT_GROUPS__center);
590 _register(®s->group.side, world, map, LV2_PORT_GROUPS__side);
591 _register(®s->group.center_left, world, map, LV2_PORT_GROUPS__centerLeft);
592 _register(®s->group.center_right, world, map, LV2_PORT_GROUPS__centerRight);
593 _register(®s->group.side_left, world, map, LV2_PORT_GROUPS__sideLeft);
594 _register(®s->group.side_right, world, map, LV2_PORT_GROUPS__sideRight);
595 _register(®s->group.rear_left, world, map, LV2_PORT_GROUPS__rearLeft);
596 _register(®s->group.rear_right, world, map, LV2_PORT_GROUPS__rearRight);
597 _register(®s->group.rear_center, world, map, LV2_PORT_GROUPS__rearCenter);
598 _register(®s->group.low_frequency_effects, world, map, LV2_PORT_GROUPS__lowFrequencyEffects);
599
600 _register(®s->units.conversion, world, map, LV2_UNITS__conversion);
601 _register(®s->units.prefixConversion, world, map, LV2_UNITS__prefixConversion);
602 _register(®s->units.render, world, map, LV2_UNITS__render);
603 _register(®s->units.symbol, world, map, LV2_UNITS__symbol);
604 _register(®s->units.unit, world, map, LV2_UNITS__unit);
605 _register(®s->units.Unit, world, map, LV2_UNITS__Unit);
606 _register(®s->units.bar, world, map, LV2_UNITS__bar);
607 _register(®s->units.beat, world, map, LV2_UNITS__beat);
608 _register(®s->units.bpm, world, map, LV2_UNITS__bpm);
609 _register(®s->units.cent, world, map, LV2_UNITS__cent);
610 _register(®s->units.cm, world, map, LV2_UNITS__cm);
611 _register(®s->units.coef, world, map, LV2_UNITS__coef);
612 _register(®s->units.db, world, map, LV2_UNITS__db);
613 _register(®s->units.degree, world, map, LV2_UNITS__degree);
614 _register(®s->units.frame, world, map, LV2_UNITS__frame);
615 _register(®s->units.hz, world, map, LV2_UNITS__hz);
616 _register(®s->units.inch, world, map, LV2_UNITS__inch);
617 _register(®s->units.khz, world, map, LV2_UNITS__khz);
618 _register(®s->units.km, world, map, LV2_UNITS__km);
619 _register(®s->units.m, world, map, LV2_UNITS__m);
620 _register(®s->units.mhz, world, map, LV2_UNITS__mhz);
621 _register(®s->units.midiNote, world, map, LV2_UNITS__midiNote);
622 _register(®s->units.midiController, world, map, LV2_UNITS_PREFIX"midiController");
623 _register(®s->units.mile, world, map, LV2_UNITS__mile);
624 _register(®s->units.min, world, map, LV2_UNITS__min);
625 _register(®s->units.mm, world, map, LV2_UNITS__mm);
626 _register(®s->units.ms, world, map, LV2_UNITS__ms);
627 _register(®s->units.oct, world, map, LV2_UNITS__oct);
628 _register(®s->units.pc, world, map, LV2_UNITS__pc);
629 _register(®s->units.s, world, map, LV2_UNITS__s);
630 _register(®s->units.semitone12TET, world, map, LV2_UNITS__semitone12TET);
631
632 _register(®s->state.state, world, map, LV2_STATE__state);
633 _register(®s->state.load_default_state, world, map, LV2_STATE__loadDefaultState);
634 #ifndef LV2_STATE__threadSafeRestore
635 # define LV2_STATE__threadSafeRestore LV2_STATE_PREFIX "threadSafeRestore"
636 #endif
637 _register(®s->state.thread_safe_restore, world, map, LV2_STATE__threadSafeRestore);
638
639 _register(®s->synthpod.payload, world, map, SYNTHPOD_PREFIX"payload");
640 _register_string(®s->synthpod.state, world, map, "state.ttl");
641 _register(®s->synthpod.graph, world, map, SYNTHPOD_PREFIX"graph");
642 _register_string(®s->synthpod.null, world, map, "");
643 _register(®s->synthpod.stereo, world, map, SYNTHPOD_PREFIX"stereo");
644 _register(®s->synthpod.monoatom, world, map, SYNTHPOD_PREFIX"monoatom");
645 _register(®s->synthpod.module_list, world, map, SYNTHPOD_PREFIX"moduleList");
646 _register(®s->synthpod.module_supported, world, map, SYNTHPOD_PREFIX"moduleSupported");
647 _register(®s->synthpod.module_add, world, map, SYNTHPOD_PREFIX"moduleAdd");
648 _register(®s->synthpod.module_del, world, map, SYNTHPOD_PREFIX"moduleDel");
649 _register(®s->synthpod.module_move, world, map, SYNTHPOD_PREFIX"moduleMove");
650 _register(®s->synthpod.module_preset_load, world, map, SYNTHPOD_PREFIX"modulePresetLoad");
651 _register(®s->synthpod.module_preset_save, world, map, SYNTHPOD_PREFIX"modulePresetSave");
652 _register(®s->synthpod.module_visible, world, map, SYNTHPOD_PREFIX"moduleVisible");
653 _register(®s->synthpod.module_disabled, world, map, SYNTHPOD_PREFIX"moduleDisabled");
654 _register(®s->synthpod.module_profiling, world, map, SYNTHPOD_PREFIX"moduleProfiling");
655 _register(®s->synthpod.module_position_x, world, map, SYNTHPOD_PREFIX"modulePositionX");
656 _register(®s->synthpod.module_position_y, world, map, SYNTHPOD_PREFIX"modulePositionY");
657 _register(®s->synthpod.module_alias, world, map, SYNTHPOD_PREFIX"moduleAlias");
658 _register(®s->synthpod.module_reinstantiate, world, map, SYNTHPOD_PREFIX"moduleReinstantiate");
659 _register(®s->synthpod.node_position_x, world, map, SYNTHPOD_PREFIX"nodePositionX");
660 _register(®s->synthpod.node_position_y, world, map, SYNTHPOD_PREFIX"nodePositionY");
661 _register(®s->synthpod.graph_position_x, world, map, SYNTHPOD_PREFIX"graphPositionX");
662 _register(®s->synthpod.graph_position_y, world, map, SYNTHPOD_PREFIX"graphPositionY");
663 _register(®s->synthpod.column_enabled, world, map, SYNTHPOD_PREFIX"columnEnabled");
664 _register(®s->synthpod.row_enabled, world, map, SYNTHPOD_PREFIX"rowEnabled");
665 _register(®s->synthpod.port_refresh, world, map, SYNTHPOD_PREFIX"portRefresh");
666 _register(®s->synthpod.bundle_load, world, map, SYNTHPOD_PREFIX"bundleLoad");
667 _register(®s->synthpod.bundle_save, world, map, SYNTHPOD_PREFIX"bundleSave");
668 _register(®s->synthpod.path_get, world, map, SYNTHPOD_PREFIX"pathGet");
669 _register(®s->synthpod.dsp_profiling, world, map, SYNTHPOD_PREFIX"DSPProfiling");
670 _register(®s->synthpod.cpus_available, world, map, SYNTHPOD_PREFIX"CPUsAvailable");
671 _register(®s->synthpod.cpus_used, world, map, SYNTHPOD_PREFIX"CPUsUsed");
672 _register(®s->synthpod.period_size, world, map, SYNTHPOD_PREFIX"periodSize");
673 _register(®s->synthpod.num_periods, world, map, SYNTHPOD_PREFIX"numPeriods");
674 _register(®s->synthpod.quit, world, map, SYNTHPOD_PREFIX"quit");
675
676 _register(®s->synthpod.system_ports, world, map, SYNTHPOD_PREFIX"systemPorts");
677 _register(®s->synthpod.control_port, world, map, SYNTHPOD_PREFIX"ControlPort");
678 _register(®s->synthpod.audio_port, world, map, SYNTHPOD_PREFIX"AudioPort");
679 _register(®s->synthpod.cv_port, world, map, SYNTHPOD_PREFIX"CVPort");
680 _register(®s->synthpod.midi_port, world, map, SYNTHPOD_PREFIX"MIDIPort");
681 _register(®s->synthpod.osc_port, world, map, SYNTHPOD_PREFIX"OSCPort");
682 _register(®s->synthpod.com_port, world, map, SYNTHPOD_PREFIX"ComPort");
683
684 _register(®s->synthpod.connection_list, world, map, SYNTHPOD_PREFIX"connectionList");
685 _register(®s->synthpod.node_list, world, map, SYNTHPOD_PREFIX"nodeList");
686 _register(®s->synthpod.subscription_list, world, map, SYNTHPOD_PREFIX"subscriptionList");
687 _register(®s->synthpod.notification_list, world, map, SYNTHPOD_PREFIX"notificationList");
688 _register(®s->synthpod.automation_list, world, map, SYNTHPOD_PREFIX"automationList");
689
690 _register(®s->synthpod.source_module, world, map, SYNTHPOD_PREFIX"sourceModule");
691 _register(®s->synthpod.source_symbol, world, map, SYNTHPOD_PREFIX"sourceSymbol");
692 _register(®s->synthpod.sink_module, world, map, SYNTHPOD_PREFIX"sinkModule");
693 _register(®s->synthpod.sink_symbol, world, map, SYNTHPOD_PREFIX"sinkSymbol");
694
695 _register(®s->synthpod.source_min, world, map, SYNTHPOD_PREFIX"sourceMinimum");
696 _register(®s->synthpod.source_max, world, map, SYNTHPOD_PREFIX"sourceMaximum");
697 _register(®s->synthpod.sink_min, world, map, SYNTHPOD_PREFIX"sinkMinimum");
698 _register(®s->synthpod.sink_max, world, map, SYNTHPOD_PREFIX"sinkMaximum");
699
700 _register(®s->synthpod.source_enabled, world, map, SYNTHPOD_PREFIX"sourceEnabled");
701 _register(®s->synthpod.sink_enabled, world, map, SYNTHPOD_PREFIX"sinkEnabled");
702 _register(®s->synthpod.learning, world, map, SYNTHPOD_PREFIX"learning");
703
704 _register(®s->synthpod.placeholder, world, map, SYNTHPOD_PREFIX"placeholder");
705
706 _register(®s->midi.Controller, world, map, LV2_MIDI__Controller);
707 _register(®s->midi.channel, world, map, LV2_MIDI__channel);
708 _register(®s->midi.controller_number, world, map, LV2_MIDI__controllerNumber);
709
710 _register(®s->idisp.surface, world, map, LV2_INLINEDISPLAY_PREFIX"surface");
711 }
712
713 static inline void
sp_regs_deinit(reg_t * regs)714 sp_regs_deinit(reg_t *regs)
715 {
716 _unregister(®s->port.input);
717 _unregister(®s->port.output);
718
719 _unregister(®s->port.control);
720 _unregister(®s->port.audio);
721 _unregister(®s->port.cv);
722 _unregister(®s->port.atom);
723
724 _unregister(®s->port.sequence);
725 _unregister(®s->port.midi);
726 _unregister(®s->port.osc_event);
727 _unregister(®s->port.time_position);
728
729 _unregister(®s->port.integer);
730 _unregister(®s->port.enumeration);
731 _unregister(®s->port.toggled);
732 _unregister(®s->port.is_bitmask);
733
734 _unregister(®s->port.float_protocol);
735 _unregister(®s->port.peak_protocol);
736 _unregister(®s->port.atom_transfer);
737 _unregister(®s->port.event_transfer);
738 _unregister(®s->port.notification);
739
740 _unregister(®s->port.minimum_size);
741
742 _unregister(®s->port.logarithmic);
743
744 _unregister(®s->parameter.property);
745
746 _unregister(®s->osc.message);
747 _unregister(®s->osc.path);
748
749 _unregister(®s->work.schedule);
750
751 _unregister(®s->log.entry);
752 _unregister(®s->log.error);
753 _unregister(®s->log.note);
754 _unregister(®s->log.trace);
755 _unregister(®s->log.warning);
756
757 _unregister(®s->ui.window_title);
758 _unregister(®s->ui.show_interface);
759 _unregister(®s->ui.idle_interface);
760 _unregister(®s->ui.kx_widget);
761 _unregister(®s->ui.external);
762 _unregister(®s->ui.x11);
763 _unregister(®s->ui.gtk2);
764 _unregister(®s->ui.gtk3);
765 _unregister(®s->ui.qt4);
766 _unregister(®s->ui.qt5);
767 _unregister(®s->ui.plugin);
768 _unregister(®s->ui.protocol);
769 _unregister(®s->ui.period_start);
770 _unregister(®s->ui.period_size);
771 _unregister(®s->ui.peak);
772 _unregister(®s->ui.port_subscribe);
773 _unregister(®s->ui.port_index);
774 _unregister(®s->ui.update_rate);
775 _unregister(®s->ui.instance_access);
776 _unregister(®s->ui.data_access);
777 _unregister(®s->ui.ui);
778
779 _unregister(®s->pset.preset);
780 _unregister(®s->pset.preset_bank);
781 _unregister(®s->pset.bank);
782
783 _unregister(®s->rdf.value);
784 _unregister(®s->rdf.type);
785 _unregister(®s->rdf.subject);
786
787 _unregister(®s->rdfs.label);
788 _unregister(®s->rdfs.range);
789 _unregister(®s->rdfs.comment);
790 _unregister(®s->rdfs.see_also);
791
792 _unregister(®s->doap.license);
793 _unregister(®s->doap.name);
794
795 _unregister(®s->core.optional_feature);
796 _unregister(®s->core.required_feature);
797 _unregister(®s->core.name);
798 _unregister(®s->core.minor_version);
799 _unregister(®s->core.micro_version);
800 _unregister(®s->core.extension_data);
801 _unregister(®s->core.control);
802 _unregister(®s->core.symbol);
803 _unregister(®s->core.index);
804 _unregister(®s->core.minimum);
805 _unregister(®s->core.maximum);
806 _unregister(®s->core.scale_point);
807 _unregister(®s->core.port);
808 _unregister(®s->core.Port);
809 _unregister(®s->core.plugin);
810 _unregister(®s->core.applies_to);
811 _unregister(®s->core.designation);
812
813 _unregister(®s->param.sample_rate);
814 _unregister(®s->param.gain);
815
816 _unregister(®s->bufsz.nominal_block_length);
817 _unregister(®s->bufsz.max_block_length);
818 _unregister(®s->bufsz.min_block_length);
819 _unregister(®s->bufsz.sequence_size);
820
821 _unregister(®s->patch.writable);
822 _unregister(®s->patch.readable);
823 _unregister(®s->patch.message);
824 _unregister(®s->patch.set);
825 _unregister(®s->patch.get);
826 _unregister(®s->patch.subject);
827 _unregister(®s->patch.body);
828 _unregister(®s->patch.property);
829 _unregister(®s->patch.value);
830 _unregister(®s->patch.wildcard);
831 _unregister(®s->patch.patch);
832 _unregister(®s->patch.add);
833 _unregister(®s->patch.remove);
834 _unregister(®s->patch.put);
835 _unregister(®s->patch.insert);
836 _unregister(®s->patch.delete);
837 _unregister(®s->patch.destination);
838 _unregister(®s->patch.copy);
839 _unregister(®s->patch.move);
840 _unregister(®s->patch.sequence_number);
841 _unregister(®s->patch.error);
842 _unregister(®s->patch.ack);
843
844 _unregister(®s->xpress.message);
845
846 _unregister(®s->canvas.graph);
847
848 _unregister(®s->group.group);
849 _unregister(®s->group.left);
850 _unregister(®s->group.right);
851 _unregister(®s->group.center);
852 _unregister(®s->group.side);
853 _unregister(®s->group.center_left);
854 _unregister(®s->group.center_right);
855 _unregister(®s->group.side_left);
856 _unregister(®s->group.side_right);
857 _unregister(®s->group.rear_left);
858 _unregister(®s->group.rear_right);
859 _unregister(®s->group.rear_center);
860 _unregister(®s->group.low_frequency_effects);
861
862 _unregister(®s->units.conversion);
863 _unregister(®s->units.prefixConversion);
864 _unregister(®s->units.render);
865 _unregister(®s->units.symbol);
866 _unregister(®s->units.unit);
867 _unregister(®s->units.Unit);
868 _unregister(®s->units.bar);
869 _unregister(®s->units.beat);
870 _unregister(®s->units.bpm);
871 _unregister(®s->units.cent);
872 _unregister(®s->units.cm);
873 _unregister(®s->units.coef);
874 _unregister(®s->units.db);
875 _unregister(®s->units.degree);
876 _unregister(®s->units.frame);
877 _unregister(®s->units.hz);
878 _unregister(®s->units.inch);
879 _unregister(®s->units.khz);
880 _unregister(®s->units.km);
881 _unregister(®s->units.m);
882 _unregister(®s->units.mhz);
883 _unregister(®s->units.midiNote);
884 _unregister(®s->units.midiController);
885 _unregister(®s->units.mile);
886 _unregister(®s->units.min);
887 _unregister(®s->units.mm);
888 _unregister(®s->units.ms);
889 _unregister(®s->units.oct);
890 _unregister(®s->units.pc);
891 _unregister(®s->units.s);
892 _unregister(®s->units.semitone12TET);
893
894 _unregister(®s->state.state);
895 _unregister(®s->state.load_default_state);
896 _unregister(®s->state.thread_safe_restore);
897
898 _unregister(®s->synthpod.payload);
899 _unregister(®s->synthpod.state);
900 _unregister(®s->synthpod.graph);
901 _unregister(®s->synthpod.null);
902 _unregister(®s->synthpod.stereo);
903 _unregister(®s->synthpod.monoatom);
904 _unregister(®s->synthpod.module_list);
905 _unregister(®s->synthpod.module_supported);
906 _unregister(®s->synthpod.module_add);
907 _unregister(®s->synthpod.module_del);
908 _unregister(®s->synthpod.module_move);
909 _unregister(®s->synthpod.module_preset_load);
910 _unregister(®s->synthpod.module_preset_save);
911 _unregister(®s->synthpod.module_visible);
912 _unregister(®s->synthpod.module_disabled);
913 _unregister(®s->synthpod.module_profiling);
914 _unregister(®s->synthpod.module_position_x);
915 _unregister(®s->synthpod.module_position_y);
916 _unregister(®s->synthpod.module_alias);
917 _unregister(®s->synthpod.module_reinstantiate);
918 _unregister(®s->synthpod.node_position_x);
919 _unregister(®s->synthpod.node_position_y);
920 _unregister(®s->synthpod.graph_position_x);
921 _unregister(®s->synthpod.graph_position_y);
922 _unregister(®s->synthpod.column_enabled);
923 _unregister(®s->synthpod.row_enabled);
924 _unregister(®s->synthpod.port_refresh);
925 _unregister(®s->synthpod.bundle_load);
926 _unregister(®s->synthpod.bundle_save);
927 _unregister(®s->synthpod.path_get);
928 _unregister(®s->synthpod.dsp_profiling);
929 _unregister(®s->synthpod.cpus_available);
930 _unregister(®s->synthpod.cpus_used);
931 _unregister(®s->synthpod.period_size);
932 _unregister(®s->synthpod.num_periods);
933 _unregister(®s->synthpod.quit);
934
935 _unregister(®s->synthpod.system_ports);
936 _unregister(®s->synthpod.control_port);
937 _unregister(®s->synthpod.audio_port);
938 _unregister(®s->synthpod.cv_port);
939 _unregister(®s->synthpod.midi_port);
940 _unregister(®s->synthpod.osc_port);
941 _unregister(®s->synthpod.com_port);
942
943 _unregister(®s->synthpod.connection_list);
944 _unregister(®s->synthpod.node_list);
945 _unregister(®s->synthpod.subscription_list);
946 _unregister(®s->synthpod.notification_list);
947 _unregister(®s->synthpod.automation_list);
948
949 _unregister(®s->synthpod.source_module);
950 _unregister(®s->synthpod.source_symbol);
951 _unregister(®s->synthpod.sink_module);
952 _unregister(®s->synthpod.sink_symbol);
953
954 _unregister(®s->synthpod.source_min);
955 _unregister(®s->synthpod.source_max);
956 _unregister(®s->synthpod.sink_min);
957 _unregister(®s->synthpod.sink_max);
958
959 _unregister(®s->synthpod.source_enabled);
960 _unregister(®s->synthpod.sink_enabled);
961 _unregister(®s->synthpod.learning);
962
963 _unregister(®s->synthpod.placeholder);
964
965 _unregister(®s->midi.Controller);
966 _unregister(®s->midi.channel);
967 _unregister(®s->midi.controller_number);
968
969 _unregister(®s->idisp.surface);
970 }
971
972 #if 0
973 #define _ATOM_ALIGNED __attribute__((aligned(8)))
974
975 // app <-> ui communication for module/port manipulations
976 typedef struct _transmit_t transmit_t;
977 typedef struct _transmit_module_list_t transmit_module_list_t;
978 typedef struct _transmit_module_supported_t transmit_module_supported_t;
979 typedef struct _transmit_module_add_t transmit_module_add_t;
980 typedef struct _transmit_module_del_t transmit_module_del_t;
981 typedef struct _transmit_module_move_t transmit_module_move_t;
982 typedef struct _transmit_module_preset_load_t transmit_module_preset_load_t;
983 typedef struct _transmit_module_preset_save_t transmit_module_preset_save_t;
984 typedef struct _transmit_module_selected_t transmit_module_selected_t;
985 typedef struct _transmit_module_embedded_t transmit_module_embedded_t;
986 typedef struct _transmit_module_visible_t transmit_module_visible_t;
987 typedef struct _transmit_module_disabled_t transmit_module_disabled_t;
988 typedef struct _transmit_module_profiling_t transmit_module_profiling_t;
989 typedef struct _transmit_port_connected_t transmit_port_connected_t;
990 typedef struct _transmit_port_subscribed_t transmit_port_subscribed_t;
991 typedef struct _transmit_port_monitored_t transmit_port_monitored_t;
992 typedef struct _transmit_port_refresh_t transmit_port_refresh_t;
993 typedef struct _transmit_port_selected_t transmit_port_selected_t;
994 typedef struct _transmit_bundle_load_t transmit_bundle_load_t;
995 typedef struct _transmit_bundle_save_t transmit_bundle_save_t;
996 typedef struct _transmit_path_get_t transmit_path_get_t;
997 typedef struct _transmit_dsp_profiling_t transmit_dsp_profiling_t;
998 typedef struct _transmit_grid_cols_t transmit_grid_cols_t;
999 typedef struct _transmit_grid_rows_t transmit_grid_rows_t;
1000 typedef struct _transmit_pane_left_t transmit_pane_left_t;
1001 typedef struct _transmit_quit_t transmit_quit_t;
1002
1003 struct _transmit_t {
1004 LV2_Atom_Object obj _ATOM_ALIGNED;
1005 LV2_Atom_Property_Body prop _ATOM_ALIGNED;
1006 } _ATOM_ALIGNED;
1007
1008 struct _transmit_module_list_t {
1009 transmit_t transmit _ATOM_ALIGNED;
1010 } _ATOM_ALIGNED;
1011
1012 struct _transmit_module_supported_t {
1013 transmit_t transmit _ATOM_ALIGNED;
1014 LV2_Atom_Int state _ATOM_ALIGNED;
1015 LV2_Atom_String uri _ATOM_ALIGNED;
1016 char uri_str [0] _ATOM_ALIGNED;
1017 } _ATOM_ALIGNED;
1018
1019 struct _transmit_module_add_t {
1020 transmit_t transmit _ATOM_ALIGNED;
1021 LV2_Atom_Int uid _ATOM_ALIGNED;
1022 LV2_Atom_String uri _ATOM_ALIGNED;
1023 char uri_str [0] _ATOM_ALIGNED;
1024 } _ATOM_ALIGNED;
1025
1026 struct _transmit_module_del_t {
1027 transmit_t transmit _ATOM_ALIGNED;
1028 LV2_Atom_Int uid _ATOM_ALIGNED;
1029 } _ATOM_ALIGNED;
1030
1031 struct _transmit_module_move_t {
1032 transmit_t transmit _ATOM_ALIGNED;
1033 LV2_Atom_Int uid _ATOM_ALIGNED;
1034 LV2_Atom_Int prev _ATOM_ALIGNED;
1035 } _ATOM_ALIGNED;
1036
1037 struct _transmit_module_preset_load_t {
1038 transmit_t transmit _ATOM_ALIGNED;
1039 LV2_Atom_Int uid _ATOM_ALIGNED;
1040 LV2_Atom_String uri _ATOM_ALIGNED;
1041 char uri_str [0] _ATOM_ALIGNED;
1042 } _ATOM_ALIGNED;
1043
1044 struct _transmit_module_preset_save_t {
1045 transmit_t transmit _ATOM_ALIGNED;
1046 LV2_Atom_Int uid _ATOM_ALIGNED;
1047 LV2_Atom_String label _ATOM_ALIGNED;
1048 char label_str [0] _ATOM_ALIGNED;
1049 } _ATOM_ALIGNED;
1050
1051 struct _transmit_module_selected_t {
1052 transmit_t transmit _ATOM_ALIGNED;
1053 LV2_Atom_Int uid _ATOM_ALIGNED;
1054 LV2_Atom_Int state _ATOM_ALIGNED;
1055 } _ATOM_ALIGNED;
1056
1057 struct _transmit_module_embedded_t {
1058 transmit_t transmit _ATOM_ALIGNED;
1059 LV2_Atom_Int uid _ATOM_ALIGNED;
1060 LV2_Atom_Int state _ATOM_ALIGNED;
1061 } _ATOM_ALIGNED;
1062
1063 struct _transmit_module_visible_t {
1064 transmit_t transmit _ATOM_ALIGNED;
1065 LV2_Atom_Int uid _ATOM_ALIGNED;
1066 LV2_Atom_Int state _ATOM_ALIGNED;
1067 LV2_Atom_URID urid _ATOM_ALIGNED;
1068 } _ATOM_ALIGNED;
1069
1070 struct _transmit_module_disabled_t {
1071 transmit_t transmit _ATOM_ALIGNED;
1072 LV2_Atom_Int uid _ATOM_ALIGNED;
1073 LV2_Atom_Int state _ATOM_ALIGNED;
1074 } _ATOM_ALIGNED;
1075
1076 struct _transmit_module_profiling_t {
1077 transmit_t transmit _ATOM_ALIGNED;
1078 LV2_Atom_Int uid _ATOM_ALIGNED;
1079 LV2_Atom_Float min _ATOM_ALIGNED;
1080 LV2_Atom_Float avg _ATOM_ALIGNED;
1081 LV2_Atom_Float max _ATOM_ALIGNED;
1082 } _ATOM_ALIGNED;
1083
1084 struct _transmit_port_connected_t {
1085 transmit_t transmit _ATOM_ALIGNED;
1086 LV2_Atom_Int src_uid _ATOM_ALIGNED;
1087 LV2_Atom_Int src_port _ATOM_ALIGNED;
1088 LV2_Atom_Int snk_uid _ATOM_ALIGNED;
1089 LV2_Atom_Int snk_port _ATOM_ALIGNED;
1090 LV2_Atom_Int state _ATOM_ALIGNED;
1091 LV2_Atom_Int indirect _ATOM_ALIGNED;
1092 } _ATOM_ALIGNED;
1093
1094 struct _transmit_port_subscribed_t {
1095 transmit_t transmit _ATOM_ALIGNED;
1096 LV2_Atom_Int uid _ATOM_ALIGNED;
1097 LV2_Atom_Int port _ATOM_ALIGNED;
1098 LV2_Atom_URID prot _ATOM_ALIGNED;
1099 LV2_Atom_Int state _ATOM_ALIGNED;
1100 } _ATOM_ALIGNED;
1101
1102 struct _transmit_port_monitored_t {
1103 transmit_t transmit _ATOM_ALIGNED;
1104 LV2_Atom_Int uid _ATOM_ALIGNED;
1105 LV2_Atom_Int port _ATOM_ALIGNED;
1106 LV2_Atom_Int state _ATOM_ALIGNED;
1107 } _ATOM_ALIGNED;
1108
1109 struct _transmit_port_refresh_t {
1110 transmit_t transmit _ATOM_ALIGNED;
1111 LV2_Atom_Int uid _ATOM_ALIGNED;
1112 LV2_Atom_Int port _ATOM_ALIGNED;
1113 } _ATOM_ALIGNED;
1114
1115 struct _transmit_port_selected_t {
1116 transmit_t transmit _ATOM_ALIGNED;
1117 LV2_Atom_Int uid _ATOM_ALIGNED;
1118 LV2_Atom_Int port _ATOM_ALIGNED;
1119 LV2_Atom_Int state _ATOM_ALIGNED;
1120 } _ATOM_ALIGNED;
1121
1122 struct _transmit_bundle_load_t {
1123 transmit_t transmit _ATOM_ALIGNED;
1124 LV2_Atom_Int status _ATOM_ALIGNED;
1125 LV2_Atom_String path _ATOM_ALIGNED;
1126 char path_str [0] _ATOM_ALIGNED;
1127 } _ATOM_ALIGNED;
1128
1129 struct _transmit_bundle_save_t {
1130 transmit_t transmit _ATOM_ALIGNED;
1131 LV2_Atom_Int status _ATOM_ALIGNED;
1132 LV2_Atom_String path _ATOM_ALIGNED;
1133 char path_str [0] _ATOM_ALIGNED;
1134 } _ATOM_ALIGNED;
1135
1136 struct _transmit_path_get_t {
1137 transmit_t transmit _ATOM_ALIGNED;
1138 LV2_Atom_String path _ATOM_ALIGNED;
1139 char path_str [0] _ATOM_ALIGNED;
1140 } _ATOM_ALIGNED;
1141
1142 struct _transmit_dsp_profiling_t {
1143 transmit_t transmit _ATOM_ALIGNED;
1144 LV2_Atom_Float min _ATOM_ALIGNED;
1145 LV2_Atom_Float avg _ATOM_ALIGNED;
1146 LV2_Atom_Float max _ATOM_ALIGNED;
1147 } _ATOM_ALIGNED;
1148
1149 struct _transmit_grid_cols_t {
1150 transmit_t transmit _ATOM_ALIGNED;
1151 LV2_Atom_Int cols _ATOM_ALIGNED;
1152 } _ATOM_ALIGNED;
1153
1154 struct _transmit_grid_rows_t {
1155 transmit_t transmit _ATOM_ALIGNED;
1156 LV2_Atom_Int rows _ATOM_ALIGNED;
1157 } _ATOM_ALIGNED;
1158
1159 struct _transmit_pane_left_t {
1160 transmit_t transmit _ATOM_ALIGNED;
1161 LV2_Atom_Float left _ATOM_ALIGNED;
1162 } _ATOM_ALIGNED;
1163
1164 struct _transmit_quit_t {
1165 transmit_t transmit _ATOM_ALIGNED;
1166 } _ATOM_ALIGNED;
1167
1168 // app <-> ui communication for port notifications
1169 typedef struct _transfer_t transfer_t;
1170 typedef struct _transfer_float_t transfer_float_t;
1171 typedef struct _transfer_peak_t transfer_peak_t;
1172 typedef struct _transfer_atom_t transfer_atom_t;
1173 typedef struct _transfer_patch_set_obj_t transfer_patch_set_obj_t;
1174 typedef struct _transfer_patch_get_t transfer_patch_get_t;
1175 typedef struct _transfer_patch_get_all_t transfer_patch_get_all_t;
1176
1177 struct _transfer_t {
1178 transmit_t transmit _ATOM_ALIGNED;
1179 LV2_Atom_Int uid _ATOM_ALIGNED;
1180 LV2_Atom_Int port _ATOM_ALIGNED;
1181 } _ATOM_ALIGNED;
1182
1183 struct _transfer_float_t {
1184 transfer_t transfer _ATOM_ALIGNED;
1185 LV2_Atom_Float value _ATOM_ALIGNED;
1186 } _ATOM_ALIGNED;
1187
1188 struct _transfer_peak_t {
1189 transfer_t transfer _ATOM_ALIGNED;
1190 LV2_Atom_Int period_start _ATOM_ALIGNED;
1191 LV2_Atom_Int period_size _ATOM_ALIGNED;
1192 LV2_Atom_Float peak _ATOM_ALIGNED;
1193 } _ATOM_ALIGNED;
1194
1195 struct _transfer_atom_t {
1196 transfer_t transfer _ATOM_ALIGNED;
1197 LV2_Atom atom [0] _ATOM_ALIGNED;
1198 } _ATOM_ALIGNED;
1199
1200 struct _transfer_patch_set_obj_t {
1201 LV2_Atom_Object obj _ATOM_ALIGNED;
1202 LV2_Atom_Property_Body subj _ATOM_ALIGNED;
1203 LV2_URID subj_val _ATOM_ALIGNED;
1204 LV2_Atom_Property_Body seq _ATOM_ALIGNED;
1205 int32_t seq_val _ATOM_ALIGNED;
1206 LV2_Atom_Property_Body prop _ATOM_ALIGNED;
1207 LV2_URID prop_val _ATOM_ALIGNED;
1208 LV2_Atom_Property_Body dest _ATOM_ALIGNED;
1209 LV2_URID dest_val _ATOM_ALIGNED;
1210 LV2_Atom_Property_Body val _ATOM_ALIGNED;
1211 } _ATOM_ALIGNED;
1212
1213 struct _transfer_patch_get_t {
1214 transfer_t transfer _ATOM_ALIGNED;
1215 LV2_Atom_Object obj _ATOM_ALIGNED;
1216 LV2_Atom_Property_Body subj _ATOM_ALIGNED;
1217 LV2_URID subj_val _ATOM_ALIGNED;
1218 LV2_Atom_Property_Body seq _ATOM_ALIGNED;
1219 int32_t seq_val _ATOM_ALIGNED;
1220 LV2_Atom_Property_Body prop _ATOM_ALIGNED;
1221 LV2_URID prop_val _ATOM_ALIGNED;
1222 LV2_Atom_Property_Body dest _ATOM_ALIGNED;
1223 LV2_URID dest_val _ATOM_ALIGNED;
1224 } _ATOM_ALIGNED;
1225
1226 struct _transfer_patch_get_all_t {
1227 transfer_t transfer _ATOM_ALIGNED;
1228 LV2_Atom_Object obj _ATOM_ALIGNED;
1229 LV2_Atom_Property_Body subj _ATOM_ALIGNED;
1230 LV2_URID subj_val _ATOM_ALIGNED;
1231 LV2_Atom_Property_Body seq _ATOM_ALIGNED;
1232 int32_t seq_val _ATOM_ALIGNED;
1233 LV2_Atom_Property_Body dest _ATOM_ALIGNED;
1234 LV2_URID dest_val _ATOM_ALIGNED;
1235 } _ATOM_ALIGNED;
1236
1237 static inline void
1238 _sp_transmit_fill(reg_t *regs, LV2_Atom_Forge *forge, transmit_t *trans, uint32_t size,
1239 LV2_URID protocol)
1240 {
1241 trans = ASSUME_ALIGNED(trans);
1242
1243 trans->obj.atom.size = size - sizeof(LV2_Atom);
1244 trans->obj.atom.type = forge->Object;
1245 trans->obj.body.id = 0;
1246 trans->obj.body.otype = protocol;
1247
1248 trans->prop.key = regs->synthpod.payload.urid;
1249 trans->prop.context = 0;
1250 trans->prop.value.size = size - sizeof(transmit_t);
1251 trans->prop.value.type = forge->Tuple;
1252 }
1253
1254 static inline void
1255 _sp_transmit_module_list_fill(reg_t *regs, LV2_Atom_Forge *forge,
1256 transmit_module_list_t *trans, uint32_t size)
1257 {
1258 trans = ASSUME_ALIGNED(trans);
1259
1260 _sp_transmit_fill(regs, forge, &trans->transmit, size,
1261 regs->synthpod.module_list.urid);
1262 }
1263
1264 static inline void
1265 _sp_transmit_module_supported_fill(reg_t *regs, LV2_Atom_Forge *forge,
1266 transmit_module_supported_t *trans, uint32_t size,
1267 int32_t state, const char *module_uri)
1268 {
1269 trans = ASSUME_ALIGNED(trans);
1270
1271 _sp_transmit_fill(regs, forge, &trans->transmit, size,
1272 regs->synthpod.module_supported.urid);
1273
1274 trans->state.atom.size = sizeof(int32_t);
1275 trans->state.atom.type = forge->Int;
1276 trans->state.body = state;
1277
1278 if(module_uri)
1279 {
1280 trans->uri.atom.size = strlen(module_uri) + 1;
1281 strcpy(trans->uri_str, module_uri);
1282 }
1283 else
1284 trans->uri.atom.size = 0;
1285 trans->uri.atom.type = forge->String;
1286 }
1287
1288 static inline void
1289 _sp_transmit_module_add_fill(reg_t *regs, LV2_Atom_Forge *forge,
1290 transmit_module_add_t *trans, uint32_t size,
1291 u_id_t module_uid, const char *module_uri)
1292 {
1293 trans = ASSUME_ALIGNED(trans);
1294
1295 _sp_transmit_fill(regs, forge, &trans->transmit, size,
1296 regs->synthpod.module_add.urid);
1297
1298 trans->uid.atom.size = sizeof(int32_t);
1299 trans->uid.atom.type = forge->Int;
1300 trans->uid.body = module_uid;
1301
1302 if(module_uri)
1303 {
1304 trans->uri.atom.size = strlen(module_uri) + 1;
1305 strcpy(trans->uri_str, module_uri);
1306 }
1307 else
1308 trans->uri.atom.size = 0;
1309 trans->uri.atom.type = forge->String;
1310 }
1311
1312 static inline void
1313 _sp_transmit_module_del_fill(reg_t *regs, LV2_Atom_Forge *forge,
1314 transmit_module_del_t *trans, uint32_t size, u_id_t module_uid)
1315 {
1316 trans = ASSUME_ALIGNED(trans);
1317
1318 _sp_transmit_fill(regs, forge, &trans->transmit, size,
1319 regs->synthpod.module_del.urid);
1320
1321 trans->uid.atom.size = sizeof(int32_t);
1322 trans->uid.atom.type = forge->Int;
1323 trans->uid.body = module_uid;
1324 }
1325
1326 static inline void
1327 _sp_transmit_module_move_fill(reg_t *regs, LV2_Atom_Forge *forge,
1328 transmit_module_move_t *trans, uint32_t size, u_id_t module_uid, u_id_t prev_uid)
1329 {
1330 trans = ASSUME_ALIGNED(trans);
1331
1332 _sp_transmit_fill(regs, forge, &trans->transmit, size,
1333 regs->synthpod.module_move.urid);
1334
1335 trans->uid.atom.size = sizeof(int32_t);
1336 trans->uid.atom.type = forge->Int;
1337 trans->uid.body = module_uid;
1338
1339 trans->prev.atom.size = sizeof(int32_t);
1340 trans->prev.atom.type = forge->Int;
1341 trans->prev.body = prev_uid;
1342 }
1343
1344 static inline void
1345 _sp_transmit_module_preset_load_fill(reg_t *regs, LV2_Atom_Forge *forge,
1346 transmit_module_preset_load_t *trans, uint32_t size, u_id_t module_uid, const char *uri)
1347 {
1348 trans = ASSUME_ALIGNED(trans);
1349
1350 _sp_transmit_fill(regs, forge, &trans->transmit, size,
1351 regs->synthpod.module_preset_load.urid);
1352
1353 trans->uid.atom.size = sizeof(int32_t);
1354 trans->uid.atom.type = forge->Int;
1355 trans->uid.body = module_uid;
1356
1357 trans->uri.atom.size = uri
1358 ? strlen(uri) + 1
1359 : 0;
1360 trans->uri.atom.type = forge->String;
1361
1362 if(uri)
1363 strcpy(trans->uri_str, uri);
1364 }
1365
1366 static inline void
1367 _sp_transmit_module_preset_save_fill(reg_t *regs, LV2_Atom_Forge *forge,
1368 transmit_module_preset_save_t *trans, uint32_t size, u_id_t module_uid, const char *label)
1369 {
1370 trans = ASSUME_ALIGNED(trans);
1371
1372 _sp_transmit_fill(regs, forge, &trans->transmit, size,
1373 regs->synthpod.module_preset_save.urid);
1374
1375 trans->uid.atom.size = sizeof(int32_t);
1376 trans->uid.atom.type = forge->Int;
1377 trans->uid.body = module_uid;
1378
1379 trans->label.atom.size = label
1380 ? strlen(label) + 1
1381 : 0;
1382 trans->label.atom.type = forge->String;
1383
1384 if(label)
1385 strcpy(trans->label_str, label);
1386 }
1387
1388 static inline void
1389 _sp_transmit_module_selected_fill(reg_t *regs, LV2_Atom_Forge *forge,
1390 transmit_module_selected_t *trans, uint32_t size, u_id_t module_uid, int state)
1391 {
1392 trans = ASSUME_ALIGNED(trans);
1393
1394 _sp_transmit_fill(regs, forge, &trans->transmit, size,
1395 regs->synthpod.module_selected.urid);
1396
1397 trans->uid.atom.size = sizeof(int32_t);
1398 trans->uid.atom.type = forge->Int;
1399 trans->uid.body = module_uid;
1400
1401 trans->state.atom.size = sizeof(int32_t);
1402 trans->state.atom.type = forge->Int;
1403 trans->state.body = state;
1404 }
1405
1406 static inline void
1407 _sp_transmit_module_embedded_fill(reg_t *regs, LV2_Atom_Forge *forge,
1408 transmit_module_embedded_t *trans, uint32_t size, u_id_t module_uid, int state)
1409 {
1410 trans = ASSUME_ALIGNED(trans);
1411
1412 _sp_transmit_fill(regs, forge, &trans->transmit, size,
1413 regs->synthpod.module_embedded.urid);
1414
1415 trans->uid.atom.size = sizeof(int32_t);
1416 trans->uid.atom.type = forge->Int;
1417 trans->uid.body = module_uid;
1418
1419 trans->state.atom.size = sizeof(int32_t);
1420 trans->state.atom.type = forge->Int;
1421 trans->state.body = state;
1422 }
1423
1424 static inline void
1425 _sp_transmit_module_visible_fill(reg_t *regs, LV2_Atom_Forge *forge,
1426 transmit_module_visible_t *trans, uint32_t size, u_id_t module_uid,
1427 int state, LV2_URID urid)
1428 {
1429 trans = ASSUME_ALIGNED(trans);
1430
1431 _sp_transmit_fill(regs, forge, &trans->transmit, size,
1432 regs->synthpod.module_visible.urid);
1433
1434 trans->uid.atom.size = sizeof(int32_t);
1435 trans->uid.atom.type = forge->Int;
1436 trans->uid.body = module_uid;
1437
1438 trans->state.atom.size = sizeof(int32_t);
1439 trans->state.atom.type = forge->Int;
1440 trans->state.body = state;
1441
1442 trans->urid.atom.size = sizeof(uint32_t);
1443 trans->urid.atom.type = forge->URID;
1444 trans->urid.body = urid;
1445 }
1446
1447 static inline void
1448 _sp_transmit_module_disabled_fill(reg_t *regs, LV2_Atom_Forge *forge,
1449 transmit_module_disabled_t *trans, uint32_t size, u_id_t module_uid, int state)
1450 {
1451 trans = ASSUME_ALIGNED(trans);
1452
1453 _sp_transmit_fill(regs, forge, &trans->transmit, size,
1454 regs->synthpod.module_disabled.urid);
1455
1456 trans->uid.atom.size = sizeof(int32_t);
1457 trans->uid.atom.type = forge->Int;
1458 trans->uid.body = module_uid;
1459
1460 trans->state.atom.size = sizeof(int32_t);
1461 trans->state.atom.type = forge->Int;
1462 trans->state.body = state;
1463 }
1464
1465 static inline void
1466 _sp_transmit_module_profiling_fill(reg_t *regs, LV2_Atom_Forge *forge,
1467 transmit_module_profiling_t *trans, uint32_t size, u_id_t module_uid,
1468 float min, float avg, float max)
1469 {
1470 trans = ASSUME_ALIGNED(trans);
1471
1472 _sp_transmit_fill(regs, forge, &trans->transmit, size,
1473 regs->synthpod.module_profiling.urid);
1474
1475 trans->uid.atom.size = sizeof(int32_t);
1476 trans->uid.atom.type = forge->Int;
1477 trans->uid.body = module_uid;
1478
1479 trans->min.atom.size = sizeof(float);
1480 trans->min.atom.type = forge->Float;
1481 trans->min.body = min;
1482
1483 trans->avg.atom.size = sizeof(float);
1484 trans->avg.atom.type = forge->Float;
1485 trans->avg.body = avg;
1486
1487 trans->max.atom.size = sizeof(float);
1488 trans->max.atom.type = forge->Float;
1489 trans->max.body = max;
1490 }
1491
1492 static inline void
1493 _sp_transmit_port_connected_fill(reg_t *regs, LV2_Atom_Forge *forge,
1494 transmit_port_connected_t *trans, uint32_t size, u_id_t src_uid,
1495 uint32_t src_port, u_id_t snk_uid, uint32_t snk_port, int32_t state, int32_t indirect)
1496 {
1497 trans = ASSUME_ALIGNED(trans);
1498
1499 _sp_transmit_fill(regs, forge, &trans->transmit, size,
1500 regs->synthpod.port_connected.urid);
1501
1502 trans->src_uid.atom.size = sizeof(int32_t);
1503 trans->src_uid.atom.type = forge->Int;
1504 trans->src_uid.body = src_uid;
1505
1506 trans->src_port.atom.size = sizeof(int32_t);
1507 trans->src_port.atom.type = forge->Int;
1508 trans->src_port.body = src_port;
1509
1510 trans->snk_uid.atom.size = sizeof(int32_t);
1511 trans->snk_uid.atom.type = forge->Int;
1512 trans->snk_uid.body = snk_uid;
1513
1514 trans->snk_port.atom.size = sizeof(int32_t);
1515 trans->snk_port.atom.type = forge->Int;
1516 trans->snk_port.body = snk_port;
1517
1518 trans->state.atom.size = sizeof(int32_t);
1519 trans->state.atom.type = forge->Int;
1520 trans->state.body = state; // -1 (query), 0 (disconnected), 1 (connected)
1521
1522 trans->indirect.atom.size = sizeof(int32_t);
1523 trans->indirect.atom.type = forge->Int;
1524 trans->indirect.body = indirect; // -1 (feedback), 0 (direct), 1 (indirect)
1525 }
1526
1527 static inline void
1528 _sp_transmit_port_subscribed_fill(reg_t *regs, LV2_Atom_Forge *forge,
1529 transmit_port_subscribed_t *trans, uint32_t size,
1530 u_id_t module_uid, uint32_t port_index, LV2_URID prot, int32_t state)
1531 {
1532 trans = ASSUME_ALIGNED(trans);
1533
1534 _sp_transmit_fill(regs, forge, &trans->transmit, size,
1535 regs->synthpod.port_subscribed.urid);
1536
1537 trans->uid.atom.size = sizeof(int32_t);
1538 trans->uid.atom.type = forge->Int;
1539 trans->uid.body = module_uid;
1540
1541 trans->port.atom.size = sizeof(int32_t);
1542 trans->port.atom.type = forge->Int;
1543 trans->port.body = port_index;
1544
1545 trans->prot.atom.size = sizeof(LV2_URID);
1546 trans->prot.atom.type = forge->URID;
1547 trans->prot.body = prot;
1548
1549 trans->state.atom.size = sizeof(int32_t);
1550 trans->state.atom.type = forge->Int;
1551 trans->state.body = state; // -1 (query), 0 (disconnected), 1 (connected)
1552 }
1553
1554 static inline void
1555 _sp_transmit_port_monitored_fill(reg_t *regs, LV2_Atom_Forge *forge,
1556 transmit_port_monitored_t *trans, uint32_t size,
1557 u_id_t module_uid, uint32_t port_index, int32_t state)
1558 {
1559 trans = ASSUME_ALIGNED(trans);
1560
1561 _sp_transmit_fill(regs, forge, &trans->transmit, size,
1562 regs->synthpod.port_monitored.urid);
1563
1564 trans->uid.atom.size = sizeof(int32_t);
1565 trans->uid.atom.type = forge->Int;
1566 trans->uid.body = module_uid;
1567
1568 trans->port.atom.size = sizeof(int32_t);
1569 trans->port.atom.type = forge->Int;
1570 trans->port.body = port_index;
1571
1572 trans->state.atom.size = sizeof(int32_t);
1573 trans->state.atom.type = forge->Int;
1574 trans->state.body = state; // -1 (query), 0 (not monitored), 1 (monitored)
1575 }
1576
1577 static inline void
1578 _sp_transmit_port_refresh_fill(reg_t *regs, LV2_Atom_Forge *forge,
1579 transmit_port_refresh_t *trans, uint32_t size,
1580 u_id_t module_uid, uint32_t port_index)
1581 {
1582 trans = ASSUME_ALIGNED(trans);
1583
1584 _sp_transmit_fill(regs, forge, &trans->transmit, size,
1585 regs->synthpod.port_refresh.urid);
1586
1587 trans->uid.atom.size = sizeof(int32_t);
1588 trans->uid.atom.type = forge->Int;
1589 trans->uid.body = module_uid;
1590
1591 trans->port.atom.size = sizeof(int32_t);
1592 trans->port.atom.type = forge->Int;
1593 trans->port.body = port_index;
1594 }
1595
1596 static inline void
1597 _sp_transmit_port_selected_fill(reg_t *regs, LV2_Atom_Forge *forge,
1598 transmit_port_selected_t *trans, uint32_t size,
1599 u_id_t module_uid, uint32_t port_index, int32_t state)
1600 {
1601 trans = ASSUME_ALIGNED(trans);
1602
1603 _sp_transmit_fill(regs, forge, &trans->transmit, size,
1604 regs->synthpod.port_selected.urid);
1605
1606 trans->uid.atom.size = sizeof(int32_t);
1607 trans->uid.atom.type = forge->Int;
1608 trans->uid.body = module_uid;
1609
1610 trans->port.atom.size = sizeof(int32_t);
1611 trans->port.atom.type = forge->Int;
1612 trans->port.body = port_index;
1613
1614 trans->state.atom.size = sizeof(int32_t);
1615 trans->state.atom.type = forge->Int;
1616 trans->state.body = state;
1617 }
1618
1619 static inline void
1620 _sp_transmit_bundle_load_fill(reg_t *regs, LV2_Atom_Forge *forge,
1621 transmit_bundle_load_t *trans, uint32_t size,
1622 int32_t status, const char *bundle_path)
1623 {
1624 trans = ASSUME_ALIGNED(trans);
1625
1626 _sp_transmit_fill(regs, forge, &trans->transmit, size,
1627 regs->synthpod.bundle_load.urid);
1628
1629 trans->status.atom.size = sizeof(int32_t);
1630 trans->status.atom.type = forge->Int;
1631 trans->status.body = status;
1632
1633 trans->path.atom.size = bundle_path
1634 ? strlen(bundle_path) + 1
1635 : 0;
1636 trans->path.atom.type = forge->String;
1637
1638 if(bundle_path)
1639 strcpy(trans->path_str, bundle_path);
1640 }
1641
1642 static inline void
1643 _sp_transmit_bundle_save_fill(reg_t *regs, LV2_Atom_Forge *forge,
1644 transmit_bundle_save_t *trans, uint32_t size,
1645 int32_t status, const char *bundle_path)
1646 {
1647 trans = ASSUME_ALIGNED(trans);
1648
1649 _sp_transmit_fill(regs, forge, &trans->transmit, size,
1650 regs->synthpod.bundle_save.urid);
1651
1652 trans->status.atom.size = sizeof(int32_t);
1653 trans->status.atom.type = forge->Int;
1654 trans->status.body = status;
1655
1656 trans->path.atom.size = bundle_path
1657 ? strlen(bundle_path) + 1
1658 : 0;
1659 trans->path.atom.type = forge->String;
1660
1661 if(bundle_path)
1662 strcpy(trans->path_str, bundle_path);
1663 }
1664
1665 static inline void
1666 _sp_transmit_path_get_fill(reg_t *regs, LV2_Atom_Forge *forge,
1667 transmit_path_get_t *trans, uint32_t size,
1668 const char *bundle_path)
1669 {
1670 trans = ASSUME_ALIGNED(trans);
1671
1672 _sp_transmit_fill(regs, forge, &trans->transmit, size,
1673 regs->synthpod.path_get.urid);
1674
1675 trans->path.atom.size = bundle_path
1676 ? strlen(bundle_path) + 1
1677 : 0;
1678 trans->path.atom.type = forge->String;
1679
1680 if(bundle_path)
1681 strcpy(trans->path_str, bundle_path);
1682 }
1683
1684 static inline void
1685 _sp_transmit_dsp_profiling_fill(reg_t *regs, LV2_Atom_Forge *forge,
1686 transmit_dsp_profiling_t *trans, uint32_t size,
1687 float min, float avg, float max)
1688 {
1689 trans = ASSUME_ALIGNED(trans);
1690
1691 _sp_transmit_fill(regs, forge, &trans->transmit, size,
1692 regs->synthpod.dsp_profiling.urid);
1693
1694 trans->min.atom.size = sizeof(float);
1695 trans->min.atom.type = forge->Float;
1696 trans->min.body = min;
1697
1698 trans->avg.atom.size = sizeof(float);
1699 trans->avg.atom.type = forge->Float;
1700 trans->avg.body = avg;
1701
1702 trans->max.atom.size = sizeof(float);
1703 trans->max.atom.type = forge->Float;
1704 trans->max.body = max;
1705 }
1706
1707 static inline void
1708 _sp_transmit_grid_cols_fill(reg_t *regs, LV2_Atom_Forge *forge,
1709 transmit_grid_cols_t *trans, uint32_t size, int32_t cols)
1710 {
1711 trans = ASSUME_ALIGNED(trans);
1712
1713 _sp_transmit_fill(regs, forge, &trans->transmit, size,
1714 regs->synthpod.grid_cols.urid);
1715
1716 trans->cols.atom.size = sizeof(int32_t);
1717 trans->cols.atom.type = forge->Int;
1718 trans->cols.body = cols;
1719 }
1720
1721 static inline void
1722 _sp_transmit_grid_rows_fill(reg_t *regs, LV2_Atom_Forge *forge,
1723 transmit_grid_rows_t *trans, uint32_t size, int32_t rows)
1724 {
1725 trans = ASSUME_ALIGNED(trans);
1726
1727 _sp_transmit_fill(regs, forge, &trans->transmit, size,
1728 regs->synthpod.grid_rows.urid);
1729
1730 trans->rows.atom.size = sizeof(int32_t);
1731 trans->rows.atom.type = forge->Int;
1732 trans->rows.body = rows;
1733 }
1734
1735 static inline void
1736 _sp_transmit_pane_left_fill(reg_t *regs, LV2_Atom_Forge *forge,
1737 transmit_pane_left_t *trans, uint32_t size, float left)
1738 {
1739 trans = ASSUME_ALIGNED(trans);
1740
1741 _sp_transmit_fill(regs, forge, &trans->transmit, size,
1742 regs->synthpod.pane_left.urid);
1743
1744 trans->left.atom.size = sizeof(float);
1745 trans->left.atom.type = forge->Float;
1746 trans->left.body = left;
1747 }
1748
1749 static inline void
1750 _sp_transmit_quit_fill(reg_t *regs, LV2_Atom_Forge *forge,
1751 transmit_quit_t *trans, uint32_t size)
1752 {
1753 trans = ASSUME_ALIGNED(trans);
1754
1755 _sp_transmit_fill(regs, forge, &trans->transmit, size,
1756 regs->synthpod.quit.urid);
1757 }
1758
1759 static inline void
1760 _sp_transfer_fill(reg_t *regs, LV2_Atom_Forge *forge, transfer_t *trans, uint32_t size,
1761 LV2_URID protocol, u_id_t module_uid, uint32_t port_index)
1762 {
1763 trans = ASSUME_ALIGNED(trans);
1764
1765 _sp_transmit_fill(regs, forge, &trans->transmit, size,
1766 protocol);
1767
1768 trans->uid.atom.size = sizeof(int32_t);
1769 trans->uid.atom.type = forge->Int;
1770 trans->uid.body = module_uid;
1771
1772 trans->port.atom.size = sizeof(int32_t);
1773 trans->port.atom.type = forge->Int;
1774 trans->port.body = port_index;
1775 }
1776
1777 static inline void
1778 _sp_transfer_float_fill(reg_t *regs, LV2_Atom_Forge *forge, transfer_float_t *trans,
1779 u_id_t module_uid, uint32_t port_index, const float *value)
1780 {
1781 trans = ASSUME_ALIGNED(trans);
1782
1783 _sp_transfer_fill(regs, forge, &trans->transfer, sizeof(transfer_float_t),
1784 regs->port.float_protocol.urid, module_uid, port_index);
1785
1786 trans->value.atom.size = sizeof(float);
1787 trans->value.atom.type = forge->Float;
1788 trans->value.body = *value;
1789 }
1790
1791 static inline void
1792 _sp_transfer_peak_fill(reg_t *regs, LV2_Atom_Forge *forge, transfer_peak_t *trans,
1793 u_id_t module_uid, uint32_t port_index, const LV2UI_Peak_Data *data)
1794 {
1795 trans = ASSUME_ALIGNED(trans);
1796
1797 _sp_transfer_fill(regs, forge, &trans->transfer, sizeof(transfer_peak_t),
1798 regs->port.peak_protocol.urid, module_uid, port_index);
1799
1800 trans->period_start.atom.size = sizeof(uint32_t);
1801 trans->period_start.atom.type = forge->Int;
1802 trans->period_start.body = data->period_start;
1803
1804 trans->period_size.atom.size = sizeof(uint32_t);
1805 trans->period_size.atom.type = forge->Int;
1806 trans->period_size.body = data->period_size;
1807
1808 trans->peak.atom.size = sizeof(float);
1809 trans->peak.atom.type = forge->Float;
1810 trans->peak.body = data->peak;
1811 }
1812
1813 static inline LV2_Atom *
1814 _sp_transfer_atom_fill(reg_t *regs, LV2_Atom_Forge *forge, transfer_atom_t *trans,
1815 u_id_t module_uid, uint32_t port_index, uint32_t atom_size, const LV2_Atom *atom)
1816 {
1817 trans = ASSUME_ALIGNED(trans);
1818 //TODO atom aligned, too?
1819
1820 _sp_transfer_fill(regs, forge, &trans->transfer, sizeof(transfer_atom_t)
1821 + lv2_atom_pad_size(atom_size),
1822 regs->port.atom_transfer.urid, module_uid, port_index);
1823
1824 if(atom)
1825 memcpy(trans->atom, atom, atom_size);
1826
1827 return trans->atom;
1828 }
1829
1830 static inline LV2_Atom *
1831 _sp_transfer_event_fill(reg_t *regs, LV2_Atom_Forge *forge, transfer_atom_t *trans,
1832 u_id_t module_uid, uint32_t port_index, uint32_t atom_size, const LV2_Atom *atom)
1833 {
1834 trans = ASSUME_ALIGNED(trans);
1835 //TODO atom aligned, too?
1836
1837 _sp_transfer_fill(regs, forge, &trans->transfer, sizeof(transfer_atom_t)
1838 + lv2_atom_pad_size(atom_size),
1839 regs->port.event_transfer.urid, module_uid, port_index);
1840
1841 if(atom)
1842 memcpy(trans->atom, atom, atom_size);
1843
1844 return trans->atom;
1845 }
1846
1847 static inline LV2_Atom *
1848 _sp_transfer_patch_set_obj_fill(reg_t *regs, LV2_Atom_Forge *forge,
1849 transfer_patch_set_obj_t *trans,
1850 uint32_t body_size, LV2_URID subject,
1851 LV2_URID property, LV2_URID type,
1852 int32_t sequence_number)
1853 {
1854 trans = ASSUME_ALIGNED(trans);
1855
1856 uint32_t obj_size = sizeof(transfer_patch_set_obj_t) + body_size - sizeof(LV2_Atom);
1857
1858 trans->obj.atom.size = obj_size;
1859 trans->obj.atom.type = forge->Object;
1860 trans->obj.body.id = 0;
1861 trans->obj.body.otype = regs->patch.set.urid;
1862
1863 trans->subj.key = regs->patch.subject.urid;
1864 trans->subj.context = 0;
1865 trans->subj.value.size = sizeof(LV2_URID);
1866 trans->subj.value.type = forge->URID;
1867
1868 trans->subj_val = subject;
1869
1870 trans->seq.key = regs->patch.sequence_number.urid;
1871 trans->seq.context = 0;
1872 trans->seq.value.size = sizeof(int32_t);
1873 trans->seq.value.type = forge->Int;
1874
1875 trans->seq_val = sequence_number;
1876
1877 trans->prop.key = regs->patch.property.urid;
1878 trans->prop.context = 0;
1879 trans->prop.value.size = sizeof(LV2_URID);
1880 trans->prop.value.type = forge->URID;
1881
1882 trans->prop_val = property;
1883
1884 trans->dest.key = regs->patch.destination.urid;
1885 trans->dest.context = 0;
1886 trans->dest.value.size = sizeof(LV2_URID);
1887 trans->dest.value.type = forge->URID;
1888
1889 trans->dest_val = regs->core.plugin.urid;
1890
1891 trans->val.key = regs->patch.value.urid;
1892 trans->val.context = 0;
1893 trans->val.value.size = body_size;
1894 trans->val.value.type = type;
1895
1896 //return LV2_ATOM_BODY(&trans->val.value);
1897 return &trans->val.value;
1898 }
1899
1900 static inline void
1901 _sp_transfer_patch_get_fill(reg_t *regs, LV2_Atom_Forge *forge,
1902 transfer_patch_get_t *trans, u_id_t module_uid, uint32_t port_index,
1903 LV2_URID subject, LV2_URID property, int32_t sequence_number)
1904 {
1905 trans = ASSUME_ALIGNED(trans);
1906
1907 uint32_t trans_size = sizeof(transfer_patch_get_t);
1908 uint32_t obj_size = trans_size
1909 - offsetof(transfer_patch_get_t, obj.body);
1910
1911 _sp_transfer_fill(regs, forge, &trans->transfer, trans_size,
1912 regs->port.event_transfer.urid, module_uid, port_index);
1913
1914 trans->obj.atom.size = obj_size;
1915 trans->obj.atom.type = forge->Object;
1916 trans->obj.body.id = 0;
1917 trans->obj.body.otype = regs->patch.get.urid;
1918
1919 trans->subj.key = regs->patch.subject.urid;
1920 trans->subj.context = 0;
1921 trans->subj.value.size = sizeof(LV2_URID);
1922 trans->subj.value.type = forge->URID;
1923
1924 trans->subj_val = subject;
1925
1926 trans->seq.key = regs->patch.sequence_number.urid;
1927 trans->seq.context = 0;
1928 trans->seq.value.size = sizeof(int32_t);
1929 trans->seq.value.type = forge->Int;
1930
1931 trans->seq_val = sequence_number;
1932
1933 trans->prop.key = regs->patch.property.urid;
1934 trans->prop.context = 0;
1935 trans->prop.value.size = sizeof(LV2_URID);
1936 trans->prop.value.type = forge->URID;
1937
1938 trans->prop_val = property;
1939
1940 trans->dest.key = regs->patch.destination.urid;
1941 trans->dest.context = 0;
1942 trans->dest.value.size = sizeof(LV2_URID);
1943 trans->dest.value.type = forge->URID;
1944
1945 trans->dest_val = regs->core.plugin.urid;
1946 }
1947
1948 static inline void
1949 _sp_transfer_patch_get_all_fill(reg_t *regs, LV2_Atom_Forge *forge,
1950 transfer_patch_get_all_t *trans, u_id_t module_uid, uint32_t port_index,
1951 LV2_URID subject, int32_t sequence_number)
1952 {
1953 trans = ASSUME_ALIGNED(trans);
1954
1955 uint32_t trans_size = sizeof(transfer_patch_get_all_t);
1956 uint32_t obj_size = trans_size
1957 - offsetof(transfer_patch_get_all_t, obj.body);
1958
1959 _sp_transfer_fill(regs, forge, &trans->transfer, trans_size,
1960 regs->port.event_transfer.urid, module_uid, port_index);
1961
1962 trans->obj.atom.size = obj_size;
1963 trans->obj.atom.type = forge->Object;
1964 trans->obj.body.id = 0;
1965 trans->obj.body.otype = regs->patch.get.urid;
1966
1967 trans->subj.key = regs->patch.subject.urid;
1968 trans->subj.context = 0;
1969 trans->subj.value.size = sizeof(LV2_URID);
1970 trans->subj.value.type = forge->URID;
1971
1972 trans->subj_val = subject;
1973
1974 trans->seq.key = regs->patch.sequence_number.urid;
1975 trans->seq.context = 0;
1976 trans->seq.value.size = sizeof(int32_t);
1977 trans->seq.value.type = forge->Int;
1978
1979 trans->seq_val = sequence_number;
1980
1981 trans->dest.key = regs->patch.destination.urid;
1982 trans->dest.context = 0;
1983 trans->dest.value.size = sizeof(LV2_URID);
1984 trans->dest.value.type = forge->URID;
1985
1986 trans->dest_val = regs->core.plugin.urid;
1987 }
1988 #endif
1989
1990 // non-rt
1991 static LilvNodes *
_preset_reload(LilvWorld * world,reg_t * regs,const LilvPlugin * plugin,LilvNodes * presets,const char * bndl)1992 _preset_reload(LilvWorld *world, reg_t *regs, const LilvPlugin *plugin,
1993 LilvNodes *presets, const char *bndl)
1994 {
1995 if(presets)
1996 {
1997 // unload resources for this module's presets
1998 LILV_FOREACH(nodes, itr, presets)
1999 {
2000 const LilvNode *preset = lilv_nodes_get(presets, itr);
2001
2002 lilv_world_unload_resource(world, preset);
2003 }
2004
2005 // free presets for this module
2006 lilv_nodes_free(presets);
2007 }
2008
2009 LilvNode *bndl_node = lilv_new_file_uri(world, NULL, bndl);
2010 if(bndl_node)
2011 {
2012 // unload bundle (if it should already be loaded)
2013 lilv_world_unload_bundle(world, bndl_node);
2014
2015 // load bundle
2016 lilv_world_load_bundle(world, bndl_node);
2017 lilv_node_free(bndl_node);
2018 }
2019
2020 // discover presets for this module
2021 presets = lilv_plugin_get_related(plugin, regs->pset.preset.node);
2022
2023 // load resources for this module's presets
2024 LILV_FOREACH(nodes, itr, presets)
2025 {
2026 const LilvNode *preset = lilv_nodes_get(presets, itr);
2027
2028 lilv_world_load_resource(world, preset);
2029 }
2030
2031 return presets;
2032 }
2033
2034 static inline int
_signum(LV2_URID urid1,LV2_URID urid2)2035 _signum(LV2_URID urid1, LV2_URID urid2)
2036 {
2037 if(urid1 < urid2)
2038 return -1;
2039 else if(urid1 > urid2)
2040 return 1;
2041
2042 return 0;
2043 }
2044
2045 #endif // _SYNTHPOD_PRIVATE_H
2046