diff options
author | David Robillard <d@drobilla.net> | 2016-09-16 18:26:01 +0800 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2016-09-16 18:26:01 +0800 |
commit | 701f67947d415feb416cfab83938380b063d6624 (patch) | |
tree | f117e4eda04e4ecab71bfc2731945208828d5c81 | |
parent | e076d9c31b4dd5e11f856aeeb634d18f1ba33b12 (diff) | |
download | jalv-701f67947d415feb416cfab83938380b063d6624.tar.gz jalv-701f67947d415feb416cfab83938380b063d6624.tar.bz2 jalv-701f67947d415feb416cfab83938380b063d6624.zip |
Use cached URIs and fix pprops:rangeSteps nonsense
-rw-r--r-- | src/jalv.c | 3 | ||||
-rw-r--r-- | src/jalv_internal.h | 3 | ||||
-rw-r--r-- | src/jalv_qt.cpp | 36 |
3 files changed, 17 insertions, 25 deletions
@@ -1124,10 +1124,13 @@ main(int argc, char** argv) jalv.nodes.lv2_name = lilv_new_uri(world, LV2_CORE__name); jalv.nodes.lv2_reportsLatency = lilv_new_uri(world, LV2_CORE__reportsLatency); jalv.nodes.lv2_sampleRate = lilv_new_uri(world, LV2_CORE__sampleRate); + jalv.nodes.lv2_symbol = lilv_new_uri(world, LV2_CORE__symbol); jalv.nodes.lv2_toggled = lilv_new_uri(world, LV2_CORE__toggled); jalv.nodes.midi_MidiEvent = lilv_new_uri(world, LV2_MIDI__MidiEvent); jalv.nodes.pg_group = lilv_new_uri(world, LV2_PORT_GROUPS__group); jalv.nodes.pprops_logarithmic = lilv_new_uri(world, LV2_PORT_PROPS__logarithmic); + jalv.nodes.pprops_notOnGUI = lilv_new_uri(world, LV2_PORT_PROPS__notOnGUI); + jalv.nodes.pprops_rangeSteps = lilv_new_uri(world, LV2_PORT_PROPS__rangeSteps); jalv.nodes.pset_Preset = lilv_new_uri(world, LV2_PRESETS__Preset); jalv.nodes.pset_bank = lilv_new_uri(world, LV2_PRESETS__bank); jalv.nodes.rdfs_comment = lilv_new_uri(world, LILV_NS_RDFS "comment"); diff --git a/src/jalv_internal.h b/src/jalv_internal.h index 82fef4a..b34df86 100644 --- a/src/jalv_internal.h +++ b/src/jalv_internal.h @@ -215,10 +215,13 @@ typedef struct { LilvNode* lv2_name; LilvNode* lv2_reportsLatency; LilvNode* lv2_sampleRate; + LilvNode* lv2_symbol; LilvNode* lv2_toggled; LilvNode* midi_MidiEvent; LilvNode* pg_group; LilvNode* pprops_logarithmic; + LilvNode* pprops_notOnGUI; + LilvNode* pprops_rangeSteps; LilvNode* pset_Preset; LilvNode* pset_bank; LilvNode* rdfs_comment; diff --git a/src/jalv_qt.cpp b/src/jalv_qt.cpp index 178db16..b7ed4b1 100644 --- a/src/jalv_qt.cpp +++ b/src/jalv_qt.cpp @@ -402,23 +402,17 @@ Control::Control(PortContainer portContainer, QWidget* parent) , port(portContainer.port) , label(new QLabel()) { + JalvNodes* nodes = &portContainer.jalv->nodes; const LilvPort* lilvPort = port->lilv_port; - LilvWorld* world = portContainer.jalv->world; - - LilvNode* lv2_integer = lilv_new_uri(world, LV2_CORE__integer); - LilvNode* lv2_toggled = lilv_new_uri(world, LV2_CORE__toggled); - LilvNode* lv2_enumeration = lilv_new_uri(world, LV2_CORE__enumeration); - LilvNode* logarithmic = lilv_new_uri(world, LV2_PORT_PROPS__logarithmic); - LilvNode* rangeSteps = lilv_new_uri(world, LV2_PORT_PROPS__rangeSteps); - LilvNode* rdfs_comment = lilv_new_uri(world, LILV_NS_RDFS "comment"); LilvNode* nmin; LilvNode* nmax; LilvNode* ndef; lilv_port_get_range(plugin, lilvPort, &ndef, &nmin, &nmax); - if (lilv_port_has_property(plugin, lilvPort, rangeSteps)) { - steps = lilv_node_as_int(rangeSteps); + LilvNode* stepsNode = lilv_port_get(plugin, lilvPort, nodes->pprops_rangeSteps); + if (lilv_node_is_int(stepsNode)) { + steps = lilv_node_as_int(stepsNode); } else { steps = DIAL_STEPS; } @@ -442,11 +436,11 @@ Control::Control(PortContainer portContainer, QWidget* parent) } // Check port properties - isLogarithmic = lilv_port_has_property(plugin, lilvPort, logarithmic); - isInteger = lilv_port_has_property(plugin, lilvPort, lv2_integer); - isEnum = lilv_port_has_property(plugin, lilvPort, lv2_enumeration); + isLogarithmic = lilv_port_has_property(plugin, lilvPort, nodes->pprops_logarithmic); + isInteger = lilv_port_has_property(plugin, lilvPort, nodes->lv2_integer); + isEnum = lilv_port_has_property(plugin, lilvPort, nodes->lv2_enumeration); - if (lilv_port_has_property(plugin, lilvPort, lv2_toggled)) { + if (lilv_port_has_property(plugin, lilvPort, nodes->lv2_toggled)) { isInteger = true; if (!scaleMap[0]) { @@ -482,7 +476,7 @@ Control::Control(PortContainer portContainer, QWidget* parent) } // Set tooltip if comment is available - LilvNode* comment = lilv_port_get(plugin, lilvPort, rdfs_comment); + LilvNode* comment = lilv_port_get(plugin, lilvPort, nodes->rdfs_comment); if (comment) { QString* tooltip = new QString(); tooltip->append(lilv_node_as_string(comment)); @@ -497,11 +491,6 @@ Control::Control(PortContainer portContainer, QWidget* parent) lilv_node_free(nmax); lilv_node_free(ndef); lilv_node_free(nname); - lilv_node_free(lv2_integer); - lilv_node_free(lv2_toggled); - lilv_node_free(lv2_enumeration); - lilv_node_free(logarithmic); - lilv_node_free(rangeSteps); lilv_node_free(comment); } @@ -612,12 +601,11 @@ build_control_widget(Jalv* jalv) const LilvPlugin* plugin = jalv->plugin; LilvWorld* world = jalv->world; - LilvNode* pprop_notOnGUI = lilv_new_uri(world, LV2_PORT_PROPS__notOnGUI); - QList<PortContainer> portContainers; for (unsigned i = 0; i < jalv->num_ports; ++i) { if (!jalv->opts.show_hidden && - lilv_port_has_property(plugin, jalv->ports[i].lilv_port, pprop_notOnGUI)) { + lilv_port_has_property(plugin, jalv->ports[i].lilv_port, + jalv->nodes.pprops_notOnGUI)) { continue; } @@ -668,8 +656,6 @@ build_control_widget(Jalv* jalv) grid->setLayout(layout); - lilv_node_free(pprop_notOnGUI); - return grid; } |