aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorHanspeter Portner <dev@open-music-kontrollers.ch>2015-08-16 12:23:14 +0200
committerHanspeter Portner <dev@open-music-kontrollers.ch>2015-08-16 12:23:14 +0200
commit8376dca4e55f1d4b11acbc1e21798aeea561fd9f (patch)
treec6d122135d034cc51e493211e304a565e07adcc6 /lib
parentb8ac842898af8f43551e14057cf8abaaefe15a64 (diff)
downloadsynthpod-8376dca4e55f1d4b11acbc1e21798aeea561fd9f.tar.xz
outsource lilv_new_uri where possible.
Diffstat (limited to 'lib')
-rw-r--r--lib/synthpod_app.c19
-rw-r--r--lib/synthpod_private.h34
-rw-r--r--lib/synthpod_ui.c45
3 files changed, 54 insertions, 44 deletions
diff --git a/lib/synthpod_app.c b/lib/synthpod_app.c
index bbf80cc6..b4e1b963 100644
--- a/lib/synthpod_app.c
+++ b/lib/synthpod_app.c
@@ -804,18 +804,13 @@ _sp_app_mod_add(sp_app_t *app, const char *uri, uint32_t uid)
tar->protocol = app->regs.port.event_transfer.urid;
// check whether this is a control port
- LilvNode *control_designation = lilv_new_uri(app->world, LV2_CORE__control);
- if(control_designation)
- {
- const LilvPort *control_port = lilv_plugin_get_port_by_designation(plug,
- tar->direction == PORT_DIRECTION_INPUT
- ? app->regs.port.input.node
- : app->regs.port.output.node
- , control_designation);
-
- tar->selected = control_port == port; // only select control ports by default
- lilv_node_free(control_designation);
- }
+ const LilvPort *control_port = lilv_plugin_get_port_by_designation(plug,
+ tar->direction == PORT_DIRECTION_INPUT
+ ? app->regs.port.input.node
+ : app->regs.port.output.node
+ , app->regs.core.control.node);
+
+ tar->selected = control_port == port; // only select control ports by default
}
else
; //TODO
diff --git a/lib/synthpod_private.h b/lib/synthpod_private.h
index e0dd4d7f..b30c02c3 100644
--- a/lib/synthpod_private.h
+++ b/lib/synthpod_private.h
@@ -44,6 +44,7 @@
#include <lv2/lv2plug.in/ns/extensions/ui/ui.h>
#include <lv2/lv2plug.in/ns/extensions/units/units.h>
#include <zero_worker.h>
+#include <lv2_external_ui.h> // kxstudio kx-ui extension
typedef enum _port_type_t port_type_t;
typedef enum _port_buffer_type_t port_buffer_type_t;
@@ -141,6 +142,13 @@ struct _reg_t {
struct {
reg_item_t eo;
reg_item_t window_title;
+ reg_item_t show_interface;
+ reg_item_t idle_interface;
+ reg_item_t kx_widget;
+ reg_item_t external;
+ reg_item_t x11;
+ reg_item_t plugin;
+ reg_item_t protocol;
} ui;
struct {
@@ -162,6 +170,10 @@ struct _reg_t {
reg_item_t name;
reg_item_t minor_version;
reg_item_t micro_version;
+ reg_item_t extension_data;
+ reg_item_t control;
+ reg_item_t symbol;
+ reg_item_t index;
} core;
struct {
@@ -293,6 +305,13 @@ sp_regs_init(reg_t *regs, LilvWorld *world, LV2_URID_Map *map)
_register(&regs->ui.eo, world, map, LV2_UI__EoUI);
_register(&regs->ui.window_title, world, map, LV2_UI__windowTitle);
+ _register(&regs->ui.show_interface, world, map, LV2_UI__showInterface);
+ _register(&regs->ui.idle_interface, world, map, LV2_UI__idleInterface);
+ _register(&regs->ui.kx_widget, world, map, LV2_EXTERNAL_UI__Widget);
+ _register(&regs->ui.external, world, map, LV2_EXTERNAL_UI_DEPRECATED_URI);
+ _register(&regs->ui.x11, world, map, LV2_UI__X11UI);
+ _register(&regs->ui.plugin, world, map, LV2_UI__plugin);
+ _register(&regs->ui.protocol, world, map, LV2_UI_PREFIX"protocol");
_register(&regs->pset.preset, world, map, LV2_PRESETS__Preset);
@@ -306,6 +325,10 @@ sp_regs_init(reg_t *regs, LilvWorld *world, LV2_URID_Map *map)
_register(&regs->core.name, world, map, LV2_CORE__name);
_register(&regs->core.minor_version, world, map, LV2_CORE__minorVersion);
_register(&regs->core.micro_version, world, map, LV2_CORE__microVersion);
+ _register(&regs->core.extension_data, world, map, LV2_CORE__extensionData);
+ _register(&regs->core.control, world, map, LV2_CORE__control);
+ _register(&regs->core.symbol, world, map, LV2_CORE__symbol);
+ _register(&regs->core.index, world, map, LV2_CORE__index);
_register(&regs->bufsz.max_block_length, world, map, LV2_BUF_SIZE__maxBlockLength);
_register(&regs->bufsz.min_block_length, world, map, LV2_BUF_SIZE__minBlockLength);
@@ -408,6 +431,13 @@ sp_regs_deinit(reg_t *regs)
_unregister(&regs->ui.eo);
_unregister(&regs->ui.window_title);
+ _unregister(&regs->ui.show_interface);
+ _unregister(&regs->ui.idle_interface);
+ _unregister(&regs->ui.kx_widget);
+ _unregister(&regs->ui.external);
+ _unregister(&regs->ui.x11);
+ _unregister(&regs->ui.plugin);
+ _unregister(&regs->ui.protocol);
_unregister(&regs->pset.preset);
@@ -421,6 +451,10 @@ sp_regs_deinit(reg_t *regs)
_unregister(&regs->core.name);
_unregister(&regs->core.minor_version);
_unregister(&regs->core.micro_version);
+ _unregister(&regs->core.extension_data);
+ _unregister(&regs->core.control);
+ _unregister(&regs->core.symbol);
+ _unregister(&regs->core.index);
_unregister(&regs->bufsz.max_block_length);
_unregister(&regs->bufsz.min_block_length);
diff --git a/lib/synthpod_ui.c b/lib/synthpod_ui.c
index c45355e0..f8981122 100644
--- a/lib/synthpod_ui.c
+++ b/lib/synthpod_ui.c
@@ -816,20 +816,20 @@ _mod_subscription_set(mod_t *mod, const LilvUI *ui_ui, int state)
// subscribe manually for port notifications
const LilvNode *plug_uri_node = lilv_plugin_get_uri(mod->plug);
- LilvNode *lv2_symbol = lilv_new_uri(ui->world, LV2_CORE__symbol);
- LilvNode *lv2_index = lilv_new_uri(ui->world, LV2_CORE__index);
- LilvNode *ui_plugin = lilv_new_uri(ui->world, LV2_UI__plugin);
- LilvNode *ui_prot = lilv_new_uri(ui->world, LV2_UI_PREFIX"protocol");
LilvNodes *notifs = lilv_world_find_nodes(ui->world,
lilv_ui_get_uri(ui_ui), ui->regs.port.notification.node, NULL);
LILV_FOREACH(nodes, n, notifs)
{
const LilvNode *notif = lilv_nodes_get(notifs, n);
- const LilvNode *sym = lilv_world_get(ui->world, notif, lv2_symbol, NULL);
- const LilvNode *ind = lilv_world_get(ui->world, notif, lv2_index, NULL);
- const LilvNode *plug = lilv_world_get(ui->world, notif, ui_plugin, NULL);
- const LilvNode *prot = lilv_world_get(ui->world, notif, ui_prot, NULL);
+ const LilvNode *sym = lilv_world_get(ui->world, notif,
+ ui->regs.core.symbol.node, NULL);
+ const LilvNode *ind = lilv_world_get(ui->world, notif,
+ ui->regs.core.index.node, NULL);
+ const LilvNode *plug = lilv_world_get(ui->world, notif,
+ ui->regs.ui.plugin.node, NULL);
+ const LilvNode *prot = lilv_world_get(ui->world, notif,
+ ui->regs.ui.protocol.node, NULL);
if(plug && !lilv_node_equals(plug, plug_uri_node))
continue; // notification not for this plugin
@@ -887,10 +887,6 @@ _mod_subscription_set(mod_t *mod, const LilvUI *ui_ui, int state)
}
}
lilv_nodes_free(notifs);
- lilv_node_free(lv2_symbol);
- lilv_node_free(lv2_index);
- lilv_node_free(ui_plugin);
- lilv_node_free(ui_prot);
}
static void
@@ -1757,15 +1753,10 @@ _sp_ui_mod_add(sp_ui_t *ui, const char *uri, u_id_t uid, LV2_Handle inst,
// test for show UI
{ //TODO add to reg_t
- LilvNode *extension_data = lilv_new_uri(ui->world, LV2_CORE__extensionData);
- //LilvNode *required_feature = lilv_new_uri(ui->world, LV2_CORE__requiredFeature);
- LilvNode *show_interface = lilv_new_uri(ui->world, LV2_UI__showInterface);
- LilvNode *idle_interface = lilv_new_uri(ui->world, LV2_UI__idleInterface);
-
LilvNodes* has_idle_iface = lilv_world_find_nodes(ui->world, ui_uri_node,
- extension_data, idle_interface);
+ ui->regs.core.extension_data.node, ui->regs.ui.idle_interface.node);
LilvNodes* has_show_iface = lilv_world_find_nodes(ui->world, ui_uri_node,
- extension_data, show_interface);
+ ui->regs.core.extension_data.node, ui->regs.ui.show_interface.node);
if(lilv_nodes_size(has_show_iface)) // idle_iface is implicitely included
{
@@ -1775,35 +1766,25 @@ _sp_ui_mod_add(sp_ui_t *ui, const char *uri, u_id_t uid, LV2_Handle inst,
lilv_nodes_free(has_show_iface);
lilv_nodes_free(has_idle_iface);
-
- lilv_node_free(extension_data);
- //lilv_node_free(required_feature);
- lilv_node_free(show_interface);
- lilv_node_free(idle_interface);
}
// test for kxstudio kx_ui
{
- LilvNode *kx_ui = lilv_new_uri(ui->world, LV2_EXTERNAL_UI__Widget);
- LilvNode *ext_ui = lilv_new_uri(ui->world, LV2_EXTERNAL_UI_DEPRECATED_URI);
- if( lilv_ui_is_a(lui, kx_ui) || lilv_ui_is_a(lui, ext_ui) )
+ if( lilv_ui_is_a(lui, ui->regs.ui.kx_widget.node)
+ || lilv_ui_is_a(lui, ui->regs.ui.external.node) )
{
//printf("has kx-ui\n");
mod->kx.ui = lui;
}
- lilv_node_free(kx_ui);
- lilv_node_free(ext_ui);
}
// test for X11UI
{
- LilvNode *x11_ui = lilv_new_uri(ui->world, LV2_UI__X11UI);
- if(lilv_ui_is_a(lui, x11_ui))
+ if(lilv_ui_is_a(lui, ui->regs.ui.x11.node))
{
//printf("has x11-ui\n");
mod->x11.ui = lui;
}
- lilv_node_free(x11_ui);
}
}
}