From 87597f85c5a69a9accd3ce2ed88f2a006173e885 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Wed, 3 Feb 2010 04:46:56 +0000 Subject: Comprehensive use of cached URIs and more advanced Value (Atom) system. Atoms (e.g. property values or port values) can now be an Atom::DICT, which maps directly to/from an RDF resource. This is now used to store control bindings as a port property, eliminating the special API. Full interned URIs used everywhere, instead of CURIEs pretending to be URIs. Avoid converting string literals to URIs all over the place. Support for binding MIDI pitch bender and MIDI channel pressure. Saving/restoring of MIDI bindings as a free side-effect of the above. git-svn-id: http://svn.drobilla.net/lad/trunk/ingen@2409 a436a847-0d15-0410-975c-d299462d15a1 --- src/client/ClientStore.cpp | 35 +++++++++++++++++------------------ 1 file changed, 17 insertions(+), 18 deletions(-) (limited to 'src/client/ClientStore.cpp') diff --git a/src/client/ClientStore.cpp b/src/client/ClientStore.cpp index eb42f6a9..e5fbab6a 100644 --- a/src/client/ClientStore.cpp +++ b/src/client/ClientStore.cpp @@ -17,7 +17,7 @@ #include "raul/log.hpp" #include "raul/PathTable.hpp" -#include "interface/MessageType.hpp" +#include "shared/LV2URIMap.hpp" #include "ClientStore.hpp" #include "ObjectModel.hpp" #include "PatchModel.hpp" @@ -53,7 +53,6 @@ ClientStore::ClientStore(SharedPtr engine, SharedPtrsignal_property_change.connect(sigc::mem_fun(this, &ClientStore::set_property)); emitter->signal_voice_value.connect(sigc::mem_fun(this, &ClientStore::set_voice_value)); emitter->signal_activity.connect(sigc::mem_fun(this, &ClientStore::activity)); - emitter->signal_binding.connect(sigc::mem_fun(this, &ClientStore::binding)); } @@ -258,12 +257,19 @@ ClientStore::put(const URI& uri, const Resource::Properties& properties) bool is_path = Path::is_valid(uri.str()); bool is_meta = ResourceImpl::is_meta_uri(uri); + const LV2URIMap& uris = Shared::LV2URIMap::instance(); + if (!(is_path || is_meta)) { - const URI& type_uri = properties.find("rdf:type")->second.get_uri(); - if (Plugin::type_from_uri(type_uri.str()) != Plugin::NIL) { - SharedPtr p(new PluginModel(uri, type_uri, properties)); - add_plugin(p); - return; + const Atom& type = properties.find(uris.rdf_type)->second; + if (type.type() == Atom::URI) { + const URI& type_uri = type.get_uri(); + if (Plugin::type_from_uri(type_uri) != Plugin::NIL) { + SharedPtr p(new PluginModel(uri, type_uri, properties)); + add_plugin(p); + return; + } + } else { + LOG(error) << "Non-URI type " << type << endl; } } @@ -287,20 +293,20 @@ ClientStore::put(const URI& uri, const Resource::Properties& properties) if (is_patch) { uint32_t poly = 1; - iterator p = properties.find("ingen:polyphony"); + iterator p = properties.find(uris.ingen_polyphony); if (p != properties.end() && p->second.is_valid() && p->second.type() == Atom::INT) poly = p->second.get_int32(); SharedPtr model(new PatchModel(path, poly)); model->set_properties(properties); add_object(model); } else if (is_node) { - const Resource::Properties::const_iterator p = properties.find("rdf:instanceOf"); + const Resource::Properties::const_iterator p = properties.find(uris.rdf_instanceOf); SharedPtr plug; if (p->second.is_valid() && p->second.type() == Atom::URI) { if (!(plug = plugin(p->second.get_uri()))) { LOG(warn) << "Unable to find plugin " << p->second.get_uri() << endl; plug = SharedPtr( - new PluginModel(p->second.get_uri(), "ingen:nil", Resource::Properties())); + new PluginModel(p->second.get_uri(), uris.ingen_nil, Resource::Properties())); add_plugin(plug); } @@ -313,7 +319,7 @@ ClientStore::put(const URI& uri, const Resource::Properties& properties) } else if (is_port) { if (data_type != PortType::UNKNOWN) { PortModel::Direction pdir = is_output ? PortModel::OUTPUT : PortModel::INPUT; - const Resource::Properties::const_iterator i = properties.find("lv2:index"); + const Resource::Properties::const_iterator i = properties.find(uris.lv2_index); if (i != properties.end() && i->second.type() == Atom::INT) { SharedPtr p(new PortModel(path, i->second.get_int32(), data_type, pdir)); p->set_properties(properties); @@ -378,13 +384,6 @@ ClientStore::activity(const Path& path) } -void -ClientStore::binding(const Path& path, const Shared::MessageType& type) -{ - LOG(info) << "Bind " << path << " : " << type << endl; -} - - SharedPtr ClientStore::connection_patch(const Path& src_port_path, const Path& dst_port_path) { -- cgit v1.2.1