summaryrefslogtreecommitdiffstats
path: root/src/client/ClientStore.cpp
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2010-02-03 04:46:56 +0000
committerDavid Robillard <d@drobilla.net>2010-02-03 04:46:56 +0000
commit87597f85c5a69a9accd3ce2ed88f2a006173e885 (patch)
treea3ffa393e9aecbc55dae64bad3bd45ee317e6d26 /src/client/ClientStore.cpp
parenta645d2b8be4d7d31f6eef1649156b166a01e0c31 (diff)
downloadingen-87597f85c5a69a9accd3ce2ed88f2a006173e885.tar.gz
ingen-87597f85c5a69a9accd3ce2ed88f2a006173e885.tar.bz2
ingen-87597f85c5a69a9accd3ce2ed88f2a006173e885.zip
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
Diffstat (limited to 'src/client/ClientStore.cpp')
-rw-r--r--src/client/ClientStore.cpp35
1 files changed, 17 insertions, 18 deletions
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<EngineInterface> engine, SharedPtr<SigClientI
emitter->signal_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<PluginModel> 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<PluginModel> 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<PatchModel> 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<PluginModel> 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<PluginModel>(
- 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<PortModel> 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<PatchModel>
ClientStore::connection_patch(const Path& src_port_path, const Path& dst_port_path)
{