diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/server/LV2Info.cpp | 35 | ||||
-rw-r--r-- | src/server/LV2Info.hpp | 17 | ||||
-rw-r--r-- | src/server/LV2Node.cpp | 44 |
3 files changed, 46 insertions, 50 deletions
diff --git a/src/server/LV2Info.cpp b/src/server/LV2Info.cpp index 6e5d046a..e772b696 100644 --- a/src/server/LV2Info.cpp +++ b/src/server/LV2Info.cpp @@ -19,6 +19,7 @@ #include <assert.h> #include "lv2/lv2plug.in/ns/ext/atom/atom.h" +#include "lv2/lv2plug.in/ns/ext/resize-port/resize-port.h" #include "ingen/shared/World.hpp" #include "ingen/shared/LV2Features.hpp" @@ -31,12 +32,17 @@ namespace Ingen { namespace Server { LV2Info::LV2Info(Ingen::Shared::World* world) - : input_class(lilv_new_uri(world->lilv_world(), LV2_CORE__InputPort)) - , output_class(lilv_new_uri(world->lilv_world(), LV2_CORE__OutputPort)) - , control_class(lilv_new_uri(world->lilv_world(), LV2_CORE__ControlPort)) - , cv_class(lilv_new_uri(world->lilv_world(), LV2_CORE__CVPort)) - , audio_class(lilv_new_uri(world->lilv_world(), LV2_CORE__AudioPort)) - , atom_port_class(lilv_new_uri(world->lilv_world(), LV2_ATOM__AtomPort)) + : atom_AtomPort(lilv_new_uri(world->lilv_world(), LV2_ATOM__AtomPort)) + , atom_bufferType(lilv_new_uri(world->lilv_world(), LV2_ATOM__bufferType)) + , atom_supports(lilv_new_uri(world->lilv_world(), LV2_ATOM__supports)) + , lv2_AudioPort(lilv_new_uri(world->lilv_world(), LV2_CORE__AudioPort)) + , lv2_CVPort(lilv_new_uri(world->lilv_world(), LV2_CORE__CVPort)) + , lv2_ControlPort(lilv_new_uri(world->lilv_world(), LV2_CORE__ControlPort)) + , lv2_InputPort(lilv_new_uri(world->lilv_world(), LV2_CORE__InputPort)) + , lv2_OutputPort(lilv_new_uri(world->lilv_world(), LV2_CORE__OutputPort)) + , lv2_default(lilv_new_uri(world->lilv_world(), LV2_CORE__default)) + , lv2_portProperty(lilv_new_uri(world->lilv_world(), LV2_CORE__portProperty)) + , rsz_minimumSize(lilv_new_uri(world->lilv_world(), LV2_RESIZE_PORT__minimumSize)) , _world(world) { assert(world); @@ -49,12 +55,17 @@ LV2Info::LV2Info(Ingen::Shared::World* world) LV2Info::~LV2Info() { - lilv_node_free(input_class); - lilv_node_free(output_class); - lilv_node_free(control_class); - lilv_node_free(cv_class); - lilv_node_free(audio_class); - lilv_node_free(atom_port_class); + lilv_node_free(rsz_minimumSize); + lilv_node_free(lv2_portProperty); + lilv_node_free(lv2_default); + lilv_node_free(lv2_OutputPort); + lilv_node_free(lv2_InputPort); + lilv_node_free(lv2_ControlPort); + lilv_node_free(lv2_CVPort); + lilv_node_free(lv2_AudioPort); + lilv_node_free(atom_supports); + lilv_node_free(atom_bufferType); + lilv_node_free(atom_AtomPort); } } // namespace Server diff --git a/src/server/LV2Info.hpp b/src/server/LV2Info.hpp index 2c31b243..4a12f5cd 100644 --- a/src/server/LV2Info.hpp +++ b/src/server/LV2Info.hpp @@ -33,12 +33,17 @@ public: explicit LV2Info(Ingen::Shared::World* world); ~LV2Info(); - LilvNode* input_class; - LilvNode* output_class; - LilvNode* control_class; - LilvNode* cv_class; - LilvNode* audio_class; - LilvNode* atom_port_class; + LilvNode* atom_AtomPort; + LilvNode* atom_bufferType; + LilvNode* atom_supports; + LilvNode* lv2_AudioPort; + LilvNode* lv2_CVPort; + LilvNode* lv2_ControlPort; + LilvNode* lv2_InputPort; + LilvNode* lv2_OutputPort; + LilvNode* lv2_default; + LilvNode* lv2_portProperty; + LilvNode* rsz_minimumSize; Ingen::Shared::World& world() { return *_world; } LilvWorld* lv2_world() { return _world->lilv_world(); } diff --git a/src/server/LV2Node.cpp b/src/server/LV2Node.cpp index 91c1d2d1..5949e564 100644 --- a/src/server/LV2Node.cpp +++ b/src/server/LV2Node.cpp @@ -21,6 +21,7 @@ #include <string> #include "lv2/lv2plug.in/ns/ext/resize-port/resize-port.h" +#include "lv2/lv2plug.in/ns/ext/morph/morph.h" #include "raul/log.hpp" #include "raul/Maid.hpp" @@ -184,24 +185,6 @@ LV2Node::instantiate(BufferFactory& bufs) float* def_values = new float[num_ports]; lilv_plugin_get_port_ranges_float(plug, min_values, max_values, def_values); - LilvNode* default_pred = lilv_new_uri(info->lv2_world(), - LV2_CORE__default); - - LilvNode* min_size_pred = lilv_new_uri(info->lv2_world(), - LV2_RESIZE_PORT__minimumSize); - - LilvNode* port_property_pred = lilv_new_uri(info->lv2_world(), - LV2_CORE__portProperty); - - LilvNode* supports_pred = lilv_new_uri(info->lv2_world(), - LV2_ATOM__supports); - - LilvNode* bufferType_pred = lilv_new_uri(info->lv2_world(), - LV2_ATOM__bufferType); - - //LilvNode as_large_as_pred = lilv_new_uri(info->lv2_world(), - // LV2_RESIZE_PORT__asLargeAs); - for (uint32_t j = 0; j < num_ports; ++j) { const LilvPort* id = lilv_plugin_get_port_by_index(plug, j); @@ -222,22 +205,22 @@ LV2Node::instantiate(BufferFactory& bufs) Raul::Atom val; PortType port_type = PortType::UNKNOWN; LV2_URID buffer_type = 0; - if (lilv_port_is_a(plug, id, info->control_class)) { + if (lilv_port_is_a(plug, id, info->lv2_ControlPort)) { port_type = PortType::CONTROL; buffer_type = uris.atom_Float; - } else if (lilv_port_is_a(plug, id, info->cv_class)) { + } else if (lilv_port_is_a(plug, id, info->lv2_CVPort)) { port_type = PortType::CV; buffer_type = uris.atom_Sound; - } else if (lilv_port_is_a(plug, id, info->audio_class)) { + } else if (lilv_port_is_a(plug, id, info->lv2_AudioPort)) { port_type = PortType::AUDIO; buffer_type = uris.atom_Sound; - } else if (lilv_port_is_a(plug, id, info->atom_port_class)) { + } else if (lilv_port_is_a(plug, id, info->atom_AtomPort)) { port_type = PortType::ATOM; } // Get buffer type if necessary (value and message ports) if (!buffer_type) { - LilvNodes* types = lilv_port_get_value(plug, id, bufferType_pred); + LilvNodes* types = lilv_port_get_value(plug, id, info->atom_bufferType); LILV_FOREACH(nodes, i, types) { const LilvNode* type = lilv_nodes_get(types, i); if (lilv_node_is_uri(type)) { @@ -253,7 +236,7 @@ LV2Node::instantiate(BufferFactory& bufs) if (port_type == PortType::ATOM) { // Get default value, and its length - LilvNodes* defaults = lilv_port_get_value(plug, id, default_pred); + LilvNodes* defaults = lilv_port_get_value(plug, id, info->lv2_default); LILV_FOREACH(nodes, i, defaults) { const LilvNode* d = lilv_nodes_get(defaults, i); if (lilv_node_is_string(d)) { @@ -265,7 +248,7 @@ LV2Node::instantiate(BufferFactory& bufs) } // Get minimum size, if set in data - LilvNodes* sizes = lilv_port_get_value(plug, id, min_size_pred); + LilvNodes* sizes = lilv_port_get_value(plug, id, info->rsz_minimumSize); LILV_FOREACH(nodes, i, sizes) { const LilvNode* d = lilv_nodes_get(sizes, i); if (lilv_node_is_int(d)) { @@ -279,9 +262,9 @@ LV2Node::instantiate(BufferFactory& bufs) } enum { UNKNOWN, INPUT, OUTPUT } direction = UNKNOWN; - if (lilv_port_is_a(plug, id, info->input_class)) { + if (lilv_port_is_a(plug, id, info->lv2_InputPort)) { direction = INPUT; - } else if (lilv_port_is_a(plug, id, info->output_class)) { + } else if (lilv_port_is_a(plug, id, info->lv2_OutputPort)) { direction = OUTPUT; } @@ -314,7 +297,7 @@ LV2Node::instantiate(BufferFactory& bufs) } // Set lv2:portProperty properties - LilvNodes* properties = lilv_port_get_value(plug, id, port_property_pred); + LilvNodes* properties = lilv_port_get_value(plug, id, info->lv2_portProperty); LILV_FOREACH(nodes, i, properties) { const LilvNode* p = lilv_nodes_get(properties, i); if (lilv_node_is_uri(p)) { @@ -324,7 +307,7 @@ LV2Node::instantiate(BufferFactory& bufs) } // Set atom:supports properties - LilvNodes* types = lilv_port_get_value(plug, id, supports_pred); + LilvNodes* types = lilv_port_get_value(plug, id, info->atom_supports); LILV_FOREACH(nodes, i, types) { const LilvNode* type = lilv_nodes_get(types, i); if (lilv_node_is_uri(type)) { @@ -346,9 +329,6 @@ LV2Node::instantiate(BufferFactory& bufs) delete[] min_values; delete[] max_values; delete[] def_values; - lilv_node_free(default_pred); - lilv_node_free(min_size_pred); - lilv_node_free(port_property_pred); return ret; } |