summaryrefslogtreecommitdiffstats
path: root/src/client
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2012-03-19 20:16:46 +0000
committerDavid Robillard <d@drobilla.net>2012-03-19 20:16:46 +0000
commit254b434f0a79fea54bd963e8ff2e845a5b0cd3a6 (patch)
treeddf849fc5b64d1096846c28c1f1a742f54c3adff /src/client
parentbc3afd8380d59c750c8f8e9bf1ed1b8d4a6826e9 (diff)
downloadingen-254b434f0a79fea54bd963e8ff2e845a5b0cd3a6.tar.gz
ingen-254b434f0a79fea54bd963e8ff2e845a5b0cd3a6.tar.bz2
ingen-254b434f0a79fea54bd963e8ff2e845a5b0cd3a6.zip
Partially functioning communication between Ingen LV2 plugin and UI.
git-svn-id: http://svn.drobilla.net/lad/trunk/ingen@4078 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src/client')
-rw-r--r--src/client/ClientStore.cpp15
-rw-r--r--src/client/NodeModel.cpp4
-rw-r--r--src/client/ObjectModel.cpp2
-rw-r--r--src/client/PluginModel.cpp9
-rw-r--r--src/client/PluginUI.cpp40
-rw-r--r--src/client/PortModel.cpp8
6 files changed, 24 insertions, 54 deletions
diff --git a/src/client/ClientStore.cpp b/src/client/ClientStore.cpp
index ecf03dad..54aea125 100644
--- a/src/client/ClientStore.cpp
+++ b/src/client/ClientStore.cpp
@@ -277,7 +277,7 @@ ClientStore::put(const URI& uri,
#ifdef INGEN_CLIENT_STORE_DUMP
LOG(info) << "PUT " << uri << " {" << endl;
for (Iterator i = properties.begin(); i != properties.end(); ++i)
- LOG(info) << '\t' << i->first << " = " << i->second
+ LOG(info) << '\t' << i->first << " = " << _uris->forge.str(i->second)
<< " :: " << i->second.type() << endl;
LOG(info) << "}" << endl;
#endif
@@ -288,7 +288,7 @@ ClientStore::put(const URI& uri,
// Check if uri is a plugin
const Atom& type = properties.find(_uris->rdf_type)->second;
- if (type.type() == Atom::URI) {
+ if (type.type() == _uris->forge.URI) {
const URI& type_uri = type.get_uri();
const Plugin::Type plugin_type = Plugin::type_from_uri(type_uri);
if (plugin_type == Plugin::Patch) {
@@ -324,7 +324,7 @@ ClientStore::put(const URI& uri,
} else if (is_node) {
const Iterator p = properties.find(_uris->rdf_instanceOf);
SharedPtr<PluginModel> plug;
- if (p->second.is_valid() && p->second.type() == Atom::URI) {
+ if (p->second.is_valid() && p->second.type() == _uris->forge.URI) {
if (!(plug = _plugin(p->second.get_uri()))) {
LOG(warn) << "Unable to find plugin " << p->second.get_uri() << endl;
plug = SharedPtr<PluginModel>(
@@ -344,7 +344,7 @@ ClientStore::put(const URI& uri,
} else if (is_port) {
PortModel::Direction pdir = is_output ? PortModel::OUTPUT : PortModel::INPUT;
const Iterator i = properties.find(_uris->lv2_index);
- if (i != properties.end() && i->second.type() == Atom::INT) {
+ if (i != properties.end() && i->second.type() == _uris->forge.Int) {
const uint32_t index = i->second.get_int32();
SharedPtr<PortModel> p(
new PortModel(uris(), path, index, pdir));
@@ -368,10 +368,10 @@ ClientStore::delta(const URI& uri,
#ifdef INGEN_CLIENT_STORE_DUMP
LOG(info) << "DELTA " << uri << " {" << endl;
for (iterator i = remove.begin(); i != remove.end(); ++i)
- LOG(info) << " - " << i->first << " = " << i->second
+ LOG(info) << " - " << i->first << " = " << _uris->forge.str(i->second)
<< " :: " << i->second.type() << endl;
for (iterator i = add.begin(); i != add.end(); ++i)
- LOG(info) << " + " << i->first << " = " << i->second
+ LOG(info) << " + " << i->first << " = " << _uris->forge.str(i->second)
<< " :: " << i->second.type() << endl;
LOG(info) << "}" << endl;
#endif
@@ -396,7 +396,8 @@ void
ClientStore::set_property(const URI& subject_uri, const URI& predicate, const Atom& value)
{
if (subject_uri == _uris->ingen_engine) {
- LOG(info) << "Engine property " << predicate << " = " << value << endl;
+ LOG(info) << "Engine property " << predicate
+ << " = " << _uris->forge.str(value) << endl;
return;
}
SharedPtr<Resource> subject = _resource(subject_uri);
diff --git a/src/client/NodeModel.cpp b/src/client/NodeModel.cpp
index 56ff1fdc..34bc7a13 100644
--- a/src/client/NodeModel.cpp
+++ b/src/client/NodeModel.cpp
@@ -205,9 +205,9 @@ NodeModel::port_value_range(SharedPtr<const PortModel> port,
// Possibly overriden
const Atom& min_atom = port->get_property(_uris.lv2_minimum);
const Atom& max_atom = port->get_property(_uris.lv2_maximum);
- if (min_atom.type() == Atom::FLOAT)
+ if (min_atom.type() == _uris.forge.Float)
min = min_atom.get_float();
- if (max_atom.type() == Atom::FLOAT)
+ if (max_atom.type() == _uris.forge.Float)
max = max_atom.get_float();
if (max <= min)
diff --git a/src/client/ObjectModel.cpp b/src/client/ObjectModel.cpp
index 642df732..fbd79315 100644
--- a/src/client/ObjectModel.cpp
+++ b/src/client/ObjectModel.cpp
@@ -51,7 +51,7 @@ ObjectModel::~ObjectModel()
bool
ObjectModel::is_a(const Raul::URI& type) const
{
- return has_property(_uris.rdf_type, type);
+ return has_property(_uris.rdf_type, _uris.forge.alloc_uri(type.str()));
}
void
diff --git a/src/client/PluginModel.cpp b/src/client/PluginModel.cpp
index 09a5abfb..bd5e591c 100644
--- a/src/client/PluginModel.cpp
+++ b/src/client/PluginModel.cpp
@@ -52,7 +52,7 @@ PluginModel::PluginModel(Shared::URIs& uris,
assert(_rdf_world);
add_property("http://www.w3.org/1999/02/22-rdf-syntax-ns#type",
- this->type_uri());
+ uris.forge.alloc_uri(this->type_uri().str()));
LilvNode* plugin_uri = lilv_new_uri(_lilv_world, uri.c_str());
_lilv_plugin = lilv_plugins_get_by_uri(_lilv_plugins, plugin_uri);
lilv_node_free(plugin_uri);
@@ -108,8 +108,7 @@ PluginModel::get_property(const URI& key) const
LILV_FOREACH(nodes, i, values) {
const LilvNode* val = lilv_nodes_get(values, i);
if (lilv_node_is_uri(val)) {
- ret = set_property(
- key, _uris.forge.alloc(Atom::URI, lilv_node_as_uri(val)));
+ ret = set_property(key, _uris.forge.alloc_uri(lilv_node_as_uri(val)));
break;
} else if (lilv_node_is_string(val)) {
ret = set_property(key,
@@ -155,7 +154,7 @@ Symbol
PluginModel::default_node_symbol() const
{
const Atom& name_atom = get_property("http://lv2plug.in/ns/lv2core#symbol");
- if (name_atom.is_valid() && name_atom.type() == Atom::STRING)
+ if (name_atom.is_valid() && name_atom.type() == _uris.forge.String)
return Symbol::symbolify(name_atom.get_string());
else
return "_";
@@ -165,7 +164,7 @@ string
PluginModel::human_name() const
{
const Atom& name_atom = get_property("http://usefulinc.com/ns/doap#name");
- if (name_atom.type() == Atom::STRING)
+ if (name_atom.type() == _uris.forge.String)
return name_atom.get_string();
else
return default_node_symbol().c_str();
diff --git a/src/client/PluginUI.cpp b/src/client/PluginUI.cpp
index c20d41b1..8a8759fa 100644
--- a/src/client/PluginUI.cpp
+++ b/src/client/PluginUI.cpp
@@ -24,8 +24,6 @@
#include "ingen/shared/LV2URIMap.hpp"
#include "ingen/shared/URIs.hpp"
#include "lv2/lv2plug.in/ns/ext/atom/atom.h"
-#include "lv2/lv2plug.in/ns/ext/event/event-helpers.h"
-#include "lv2/lv2plug.in/ns/ext/event/event.h"
using namespace std;
using namespace Raul;
@@ -53,8 +51,7 @@ lv2_ui_write(SuilController controller,
SharedPtr<const PortModel> port = ports[port_index];
- const Shared::URIs& uris = *ui->world()->uris().get();
- const Shared::LV2URIMap& uri_map = *ui->world()->lv2_uri_map().get();
+ const Shared::URIs& uris = *ui->world()->uris().get();
// float (special case, always 0)
if (format == 0) {
@@ -67,40 +64,11 @@ lv2_ui_write(SuilController controller,
uris.ingen_value,
ui->world()->forge().make(*(float*)buffer));
- } else if (format == uris.ui_Events.id) {
- LV2_Event_Buffer* buf = (LV2_Event_Buffer*)buffer;
- LV2_Event_Iterator iter;
- uint8_t* data;
- lv2_event_begin(&iter, buf);
- while (lv2_event_is_valid(&iter)) {
- LV2_Event* const ev = lv2_event_get(&iter, &data);
- std::pair<bool, uint16_t> midi_id =
- uri_map.global_to_event(uris.midi_MidiEvent.id);
- if (midi_id.first && ev->type == midi_id.second) {
- // FIXME
- /*
- ui->world()->engine()->set_property(
- port->path(),
- uris.ingen_value,
- Atom("http://lv2plug.in/ns/ext/midi#MidiEvent", ev->size,
- data));
- */
- } else {
- warn << "Unable to serialise UI event type " << ev->type
- << ", event lost" << endl;
- }
-
- lv2_event_increment(&iter);
- }
-
} else if (format == uris.atom_eventTransfer.id) {
- std::cerr << "FIXME: atom event transfer" << std::endl;
- #if 0
- LV2_Atom* buf = (LV2_Atom*)buffer;
- Raul::Atom val;
- Shared::LV2Atom::to_atom(uris, buf, val);
+ LV2_Atom* atom = (LV2_Atom*)buffer;
+ Raul::Atom val = ui->world()->forge().alloc(
+ atom->size, atom->type, LV2_ATOM_BODY(atom));
ui->world()->engine()->set_property(port->path(), uris.ingen_value, val);
- #endif
} else {
warn << "Unknown value format " << format
diff --git a/src/client/PortModel.cpp b/src/client/PortModel.cpp
index afd28816..ba335ce9 100644
--- a/src/client/PortModel.cpp
+++ b/src/client/PortModel.cpp
@@ -35,13 +35,15 @@ PortModel::on_property(const Raul::URI& uri, const Raul::Atom& value)
bool
PortModel::supports(const Raul::URI& value_type) const
{
- return has_property(_uris.atom_supports, value_type);
+ return has_property(_uris.atom_supports,
+ _uris.forge.alloc_uri(value_type.str()));
}
bool
PortModel::port_property(const Raul::URI& uri) const
{
- return has_property(_uris.lv2_portProperty, uri);
+ return has_property(_uris.lv2_portProperty,
+ _uris.forge.alloc_uri(uri.str()));
}
void
@@ -66,7 +68,7 @@ PortModel::has_context(const Raul::URI& uri) const
if (uri == _uris.ctx_audioContext && !context.is_valid())
return true;
else
- return context == uri;
+ return context == _uris.forge.alloc_uri(uri.str());
}
} // namespace Client