From 3b22d3c8c57867cad7304dac1e9be5ee36ae9715 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Fri, 28 Aug 2015 03:07:12 +0000 Subject: Get rid of LV2Info class. git-svn-id: http://svn.drobilla.net/lad/trunk/ingen@5708 a436a847-0d15-0410-975c-d299462d15a1 --- ingen/URIs.hpp | 29 +++-- src/URIs.cpp | 258 ++++++++++++++++++++++++-------------------- src/World.cpp | 6 +- src/client/PluginUI.cpp | 6 +- src/server/BlockFactory.cpp | 18 ++-- src/server/BlockFactory.hpp | 2 - src/server/LV2Block.cpp | 51 ++++----- src/server/LV2Info.cpp | 79 -------------- src/server/LV2Info.hpp | 62 ----------- src/server/LV2Plugin.cpp | 32 ++---- src/server/LV2Plugin.hpp | 12 +-- src/server/wscript | 1 - 12 files changed, 216 insertions(+), 340 deletions(-) delete mode 100644 src/server/LV2Info.cpp delete mode 100644 src/server/LV2Info.hpp diff --git a/ingen/URIs.hpp b/ingen/URIs.hpp index d38b840e..7ef4385b 100644 --- a/ingen/URIs.hpp +++ b/ingen/URIs.hpp @@ -20,6 +20,7 @@ #include "ingen/Atom.hpp" #include "ingen/Forge.hpp" #include "ingen/ingen.h" +#include "lilv/lilv.h" #include "lv2/lv2plug.in/ns/ext/urid/urid.h" #include "raul/Noncopyable.hpp" #include "raul/URI.hpp" @@ -42,13 +43,21 @@ class URIMap; */ class INGEN_API URIs : public Raul::Noncopyable { public: - URIs(Ingen::Forge& forge, URIMap* map); + URIs(Ingen::Forge& forge, URIMap* map, LilvWorld* lworld); struct Quark : public Raul::URI { - Quark(Ingen::Forge& forge, URIMap* map, const char* str); + Quark(Ingen::Forge& forge, + URIMap* map, + LilvWorld* lworld, + const char* str); - operator LV2_URID() const { return urid.get(); } - explicit operator Atom() const { return urid; } + Quark(const Quark& copy); + + ~Quark(); + + operator LV2_URID() const { return urid.get(); } + explicit operator Atom() const { return urid; } + operator const LilvNode*() const { return lnode; } inline bool operator==(const Atom& rhs) const { if (rhs.type() == urid.type()) { @@ -63,8 +72,9 @@ public: return !operator==(rhs); } - Atom urid; - Atom uri; + Atom urid; + Atom uri; + LilvNode* lnode; }; Ingen::Forge& forge; @@ -129,7 +139,9 @@ public: const Quark lv2_index; const Quark lv2_integer; const Quark lv2_maximum; + const Quark lv2_microVersion; const Quark lv2_minimum; + const Quark lv2_minorVersion; const Quark lv2_name; const Quark lv2_port; const Quark lv2_portProperty; @@ -146,7 +158,11 @@ public: const Quark midi_binding; const Quark midi_controllerNumber; const Quark midi_noteNumber; + const Quark morph_AutoMorphPort; + const Quark morph_MorphPort; const Quark morph_currentType; + const Quark morph_supportsType; + const Quark opt_interface; const Quark param_sampleRate; const Quark patch_Copy; const Quark patch_Delete; @@ -183,6 +199,7 @@ public: const Quark time_beatsPerMinute; const Quark time_frame; const Quark time_speed; + const Quark work_schedule; }; inline bool operator==(const Atom& a, const URIs::Quark& b) { diff --git a/src/URIs.cpp b/src/URIs.cpp index 195b1a9d..e25257a2 100644 --- a/src/URIs.cpp +++ b/src/URIs.cpp @@ -22,142 +22,166 @@ #include "lv2/lv2plug.in/ns/ext/log/log.h" #include "lv2/lv2plug.in/ns/ext/midi/midi.h" #include "lv2/lv2plug.in/ns/ext/morph/morph.h" +#include "lv2/lv2plug.in/ns/ext/options/options.h" #include "lv2/lv2plug.in/ns/ext/parameters/parameters.h" #include "lv2/lv2plug.in/ns/ext/patch/patch.h" -#include "lv2/lv2plug.in/ns/ext/presets/presets.h" #include "lv2/lv2plug.in/ns/ext/port-props/port-props.h" +#include "lv2/lv2plug.in/ns/ext/presets/presets.h" #include "lv2/lv2plug.in/ns/ext/resize-port/resize-port.h" #include "lv2/lv2plug.in/ns/ext/time/time.h" +#include "lv2/lv2plug.in/ns/ext/worker/worker.h" #include "lv2/lv2plug.in/ns/lv2core/lv2.h" namespace Ingen { -URIs::Quark::Quark(Forge& forge, URIMap* map, const char* c_str) +URIs::Quark::Quark(Forge& forge, + URIMap* map, + LilvWorld* lworld, + const char* c_str) : Raul::URI(c_str) , urid(forge.make_urid(Raul::URI(c_str))) , uri(forge.alloc_uri(c_str)) + , lnode(lilv_new_uri(lworld, c_str)) +{} + +URIs::Quark::Quark(const Quark& copy) + : Raul::URI(copy) + , urid(copy.urid) + , uri(copy.uri) + , lnode(lilv_node_duplicate(copy.lnode)) +{} + +URIs::Quark::~Quark() { + lilv_node_free(lnode); } #define NS_RDF "http://www.w3.org/1999/02/22-rdf-syntax-ns#" #define NS_RDFS "http://www.w3.org/2000/01/rdf-schema#" -URIs::URIs(Forge& f, URIMap* map) +URIs::URIs(Forge& f, URIMap* map, LilvWorld* lworld) : forge(f) - , atom_AtomPort (forge, map, LV2_ATOM__AtomPort) - , atom_Bool (forge, map, LV2_ATOM__Bool) - , atom_Chunk (forge, map, LV2_ATOM__Chunk) - , atom_Float (forge, map, LV2_ATOM__Float) - , atom_Int (forge, map, LV2_ATOM__Int) - , atom_Object (forge, map, LV2_ATOM__Object) - , atom_Path (forge, map, LV2_ATOM__Path) - , atom_Sequence (forge, map, LV2_ATOM__Sequence) - , atom_Sound (forge, map, LV2_ATOM__Sound) - , atom_String (forge, map, LV2_ATOM__String) - , atom_URI (forge, map, LV2_ATOM__URI) - , atom_URID (forge, map, LV2_ATOM__URID) - , atom_Vector (forge, map, LV2_ATOM__Vector) - , atom_bufferType (forge, map, LV2_ATOM__bufferType) - , atom_eventTransfer (forge, map, LV2_ATOM__eventTransfer) - , atom_supports (forge, map, LV2_ATOM__supports) - , bufsz_maxBlockLength (forge, map, LV2_BUF_SIZE__maxBlockLength) - , bufsz_minBlockLength (forge, map, LV2_BUF_SIZE__minBlockLength) - , bufsz_sequenceSize (forge, map, LV2_BUF_SIZE__sequenceSize) - , doap_name (forge, map, "http://usefulinc.com/ns/doap#name") - , ingen_Arc (forge, map, INGEN__Arc) - , ingen_Block (forge, map, INGEN__Block) - , ingen_Graph (forge, map, INGEN__Graph) - , ingen_GraphPrototype (forge, map, INGEN__GraphPrototype) - , ingen_Internal (forge, map, INGEN__Internal) - , ingen_activity (forge, map, INGEN__activity) - , ingen_arc (forge, map, INGEN__arc) - , ingen_block (forge, map, INGEN__block) - , ingen_broadcast (forge, map, INGEN__broadcast) - , ingen_canvasX (forge, map, INGEN__canvasX) - , ingen_canvasY (forge, map, INGEN__canvasY) - , ingen_enabled (forge, map, INGEN__enabled) - , ingen_file (forge, map, INGEN__file) - , ingen_head (forge, map, INGEN__head) - , ingen_incidentTo (forge, map, INGEN__incidentTo) - , ingen_polyphonic (forge, map, INGEN__polyphonic) - , ingen_polyphony (forge, map, INGEN__polyphony) - , ingen_prototype (forge, map, INGEN__prototype) - , ingen_sprungLayout (forge, map, INGEN__sprungLayout) - , ingen_tail (forge, map, INGEN__tail) - , ingen_uiEmbedded (forge, map, INGEN__uiEmbedded) - , ingen_value (forge, map, INGEN__value) - , log_Error (forge, map, LV2_LOG__Error) - , log_Note (forge, map, LV2_LOG__Note) - , log_Warning (forge, map, LV2_LOG__Warning) - , lv2_AudioPort (forge, map, LV2_CORE__AudioPort) - , lv2_CVPort (forge, map, LV2_CORE__CVPort) - , lv2_ControlPort (forge, map, LV2_CORE__ControlPort) - , lv2_InputPort (forge, map, LV2_CORE__InputPort) - , lv2_OutputPort (forge, map, LV2_CORE__OutputPort) - , lv2_Plugin (forge, map, LV2_CORE__Plugin) - , lv2_appliesTo (forge, map, LV2_CORE__appliesTo) - , lv2_binary (forge, map, LV2_CORE__binary) - , lv2_connectionOptional(forge, map, LV2_CORE__connectionOptional) - , lv2_default (forge, map, LV2_CORE__default) - , lv2_designation (forge, map, LV2_CORE__designation) - , lv2_extensionData (forge, map, LV2_CORE__extensionData) - , lv2_index (forge, map, LV2_CORE__index) - , lv2_integer (forge, map, LV2_CORE__integer) - , lv2_maximum (forge, map, LV2_CORE__maximum) - , lv2_minimum (forge, map, LV2_CORE__minimum) - , lv2_name (forge, map, LV2_CORE__name) - , lv2_port (forge, map, LV2_CORE__port) - , lv2_portProperty (forge, map, LV2_CORE__portProperty) - , lv2_prototype (forge, map, LV2_CORE__prototype) - , lv2_sampleRate (forge, map, LV2_CORE__sampleRate) - , lv2_scalePoint (forge, map, LV2_CORE__scalePoint) - , lv2_symbol (forge, map, LV2_CORE__symbol) - , lv2_toggled (forge, map, LV2_CORE__toggled) - , midi_Bender (forge, map, LV2_MIDI__Bender) - , midi_ChannelPressure (forge, map, LV2_MIDI__ChannelPressure) - , midi_Controller (forge, map, LV2_MIDI__Controller) - , midi_MidiEvent (forge, map, LV2_MIDI__MidiEvent) - , midi_NoteOn (forge, map, LV2_MIDI__NoteOn) - , midi_binding (forge, map, LV2_MIDI__binding) - , midi_controllerNumber (forge, map, LV2_MIDI__controllerNumber) - , midi_noteNumber (forge, map, LV2_MIDI__noteNumber) - , morph_currentType (forge, map, LV2_MORPH__currentType) - , param_sampleRate (forge, map, LV2_PARAMETERS__sampleRate) - , patch_Copy (forge, map, LV2_PATCH__Copy) - , patch_Delete (forge, map, LV2_PATCH__Delete) - , patch_Get (forge, map, LV2_PATCH__Get) - , patch_Message (forge, map, LV2_PATCH__Message) - , patch_Move (forge, map, LV2_PATCH__Move) - , patch_Patch (forge, map, LV2_PATCH__Patch) - , patch_Put (forge, map, LV2_PATCH__Put) - , patch_Response (forge, map, LV2_PATCH__Response) - , patch_Set (forge, map, LV2_PATCH__Set) - , patch_add (forge, map, LV2_PATCH__add) - , patch_body (forge, map, LV2_PATCH__body) - , patch_destination (forge, map, LV2_PATCH__destination) - , patch_property (forge, map, LV2_PATCH__property) - , patch_remove (forge, map, LV2_PATCH__remove) - , patch_request (forge, map, LV2_PATCH__request) - , patch_sequenceNumber (forge, map, LV2_PATCH__sequenceNumber) - , patch_subject (forge, map, LV2_PATCH__subject) - , patch_value (forge, map, LV2_PATCH__value) - , patch_wildcard (forge, map, LV2_PATCH__wildcard) - , pset_Preset (forge, map, LV2_PRESETS__Preset) - , pset_preset (forge, map, LV2_PRESETS__preset) - , pprops_logarithmic (forge, map, LV2_PORT_PROPS__logarithmic) - , rdf_type (forge, map, NS_RDF "type") - , rdfs_Class (forge, map, NS_RDFS "Class") - , rdfs_label (forge, map, NS_RDFS "label") - , rdfs_seeAlso (forge, map, NS_RDFS "seeAlso") - , rsz_minimumSize (forge, map, LV2_RESIZE_PORT__minimumSize) - , time_Position (forge, map, LV2_TIME__Position) - , time_bar (forge, map, LV2_TIME__bar) - , time_barBeat (forge, map, LV2_TIME__barBeat) - , time_beatUnit (forge, map, LV2_TIME__beatUnit) - , time_beatsPerBar (forge, map, LV2_TIME__beatsPerBar) - , time_beatsPerMinute (forge, map, LV2_TIME__beatsPerMinute) - , time_frame (forge, map, LV2_TIME__frame) - , time_speed (forge, map, LV2_TIME__speed) + , atom_AtomPort (forge, map, lworld, LV2_ATOM__AtomPort) + , atom_Bool (forge, map, lworld, LV2_ATOM__Bool) + , atom_Chunk (forge, map, lworld, LV2_ATOM__Chunk) + , atom_Float (forge, map, lworld, LV2_ATOM__Float) + , atom_Int (forge, map, lworld, LV2_ATOM__Int) + , atom_Object (forge, map, lworld, LV2_ATOM__Object) + , atom_Path (forge, map, lworld, LV2_ATOM__Path) + , atom_Sequence (forge, map, lworld, LV2_ATOM__Sequence) + , atom_Sound (forge, map, lworld, LV2_ATOM__Sound) + , atom_String (forge, map, lworld, LV2_ATOM__String) + , atom_URI (forge, map, lworld, LV2_ATOM__URI) + , atom_URID (forge, map, lworld, LV2_ATOM__URID) + , atom_Vector (forge, map, lworld, LV2_ATOM__Vector) + , atom_bufferType (forge, map, lworld, LV2_ATOM__bufferType) + , atom_eventTransfer (forge, map, lworld, LV2_ATOM__eventTransfer) + , atom_supports (forge, map, lworld, LV2_ATOM__supports) + , bufsz_maxBlockLength (forge, map, lworld, LV2_BUF_SIZE__maxBlockLength) + , bufsz_minBlockLength (forge, map, lworld, LV2_BUF_SIZE__minBlockLength) + , bufsz_sequenceSize (forge, map, lworld, LV2_BUF_SIZE__sequenceSize) + , doap_name (forge, map, lworld, "http://usefulinc.com/ns/doap#name") + , ingen_Arc (forge, map, lworld, INGEN__Arc) + , ingen_Block (forge, map, lworld, INGEN__Block) + , ingen_Graph (forge, map, lworld, INGEN__Graph) + , ingen_GraphPrototype (forge, map, lworld, INGEN__GraphPrototype) + , ingen_Internal (forge, map, lworld, INGEN__Internal) + , ingen_activity (forge, map, lworld, INGEN__activity) + , ingen_arc (forge, map, lworld, INGEN__arc) + , ingen_block (forge, map, lworld, INGEN__block) + , ingen_broadcast (forge, map, lworld, INGEN__broadcast) + , ingen_canvasX (forge, map, lworld, INGEN__canvasX) + , ingen_canvasY (forge, map, lworld, INGEN__canvasY) + , ingen_enabled (forge, map, lworld, INGEN__enabled) + , ingen_file (forge, map, lworld, INGEN__file) + , ingen_head (forge, map, lworld, INGEN__head) + , ingen_incidentTo (forge, map, lworld, INGEN__incidentTo) + , ingen_polyphonic (forge, map, lworld, INGEN__polyphonic) + , ingen_polyphony (forge, map, lworld, INGEN__polyphony) + , ingen_prototype (forge, map, lworld, INGEN__prototype) + , ingen_sprungLayout (forge, map, lworld, INGEN__sprungLayout) + , ingen_tail (forge, map, lworld, INGEN__tail) + , ingen_uiEmbedded (forge, map, lworld, INGEN__uiEmbedded) + , ingen_value (forge, map, lworld, INGEN__value) + , log_Error (forge, map, lworld, LV2_LOG__Error) + , log_Note (forge, map, lworld, LV2_LOG__Note) + , log_Warning (forge, map, lworld, LV2_LOG__Warning) + , lv2_AudioPort (forge, map, lworld, LV2_CORE__AudioPort) + , lv2_CVPort (forge, map, lworld, LV2_CORE__CVPort) + , lv2_ControlPort (forge, map, lworld, LV2_CORE__ControlPort) + , lv2_InputPort (forge, map, lworld, LV2_CORE__InputPort) + , lv2_OutputPort (forge, map, lworld, LV2_CORE__OutputPort) + , lv2_Plugin (forge, map, lworld, LV2_CORE__Plugin) + , lv2_appliesTo (forge, map, lworld, LV2_CORE__appliesTo) + , lv2_binary (forge, map, lworld, LV2_CORE__binary) + , lv2_connectionOptional(forge, map, lworld, LV2_CORE__connectionOptional) + , lv2_default (forge, map, lworld, LV2_CORE__default) + , lv2_designation (forge, map, lworld, LV2_CORE__designation) + , lv2_extensionData (forge, map, lworld, LV2_CORE__extensionData) + , lv2_index (forge, map, lworld, LV2_CORE__index) + , lv2_integer (forge, map, lworld, LV2_CORE__integer) + , lv2_maximum (forge, map, lworld, LV2_CORE__maximum) + , lv2_microVersion (forge, map, lworld, LV2_CORE__microVersion) + , lv2_minimum (forge, map, lworld, LV2_CORE__minimum) + , lv2_minorVersion (forge, map, lworld, LV2_CORE__minorVersion) + , lv2_name (forge, map, lworld, LV2_CORE__name) + , lv2_port (forge, map, lworld, LV2_CORE__port) + , lv2_portProperty (forge, map, lworld, LV2_CORE__portProperty) + , lv2_prototype (forge, map, lworld, LV2_CORE__prototype) + , lv2_sampleRate (forge, map, lworld, LV2_CORE__sampleRate) + , lv2_scalePoint (forge, map, lworld, LV2_CORE__scalePoint) + , lv2_symbol (forge, map, lworld, LV2_CORE__symbol) + , lv2_toggled (forge, map, lworld, LV2_CORE__toggled) + , midi_Bender (forge, map, lworld, LV2_MIDI__Bender) + , midi_ChannelPressure (forge, map, lworld, LV2_MIDI__ChannelPressure) + , midi_Controller (forge, map, lworld, LV2_MIDI__Controller) + , midi_MidiEvent (forge, map, lworld, LV2_MIDI__MidiEvent) + , midi_NoteOn (forge, map, lworld, LV2_MIDI__NoteOn) + , midi_binding (forge, map, lworld, LV2_MIDI__binding) + , midi_controllerNumber (forge, map, lworld, LV2_MIDI__controllerNumber) + , midi_noteNumber (forge, map, lworld, LV2_MIDI__noteNumber) + , morph_AutoMorphPort (forge, map, lworld, LV2_MORPH__AutoMorphPort) + , morph_MorphPort (forge, map, lworld, LV2_MORPH__MorphPort) + , morph_currentType (forge, map, lworld, LV2_MORPH__currentType) + , morph_supportsType (forge, map, lworld, LV2_MORPH__supportsType) + , opt_interface (forge, map, lworld, LV2_OPTIONS__interface) + , param_sampleRate (forge, map, lworld, LV2_PARAMETERS__sampleRate) + , patch_Copy (forge, map, lworld, LV2_PATCH__Copy) + , patch_Delete (forge, map, lworld, LV2_PATCH__Delete) + , patch_Get (forge, map, lworld, LV2_PATCH__Get) + , patch_Message (forge, map, lworld, LV2_PATCH__Message) + , patch_Move (forge, map, lworld, LV2_PATCH__Move) + , patch_Patch (forge, map, lworld, LV2_PATCH__Patch) + , patch_Put (forge, map, lworld, LV2_PATCH__Put) + , patch_Response (forge, map, lworld, LV2_PATCH__Response) + , patch_Set (forge, map, lworld, LV2_PATCH__Set) + , patch_add (forge, map, lworld, LV2_PATCH__add) + , patch_body (forge, map, lworld, LV2_PATCH__body) + , patch_destination (forge, map, lworld, LV2_PATCH__destination) + , patch_property (forge, map, lworld, LV2_PATCH__property) + , patch_remove (forge, map, lworld, LV2_PATCH__remove) + , patch_request (forge, map, lworld, LV2_PATCH__request) + , patch_sequenceNumber (forge, map, lworld, LV2_PATCH__sequenceNumber) + , patch_subject (forge, map, lworld, LV2_PATCH__subject) + , patch_value (forge, map, lworld, LV2_PATCH__value) + , patch_wildcard (forge, map, lworld, LV2_PATCH__wildcard) + , pset_Preset (forge, map, lworld, LV2_PRESETS__Preset) + , pset_preset (forge, map, lworld, LV2_PRESETS__preset) + , pprops_logarithmic (forge, map, lworld, LV2_PORT_PROPS__logarithmic) + , rdf_type (forge, map, lworld, NS_RDF "type") + , rdfs_Class (forge, map, lworld, NS_RDFS "Class") + , rdfs_label (forge, map, lworld, NS_RDFS "label") + , rdfs_seeAlso (forge, map, lworld, NS_RDFS "seeAlso") + , rsz_minimumSize (forge, map, lworld, LV2_RESIZE_PORT__minimumSize) + , time_Position (forge, map, lworld, LV2_TIME__Position) + , time_bar (forge, map, lworld, LV2_TIME__bar) + , time_barBeat (forge, map, lworld, LV2_TIME__barBeat) + , time_beatUnit (forge, map, lworld, LV2_TIME__beatUnit) + , time_beatsPerBar (forge, map, lworld, LV2_TIME__beatsPerBar) + , time_beatsPerMinute (forge, map, lworld, LV2_TIME__beatsPerMinute) + , time_frame (forge, map, lworld, LV2_TIME__frame) + , time_speed (forge, map, lworld, LV2_TIME__speed) + , work_schedule (forge, map, lworld, LV2_WORKER__schedule) {} } // namespace Ingen diff --git a/src/World.cpp b/src/World.cpp index 6686a9bf..d3859563 100644 --- a/src/World.cpp +++ b/src/World.cpp @@ -105,12 +105,12 @@ public: , argv(a_argv) , lv2_features(NULL) , rdf_world(new Sord::World()) + , lilv_world(lilv_world_new()) , uri_map(new URIMap(log, map, unmap)) , forge(new Forge(*uri_map)) - , uris(new URIs(*forge, uri_map)) + , uris(new URIs(*forge, uri_map, lilv_world)) , log(lv2_log, *uris) , conf(*forge) - , lilv_world(lilv_world_new()) { // Parse default configuration files std::list files = conf.load_default("ingen", "options.ttl"); @@ -205,6 +205,7 @@ public: char**& argv; LV2Features* lv2_features; Sord::World* rdf_world; + LilvWorld* lilv_world; URIMap* uri_map; Forge* forge; URIs* uris; @@ -216,7 +217,6 @@ public: SPtr serialiser; SPtr parser; SPtr store; - LilvWorld* lilv_world; std::mutex rdf_mutex; std::string jack_uuid; }; diff --git a/src/client/PluginUI.cpp b/src/client/PluginUI.cpp index 4b87957c..a16dcb2c 100644 --- a/src/client/PluginUI.cpp +++ b/src/client/PluginUI.cpp @@ -168,6 +168,8 @@ PluginUI::create(Ingen::World* world, SPtr block, const LilvPlugin* plugin) { + const URIs& uris = world->uris(); + if (!PluginUI::ui_host) { PluginUI::ui_host = suil_host_new(lv2_ui_write, lv2_ui_port_index, @@ -210,12 +212,11 @@ PluginUI::create(Ingen::World* world, LilvWorld* lworld = world->lilv_world(); LilvNode* ui_portNotification = lilv_new_uri(lworld, LV2_UI__portNotification); LilvNode* ui_plugin = lilv_new_uri(lworld, LV2_UI__plugin); - LilvNode* lv2_symbol = lilv_new_uri(lworld, LV2_CORE__symbol); LilvNodes* notes = lilv_world_find_nodes( lworld, lilv_ui_get_uri(ui), ui_portNotification, NULL); LILV_FOREACH(nodes, n, notes) { const LilvNode* note = lilv_nodes_get(notes, n); - const LilvNode* sym = lilv_world_get(lworld, note, lv2_symbol, NULL); + const LilvNode* sym = lilv_world_get(lworld, note, uris.lv2_symbol, NULL); const LilvNode* plug = lilv_world_get(lworld, note, ui_plugin, NULL); if (plug && !lilv_node_is_uri(plug)) { world->log().error(fmt("%1% UI has non-URI ui:plugin\n") @@ -234,7 +235,6 @@ PluginUI::create(Ingen::World* world, } } lilv_nodes_free(notes); - lilv_node_free(lv2_symbol); lilv_node_free(ui_plugin); lilv_node_free(ui_portNotification); diff --git a/src/server/BlockFactory.cpp b/src/server/BlockFactory.cpp index 5b00bb76..0a51e03e 100644 --- a/src/server/BlockFactory.cpp +++ b/src/server/BlockFactory.cpp @@ -27,9 +27,9 @@ #include "internals/Time.hpp" #include "internals/Trigger.hpp" +#include "BlockFactory.hpp" #include "InternalPlugin.hpp" #include "LV2Plugin.hpp" -#include "BlockFactory.hpp" #include "ThreadManager.hpp" using namespace std; @@ -41,7 +41,6 @@ using namespace Internals; BlockFactory::BlockFactory(Ingen::World* world) : _world(world) - , _lv2_info(new LV2Info(world)) , _has_loaded(false) { load_internal_plugins(); @@ -107,8 +106,7 @@ BlockFactory::load_plugin(const Raul::URI& uri) const LilvPlugins* plugs = lilv_world_get_all_plugins(_world->lilv_world()); const LilvPlugin* plug = lilv_plugins_get_by_uri(plugs, node); if (plug) { - LV2Plugin* const ingen_plugin = new LV2Plugin(_lv2_info, uri); - ingen_plugin->lilv_plugin(plug); + LV2Plugin* const ingen_plugin = new LV2Plugin(_world, plug); _plugins.insert(make_pair(uri, ingen_plugin)); } lilv_node_free(node); @@ -129,9 +127,6 @@ BlockFactory::load_lv2_plugins() lilv_node_free)); } - LilvNode* lv2_connectionOptional = lilv_new_uri( - _world->lilv_world(), LV2_CORE__connectionOptional); - const LilvPlugins* plugins = lilv_world_get_all_plugins(_world->lilv_world()); LILV_FOREACH(plugins, i, plugins) { const LilvPlugin* lv2_plug = lilv_plugins_get(plugins, i); @@ -173,7 +168,9 @@ BlockFactory::load_lv2_plugins() } } if (!supported && - !lilv_port_has_property(lv2_plug, port, lv2_connectionOptional)) { + !lilv_port_has_property(lv2_plug, + port, + _world->uris().lv2_connectionOptional)) { _world->log().warn( fmt("Ignoring <%1%>; unsupported port <%2%>\n") % uri % lilv_node_as_string( @@ -186,15 +183,12 @@ BlockFactory::load_lv2_plugins() } if (_plugins.find(uri) == _plugins.end()) { - LV2Plugin* const plugin = new LV2Plugin(_lv2_info, uri); - plugin->lilv_plugin(lv2_plug); + LV2Plugin* const plugin = new LV2Plugin(_world, lv2_plug); _plugins.insert(make_pair(uri, plugin)); } } _world->log().info(fmt("Loaded %1% plugins\n") % _plugins.size()); - - lilv_node_free(lv2_connectionOptional); } } // namespace Server diff --git a/src/server/BlockFactory.hpp b/src/server/BlockFactory.hpp index 2acaa09e..776ef948 100644 --- a/src/server/BlockFactory.hpp +++ b/src/server/BlockFactory.hpp @@ -28,7 +28,6 @@ namespace Ingen { namespace Server { class PluginImpl; -class LV2Info; /** Discovers and loads plugin libraries. * @@ -53,7 +52,6 @@ private: Plugins _plugins; Ingen::World* _world; - SPtr _lv2_info; bool _has_loaded; }; diff --git a/src/server/LV2Block.cpp b/src/server/LV2Block.cpp index 6b644e5c..14aa42ae 100644 --- a/src/server/LV2Block.cpp +++ b/src/server/LV2Block.cpp @@ -80,7 +80,6 @@ LV2Block::make_instance(URIs& uris, uint32_t voice, bool preparing) { - LilvWorld* lworld = _lv2_plugin->lv2_info()->lv2_world(); const LilvPlugin* lplug = _lv2_plugin->lilv_plugin(); LilvInstance* inst = lilv_plugin_instantiate( lplug, rate, _features->array()); @@ -92,16 +91,12 @@ LV2Block::make_instance(URIs& uris, return SPtr(); } - LilvNode* opt_interface = lilv_new_uri(lworld, LV2_OPTIONS__interface); - const LV2_Options_Interface* options_iface = NULL; - if (lilv_plugin_has_extension_data(lplug, opt_interface)) { + if (lilv_plugin_has_extension_data(lplug, uris.opt_interface)) { options_iface = (const LV2_Options_Interface*) lilv_instance_get_extension_data(inst, LV2_OPTIONS__interface); } - lilv_node_free(opt_interface); - for (uint32_t p = 0; p < num_ports(); ++p) { PortImpl* const port = _ports->at(p); Buffer* const buffer = (preparing) @@ -222,7 +217,7 @@ bool LV2Block::instantiate(BufferFactory& bufs) { const Ingen::URIs& uris = bufs.uris(); - SPtr info = _lv2_plugin->lv2_info(); + Ingen::World* world = bufs.engine().world(); const LilvPlugin* plug = _lv2_plugin->lilv_plugin(); Ingen::Forge& forge = bufs.forge(); const uint32_t num_ports = lilv_plugin_get_num_ports(plug); @@ -255,14 +250,14 @@ LV2Block::instantiate(BufferFactory& bufs) LV2_URID buffer_type = 0; bool is_morph = false; bool is_auto_morph = false; - if (lilv_port_is_a(plug, id, info->lv2_ControlPort)) { - if (lilv_port_is_a(plug, id, info->morph_MorphPort)) { + if (lilv_port_is_a(plug, id, uris.lv2_ControlPort)) { + if (lilv_port_is_a(plug, id, uris.morph_MorphPort)) { is_morph = true; LilvNodes* types = lilv_port_get_value( - plug, id, info->morph_supportsType); + plug, id, uris.morph_supportsType); LILV_FOREACH(nodes, i, types) { const LilvNode* type = lilv_nodes_get(types, i); - if (lilv_node_equals(type, info->lv2_CVPort)) { + if (lilv_node_equals(type, uris.lv2_CVPort)) { port_type = PortType::CV; buffer_type = uris.atom_Sound; } @@ -273,24 +268,24 @@ LV2Block::instantiate(BufferFactory& bufs) port_type = PortType::CONTROL; buffer_type = uris.atom_Float; } - } else if (lilv_port_is_a(plug, id, info->lv2_CVPort)) { + } else if (lilv_port_is_a(plug, id, uris.lv2_CVPort)) { port_type = PortType::CV; buffer_type = uris.atom_Sound; - } else if (lilv_port_is_a(plug, id, info->lv2_AudioPort)) { + } else if (lilv_port_is_a(plug, id, uris.lv2_AudioPort)) { port_type = PortType::AUDIO; buffer_type = uris.atom_Sound; - } else if (lilv_port_is_a(plug, id, info->atom_AtomPort)) { + } else if (lilv_port_is_a(plug, id, uris.atom_AtomPort)) { port_type = PortType::ATOM; } - if (lilv_port_is_a(plug, id, info->morph_AutoMorphPort)) { + if (lilv_port_is_a(plug, id, uris.morph_AutoMorphPort)) { is_auto_morph = true; } // Get buffer type if necessary (atom ports) if (!buffer_type) { LilvNodes* types = lilv_port_get_value( - plug, id, info->atom_bufferType); + plug, id, uris.atom_bufferType); LILV_FOREACH(nodes, i, types) { const LilvNode* type = lilv_nodes_get(types, i); if (lilv_node_is_uri(type)) { @@ -315,7 +310,7 @@ LV2Block::instantiate(BufferFactory& bufs) if (port_type == PortType::ATOM) { // Get default value, and its length - LilvNodes* defaults = lilv_port_get_value(plug, id, info->lv2_default); + LilvNodes* defaults = lilv_port_get_value(plug, id, uris.lv2_default); LILV_FOREACH(nodes, i, defaults) { const LilvNode* d = lilv_nodes_get(defaults, i); if (lilv_node_is_string(d)) { @@ -336,7 +331,7 @@ LV2Block::instantiate(BufferFactory& bufs) } // Get minimum size, if set in data - LilvNodes* sizes = lilv_port_get_value(plug, id, info->rsz_minimumSize); + LilvNodes* sizes = lilv_port_get_value(plug, id, uris.rsz_minimumSize); LILV_FOREACH(nodes, i, sizes) { const LilvNode* d = lilv_nodes_get(sizes, i); if (lilv_node_is_int(d)) { @@ -350,9 +345,9 @@ LV2Block::instantiate(BufferFactory& bufs) } enum { UNKNOWN, INPUT, OUTPUT } direction = UNKNOWN; - if (lilv_port_is_a(plug, id, info->lv2_InputPort)) { + if (lilv_port_is_a(plug, id, uris.lv2_InputPort)) { direction = INPUT; - } else if (lilv_port_is_a(plug, id, info->lv2_OutputPort)) { + } else if (lilv_port_is_a(plug, id, uris.lv2_OutputPort)) { direction = OUTPUT; } @@ -391,9 +386,9 @@ LV2Block::instantiate(BufferFactory& bufs) } // Inherit certain properties from plugin port - const LilvNode* preds[] = { info->lv2_designation, - info->lv2_portProperty, - info->atom_supports, + const LilvNode* preds[] = { uris.lv2_designation, + uris.lv2_portProperty, + uris.atom_supports, 0 }; for (int p = 0; preds[p]; ++p) { LilvNodes* values = lilv_port_get_value(plug, id, preds[p]); @@ -424,7 +419,7 @@ LV2Block::instantiate(BufferFactory& bufs) return ret; } - _features = info->world().lv2_features().lv2_features(&info->world(), this); + _features = world->lv2_features().lv2_features(world, this); // Actually create plugin instances and port buffers. const SampleRate rate = bufs.engine().driver()->sample_rate(); @@ -437,7 +432,7 @@ LV2Block::instantiate(BufferFactory& bufs) } // FIXME: Polyphony + worker? - if (lilv_plugin_has_feature(plug, info->work_schedule)) { + if (lilv_plugin_has_feature(plug, uris.work_schedule)) { _worker_iface = (const LV2_Worker_Interface*) lilv_instance_get_extension_data(instance(0), LV2_WORKER__interface); @@ -557,8 +552,8 @@ LV2Block::post_process(ProcessContext& context) LilvState* LV2Block::load_preset(const Raul::URI& uri) { - World* world = &_lv2_plugin->lv2_info()->world(); - LilvWorld* lworld = _lv2_plugin->lv2_info()->lv2_world(); + World* world = _lv2_plugin->world(); + LilvWorld* lworld = world->lilv_world(); LilvNode* preset = lilv_new_uri(lworld, uri.c_str()); // Load preset into world if necessary @@ -603,7 +598,7 @@ LV2Block::save_preset(const Raul::URI& uri, const Properties& props) { World* world = parent_graph()->engine().world(); - LilvWorld* lworld = _lv2_plugin->lv2_info()->lv2_world(); + LilvWorld* lworld = _lv2_plugin->world()->lilv_world(); LV2_URID_Map* lmap = &world->uri_map().urid_map_feature()->urid_map; LV2_URID_Unmap* lunmap = &world->uri_map().urid_unmap_feature()->urid_unmap; diff --git a/src/server/LV2Info.cpp b/src/server/LV2Info.cpp deleted file mode 100644 index 3c7a4df9..00000000 --- a/src/server/LV2Info.cpp +++ /dev/null @@ -1,79 +0,0 @@ -/* - This file is part of Ingen. - Copyright 2007-2015 David Robillard - - Ingen is free software: you can redistribute it and/or modify it under the - terms of the GNU Affero General Public License as published by the Free - Software Foundation, either version 3 of the License, or any later version. - - Ingen is distributed in the hope that it will be useful, but WITHOUT ANY - WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR - A PARTICULAR PURPOSE. See the GNU Affero General Public License for details. - - You should have received a copy of the GNU Affero General Public License - along with Ingen. If not, see . -*/ - -#define __STDC_LIMIT_MACROS 1 - -#include "lv2/lv2plug.in/ns/ext/atom/atom.h" -#include "lv2/lv2plug.in/ns/ext/morph/morph.h" -#include "lv2/lv2plug.in/ns/ext/resize-port/resize-port.h" -#include "lv2/lv2plug.in/ns/ext/worker/worker.h" - -#include "ingen/World.hpp" -#include "ingen/LV2Features.hpp" - -#include "LV2Info.hpp" -#include "LV2ResizeFeature.hpp" - -namespace Ingen { -namespace Server { - -LV2Info::LV2Info(Ingen::World* world) - : 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_designation(lilv_new_uri(world->lilv_world(), LV2_CORE__designation)) - , lv2_portProperty(lilv_new_uri(world->lilv_world(), LV2_CORE__portProperty)) - , lv2_sampleRate(lilv_new_uri(world->lilv_world(), LV2_CORE__sampleRate)) - , morph_AutoMorphPort(lilv_new_uri(world->lilv_world(), LV2_MORPH__AutoMorphPort)) - , morph_MorphPort(lilv_new_uri(world->lilv_world(), LV2_MORPH__MorphPort)) - , morph_supportsType(lilv_new_uri(world->lilv_world(), LV2_MORPH__supportsType)) - , rsz_minimumSize(lilv_new_uri(world->lilv_world(), LV2_RESIZE_PORT__minimumSize)) - , work_schedule(lilv_new_uri(world->lilv_world(), LV2_WORKER__schedule)) - , _world(world) -{ - world->lv2_features().add_feature( - SPtr(new ResizeFeature())); -} - -LV2Info::~LV2Info() -{ - lilv_node_free(atom_AtomPort); - lilv_node_free(atom_bufferType); - lilv_node_free(atom_supports); - lilv_node_free(lv2_AudioPort); - lilv_node_free(lv2_CVPort); - lilv_node_free(lv2_ControlPort); - lilv_node_free(lv2_InputPort); - lilv_node_free(lv2_OutputPort); - lilv_node_free(lv2_default); - lilv_node_free(lv2_designation); - lilv_node_free(lv2_portProperty); - lilv_node_free(lv2_sampleRate); - lilv_node_free(morph_AutoMorphPort); - lilv_node_free(morph_MorphPort); - lilv_node_free(morph_supportsType); - lilv_node_free(rsz_minimumSize); - lilv_node_free(work_schedule); -} - -} // namespace Server -} // namespace Ingen diff --git a/src/server/LV2Info.hpp b/src/server/LV2Info.hpp deleted file mode 100644 index e95c3964..00000000 --- a/src/server/LV2Info.hpp +++ /dev/null @@ -1,62 +0,0 @@ -/* - This file is part of Ingen. - Copyright 2007-2015 David Robillard - - Ingen is free software: you can redistribute it and/or modify it under the - terms of the GNU Affero General Public License as published by the Free - Software Foundation, either version 3 of the License, or any later version. - - Ingen is distributed in the hope that it will be useful, but WITHOUT ANY - WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR - A PARTICULAR PURPOSE. See the GNU Affero General Public License for details. - - You should have received a copy of the GNU Affero General Public License - along with Ingen. If not, see . -*/ - -#ifndef INGEN_ENGINE_LV2INFO_HPP -#define INGEN_ENGINE_LV2INFO_HPP - -#include "ingen/World.hpp" -#include "lilv/lilv.h" -#include "raul/Noncopyable.hpp" - -namespace Ingen { -namespace Server { - -/** Stuff that may need to be passed to an LV2 plugin (i.e. LV2 features). - */ -class LV2Info : public Raul::Noncopyable { -public: - explicit LV2Info(Ingen::World* world); - ~LV2Info(); - - LilvNode* const atom_AtomPort; - LilvNode* const atom_bufferType; - LilvNode* const atom_supports; - LilvNode* const lv2_AudioPort; - LilvNode* const lv2_CVPort; - LilvNode* const lv2_ControlPort; - LilvNode* const lv2_InputPort; - LilvNode* const lv2_OutputPort; - LilvNode* const lv2_default; - LilvNode* const lv2_designation; - LilvNode* const lv2_portProperty; - LilvNode* const lv2_sampleRate; - LilvNode* const morph_AutoMorphPort; - LilvNode* const morph_MorphPort; - LilvNode* const morph_supportsType; - LilvNode* const rsz_minimumSize; - LilvNode* const work_schedule; - - Ingen::World& world() { return *_world; } - LilvWorld* lv2_world() { return _world->lilv_world(); } - -private: - Ingen::World* _world; -}; - -} // namespace Server -} // namespace Ingen - -#endif // INGEN_ENGINE_LV2INFO_HPP diff --git a/src/server/LV2Plugin.cpp b/src/server/LV2Plugin.cpp index 3b7c9b18..3dc87030 100644 --- a/src/server/LV2Plugin.cpp +++ b/src/server/LV2Plugin.cpp @@ -30,12 +30,12 @@ using namespace std; namespace Ingen { namespace Server { -LV2Plugin::LV2Plugin(SPtr lv2_info, const Raul::URI& uri) - : PluginImpl(lv2_info->world().uris(), - lv2_info->world().uris().lv2_Plugin.urid, - uri) - , _lilv_plugin(NULL) - , _lv2_info(lv2_info) +LV2Plugin::LV2Plugin(World* world, const LilvPlugin* lplugin) + : PluginImpl(world->uris(), + world->uris().lv2_Plugin.urid, + Raul::URI(lilv_node_as_uri(lilv_plugin_get_uri(lplugin)))) + , _world(world) + , _lilv_plugin(lplugin) { set_property(_uris.rdf_type, _uris.lv2_Plugin); } @@ -78,19 +78,12 @@ LV2Plugin::instantiate(BufferFactory& bufs, } } -void -LV2Plugin::lilv_plugin(const LilvPlugin* p) -{ - _lilv_plugin = p; -} - void LV2Plugin::load_presets() { - LilvWorld* lworld = _lv2_info->world().lilv_world(); - LilvNode* pset_Preset = lilv_new_uri(lworld, LV2_PRESETS__Preset); - LilvNode* rdfs_label = lilv_new_uri(lworld, LILV_NS_RDFS "label"); - LilvNodes* presets = lilv_plugin_get_related(_lilv_plugin, pset_Preset); + const URIs& uris = _world->uris(); + LilvWorld* lworld = _world->lilv_world(); + LilvNodes* presets = lilv_plugin_get_related(_lilv_plugin, uris.pset_Preset); if (presets) { LILV_FOREACH(nodes, i, presets) { @@ -98,7 +91,7 @@ LV2Plugin::load_presets() lilv_world_load_resource(lworld, preset); LilvNodes* labels = lilv_world_find_nodes( - lworld, preset, rdfs_label, NULL); + lworld, preset, uris.rdfs_label, NULL); if (labels) { const LilvNode* label = lilv_nodes_get_first(labels); @@ -107,7 +100,7 @@ LV2Plugin::load_presets() lilv_nodes_free(labels); } else { - _lv2_info->world().log().error( + _world->log().error( fmt("Preset <%1%> has no rdfs:label\n") % lilv_node_as_string(lilv_nodes_get(presets, i))); } @@ -116,9 +109,6 @@ LV2Plugin::load_presets() lilv_nodes_free(presets); } - lilv_node_free(rdfs_label); - lilv_node_free(pset_Preset); - PluginImpl::load_presets(); } diff --git a/src/server/LV2Plugin.hpp b/src/server/LV2Plugin.hpp index 63946071..0eee6731 100644 --- a/src/server/LV2Plugin.hpp +++ b/src/server/LV2Plugin.hpp @@ -24,9 +24,11 @@ #include "raul/URI.hpp" #include "PluginImpl.hpp" -#include "LV2Info.hpp" namespace Ingen { + +class World; + namespace Server { class GraphImpl; @@ -37,7 +39,7 @@ class BlockImpl; class LV2Plugin : public PluginImpl { public: - LV2Plugin(SPtr lv2_info, const Raul::URI& uri); + LV2Plugin(World* world, const LilvPlugin* lplugin); BlockImpl* instantiate(BufferFactory& bufs, const Raul::Symbol& symbol, @@ -47,16 +49,14 @@ public: const Raul::Symbol symbol() const; - SPtr lv2_info() const { return _lv2_info; } - + World* world() const { return _world; } const LilvPlugin* lilv_plugin() const { return _lilv_plugin; } - void lilv_plugin(const LilvPlugin* p); void load_presets(); private: + World* _world; const LilvPlugin* _lilv_plugin; - SPtr _lv2_info; }; } // namespace Server diff --git a/src/server/wscript b/src/server/wscript index 16bca160..c3e963fa 100644 --- a/src/server/wscript +++ b/src/server/wscript @@ -18,7 +18,6 @@ def build(bld): InputPort.cpp InternalPlugin.cpp LV2Block.cpp - LV2Info.cpp LV2Plugin.cpp NodeImpl.cpp OutputPort.cpp -- cgit v1.2.1