23#include "zrythm-config.h"
37#include "lv2/core/lv2.h"
47#define GTK2_UI_URI LV2_UI__GtkUI
48#define GTK3_UI_URI LV2_UI__Gtk3UI
49#define GTK4_UI_URI LV2_UI__Gtk4UI
50#define QT4_UI_URI LV2_UI__Qt4UI
51#define QT5_UI_URI LV2_UI__Qt5UI
52#define X11_UI_URI LV2_UI__X11UI
53#define WIN_UI_URI LV2_UI_PREFIX "WindowsUI"
54#define COCOA_UI_URI LV2_UI__CocoaUI
106 uint32_t buffer_size,
113 const char* port_symbol);
120 const LV2_Feature*
const* features);
127 const LV2_Feature*
const* features);
190 const char* ui_type_uri);
219 const char* container_type_uri,
220 const char* plugin_uri,
222 const char* ui_type_uri,
223 const char* ui_bundle_path,
224 const char* ui_binary_path,
225 const LV2_Feature*
const* features);
278 uint32_t buffer_size,
296#include "lv2/ui/ui.h"
298#define SUIL_ERRORF(fmt, ...) g_warning("suil error: " fmt, __VA_ARGS__)
313typedef void (*SuilWrapperFreeFunc)(
struct _SuilWrapper*);
315typedef int (*SuilWrapperWrapFunc)(
struct _SuilWrapper* wrapper,
316 SuilInstance* instance);
318typedef struct _SuilWrapper {
319 SuilWrapperWrapFunc wrap;
320 SuilWrapperFreeFunc free;
318typedef struct _SuilWrapper {
…};
327 const LV2UI_Descriptor* descriptor;
330 LV2_Feature** features;
331 LV2UI_Port_Map port_map;
332 LV2UI_Port_Subscribe port_subscribe;
346 const char* host_type_uri,
347 const char* ui_type_uri,
348 LV2_Feature*** features,
349 unsigned n_features);
354 const char* host_type_uri,
355 const char* ui_type_uri,
356 LV2_Feature*** features,
357 unsigned n_features);
365 const char* host_type_uri,
366 const char* ui_type_uri,
367 LV2_Feature*** features,
368 unsigned n_features);
374 const char* host_type_uri,
375 const char* ui_type_uri,
376 LV2_Feature*** features,
377 unsigned n_features);
383 const char* host_type_uri,
384 const char* ui_type_uri,
385 LV2_Feature*** features,
386 unsigned n_features);
396typedef void (*SuilVoidFunc)(void);
399static inline SuilVoidFunc
400suil_dlfunc(
void* handle,
const char* symbol)
403 return (SuilVoidFunc)GetProcAddress((HMODULE)handle, (LPCSTR) symbol);
405 typedef SuilVoidFunc (*VoidFuncGetter)(
void*,
const char*);
406 VoidFuncGetter dlfunc = (VoidFuncGetter)dlsym;
407 return dlfunc(handle, symbol);
413suil_add_feature(LV2_Feature*** features,
418 for (
unsigned i = 0; i < *n && (*features)[i]; ++i) {
419 if (!strcmp((*features)[i]->URI, uri)) {
420 (*features)[i]->data = data;
425 *features = (LV2_Feature**)realloc(*features,
426 sizeof(LV2_Feature*) * (*n + 2));
428 (*features)[*n] = (LV2_Feature*)malloc(
sizeof(LV2_Feature));
429 (*features)[*n]->URI = uri;
430 (*features)[*n]->data = data;
431 (*features)[*n + 1] = NULL;
SuilHandle suil_instance_get_handle(SuilInstance *instance)
Get the handle for a UI instance.
SuilArg
Initialization argument.
void * SuilWidget
Opaque pointer to a UI widget.
void suil_init(int *argc, char ***argv, SuilArg key,...)
Initialize suil.
SuilHost * suil_host_new(SuilPortWriteFunc write_func, SuilPortIndexFunc index_func, SuilPortSubscribeFunc subscribe_func, SuilPortUnsubscribeFunc unsubscribe_func)
Create a new UI host descriptor.
void suil_host_set_touch_func(SuilHost *host, SuilTouchFunc touch_func)
Set a touch function for a host descriptor.
void suil_host_free(SuilHost *host)
Free host.
uint32_t(* SuilPortIndexFunc)(SuilController controller, const char *port_symbol)
Function to return the index for a port by symbol.
uint32_t(* SuilPortUnsubscribeFunc)(SuilController controller, uint32_t port_index, uint32_t protocol, const LV2_Feature *const *features)
Function to unsubscribe from notifications for a port.
void suil_instance_free(SuilInstance *instance)
Free a plugin UI instance.
unsigned suil_ui_supported(const char *host_type_uri, const char *ui_type_uri)
Check if suil can wrap a UI type.
SuilInstance * suil_instance_new(SuilHost *host, SuilController controller, const char *container_type_uri, const char *plugin_uri, const char *ui_uri, const char *ui_type_uri, const char *ui_bundle_path, const char *ui_binary_path, const LV2_Feature *const *features)
Instantiate a UI for an LV2 plugin.
void * SuilHandle
Opaque pointer to a UI handle.
SuilWidget suil_instance_get_widget(SuilInstance *instance)
Get the widget for a UI instance.
void * SuilController
UI controller.
void suil_instance_port_event(SuilInstance *instance, uint32_t port_index, uint32_t buffer_size, uint32_t format, const void *buffer)
Notify the UI about a change in a plugin port.
uint32_t(* SuilPortSubscribeFunc)(SuilController controller, uint32_t port_index, uint32_t protocol, const LV2_Feature *const *features)
Function to subscribe to notifications for a port.
const void * suil_instance_extension_data(SuilInstance *instance, const char *uri)
Return a data structure defined by some LV2 extension URI.
void(* SuilPortWriteFunc)(SuilController controller, uint32_t port_index, uint32_t buffer_size, uint32_t protocol, void const *buffer)
Function to write/send a value to a port.
void(* SuilTouchFunc)(SuilController controller, uint32_t port_index, bool grabbed)
Function called when a control is grabbed or released.
An instance of an LV2 plugin UI.
SuilWrapper * suil_wrapper_new_cocoa(SuilHost *host, const char *host_type_uri, const char *ui_type_uri, LV2_Feature ***features, unsigned n_features)
Prototype for suil_wrapper_new in each wrapper module.
void suil_host_init(void)
Prototype for suil_host_init in each init module.
SuilWrapper * suil_wrapper_new_qt5(SuilHost *host, const char *host_type_uri, const char *ui_type_uri, LV2_Feature ***features, unsigned n_features)
Prototype for suil_wrapper_new in each wrapper module.
SuilWrapper * suil_wrapper_new_woe(SuilHost *host, const char *host_type_uri, const char *ui_type_uri, LV2_Feature ***features, unsigned n_features)
Prototype for suil_wrapper_new in each wrapper module.
SuilWrapper * suil_wrapper_new_x11(SuilHost *host, const char *host_type_uri, const char *ui_type_uri, LV2_Feature ***features, unsigned n_features)
Prototype for suil_wrapper_new in each wrapper module.