summaryrefslogtreecommitdiffstats
path: root/src/client
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2012-03-12 06:59:48 +0000
committerDavid Robillard <d@drobilla.net>2012-03-12 06:59:48 +0000
commit81e9fb3245bd461ebfee4cfa16d1792e48533f9e (patch)
treeeb1b30d79cba70dda9d832100dd7c14b08085b03 /src/client
parente9d9569271ee962c09ab66c6babed1ca5655a6c6 (diff)
downloadingen-81e9fb3245bd461ebfee4cfa16d1792e48533f9e.tar.gz
ingen-81e9fb3245bd461ebfee4cfa16d1792e48533f9e.tar.bz2
ingen-81e9fb3245bd461ebfee4cfa16d1792e48533f9e.zip
Centralise atom creation in forge object.
Aside from being more greppable and making realtime violations more obvious, this is a step towards using LV2 atoms internally (which needs a factory since the type numbers are dynamic). git-svn-id: http://svn.drobilla.net/lad/trunk/ingen@4054 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src/client')
-rw-r--r--src/client/PluginModel.cpp23
-rw-r--r--src/client/PluginUI.cpp14
2 files changed, 24 insertions, 13 deletions
diff --git a/src/client/PluginModel.cpp b/src/client/PluginModel.cpp
index 72326dd0..09a5abfb 100644
--- a/src/client/PluginModel.cpp
+++ b/src/client/PluginModel.cpp
@@ -51,14 +51,16 @@ PluginModel::PluginModel(Shared::URIs& uris,
add_properties(properties);
assert(_rdf_world);
- add_property("http://www.w3.org/1999/02/22-rdf-syntax-ns#type", this->type_uri());
+ add_property("http://www.w3.org/1999/02/22-rdf-syntax-ns#type",
+ this->type_uri());
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);
- if (_type == Internal)
+ if (_type == Internal) {
set_property("http://usefulinc.com/ns/doap#name",
- Atom(uri.substr(uri.find_last_of('#') + 1).c_str()));
+ uris.forge.alloc(uri.substr(uri.find_last_of('#') + 1)));
+ }
}
const Atom&
@@ -93,7 +95,8 @@ PluginModel::get_property(const URI& key) const
else
symbol = uri.str().substr(first_delim + 1, last_delim - first_delim - 1);
}
- set_property("http://lv2plug.in/ns/lv2core#symbol", symbol);
+ set_property("http://lv2plug.in/ns/lv2core#symbol",
+ _uris.forge.alloc(symbol));
return get_property(key);
}
@@ -105,16 +108,20 @@ 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, Atom(Atom::URI, lilv_node_as_uri(val)));
+ ret = set_property(
+ key, _uris.forge.alloc(Atom::URI, lilv_node_as_uri(val)));
break;
} else if (lilv_node_is_string(val)) {
- ret = set_property(key, lilv_node_as_string(val));
+ ret = set_property(key,
+ _uris.forge.alloc(lilv_node_as_string(val)));
break;
} else if (lilv_node_is_float(val)) {
- ret = set_property(key, Atom(lilv_node_as_float(val)));
+ ret = set_property(key,
+ _uris.forge.make(lilv_node_as_float(val)));
break;
} else if (lilv_node_is_int(val)) {
- ret = set_property(key, Atom(lilv_node_as_int(val)));
+ ret = set_property(key,
+ _uris.forge.make(lilv_node_as_int(val)));
break;
}
}
diff --git a/src/client/PluginUI.cpp b/src/client/PluginUI.cpp
index 37789b28..f69d189b 100644
--- a/src/client/PluginUI.cpp
+++ b/src/client/PluginUI.cpp
@@ -63,9 +63,10 @@ lv2_ui_write(SuilController controller,
if (*(float*)buffer == port->value().get_float())
return; // do nothing (handle stupid plugin UIs that feed back)
- ui->world()->engine()->set_property(port->path(),
- uris.ingen_value,
- Atom(*(float*)buffer));
+ ui->world()->engine()->set_property(
+ port->path(),
+ uris.ingen_value,
+ ui->world()->forge().make(*(float*)buffer));
} else if (format == uris.ui_Events.id) {
LV2_Event_Buffer* buf = (LV2_Event_Buffer*)buffer;
@@ -77,11 +78,14 @@ lv2_ui_write(SuilController controller,
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: bundle multiple events by writing an entire buffer here
+ // FIXME
+ /*
ui->world()->engine()->set_property(
port->path(),
uris.ingen_value,
- Atom("http://lv2plug.in/ns/ext/midi#MidiEvent", ev->size, data));
+ Atom("http://lv2plug.in/ns/ext/midi#MidiEvent", ev->size,
+ data));
+ */
} else {
warn << "Unable to serialise UI event type " << ev->type
<< ", event lost" << endl;