diff options
author | David Robillard <d@drobilla.net> | 2024-11-17 17:59:48 -0500 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2024-11-24 19:07:21 -0500 |
commit | 30ec5250ca9963ecbab37a6103fdbd2ea0fcdc90 (patch) | |
tree | 960648ac973fd6f96ab1d53518c0934eae112c4a /src/jalv.c | |
parent | e00df6c4764e2eb0fcef8bbe2b052680cd8fb02a (diff) | |
download | jalv-30ec5250ca9963ecbab37a6103fdbd2ea0fcdc90.tar.gz jalv-30ec5250ca9963ecbab37a6103fdbd2ea0fcdc90.tar.bz2 jalv-30ec5250ca9963ecbab37a6103fdbd2ea0fcdc90.zip |
Move general model query functions to a separate file
Diffstat (limited to 'src/jalv.c')
-rw-r--r-- | src/jalv.c | 57 |
1 files changed, 7 insertions, 50 deletions
@@ -14,6 +14,7 @@ #include "mapper.h" #include "nodes.h" #include "port.h" +#include "query.h" #include "state.h" #include "string_utils.h" #include "types.h" @@ -89,28 +90,6 @@ feature_is_supported(const Jalv* jalv, const char* uri) return false; } -static bool -has_designation(const JalvNodes* const nodes, - const LilvPlugin* const plugin, - const JalvPort* const port, - const LilvNode* const designation) -{ - LilvNodes* const designations = - lilv_port_get_value(plugin, port->lilv_port, nodes->lv2_designation); - - bool found = false; - LILV_FOREACH (nodes, n, designations) { - const LilvNode* const node = lilv_nodes_get(designations, n); - if (lilv_node_equals(node, designation)) { - found = true; - break; - } - } - - lilv_nodes_free(designations); - return found; -} - /** Create a port structure from data description. @@ -192,8 +171,8 @@ create_port(Jalv* jalv, uint32_t port_index) // Set primary flag for designated control port if (port->type == TYPE_EVENT && - has_designation( - &jalv->nodes, jalv->plugin, port, jalv->nodes.lv2_control)) { + jalv_port_has_designation( + &jalv->nodes, jalv->plugin, port->lilv_port, jalv->nodes.lv2_control)) { port->is_primary = true; if (port->flow == FLOW_INPUT && jalv->control_in == UINT32_MAX) { jalv->control_in = port->index; @@ -204,8 +183,10 @@ create_port(Jalv* jalv, uint32_t port_index) if (port->flow == FLOW_OUTPUT && port->type == TYPE_CONTROL && (lilv_port_has_property( jalv->plugin, port->lilv_port, jalv->nodes.lv2_reportsLatency) || - has_designation( - &jalv->nodes, jalv->plugin, port, jalv->nodes.lv2_latency))) { + jalv_port_has_designation(&jalv->nodes, + jalv->plugin, + port->lilv_port, + jalv->nodes.lv2_latency))) { port->reports_latency = true; } @@ -491,30 +472,6 @@ jalv_ui_instantiate(Jalv* jalv, const char* native_ui_type, void* parent) #endif } -bool -jalv_ui_is_resizable(Jalv* jalv) -{ - if (!jalv->ui) { - return false; - } - - const LilvNode* s = lilv_ui_get_uri(jalv->ui); - LilvNode* p = lilv_new_uri(jalv->world, LV2_CORE__optionalFeature); - LilvNode* fs = lilv_new_uri(jalv->world, LV2_UI__fixedSize); - LilvNode* nrs = lilv_new_uri(jalv->world, LV2_UI__noUserResize); - - LilvNodes* fs_matches = lilv_world_find_nodes(jalv->world, s, p, fs); - LilvNodes* nrs_matches = lilv_world_find_nodes(jalv->world, s, p, nrs); - - lilv_nodes_free(nrs_matches); - lilv_nodes_free(fs_matches); - lilv_node_free(nrs); - lilv_node_free(fs); - lilv_node_free(p); - - return !fs_matches && !nrs_matches; -} - void jalv_init_ui(Jalv* jalv) { |