summaryrefslogtreecommitdiffstats
path: root/src/server/events/Get.cpp
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2015-08-12 04:46:29 +0000
committerDavid Robillard <d@drobilla.net>2015-08-12 04:46:29 +0000
commitdd79e76e41446833088482588456afed37231bff (patch)
treec0f3c5c2fc74b286d529df69ad2206e2fddd96f9 /src/server/events/Get.cpp
parent44af7b7b66e2083819103c760ab3bf4980469f86 (diff)
downloadingen-dd79e76e41446833088482588456afed37231bff.tar.gz
ingen-dd79e76e41446833088482588456afed37231bff.tar.bz2
ingen-dd79e76e41446833088482588456afed37231bff.zip
Server-side presets.
git-svn-id: http://svn.drobilla.net/lad/trunk/ingen@5703 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src/server/events/Get.cpp')
-rw-r--r--src/server/events/Get.cpp38
1 files changed, 31 insertions, 7 deletions
diff --git a/src/server/events/Get.cpp b/src/server/events/Get.cpp
index bba95485..185f275a 100644
--- a/src/server/events/Get.cpp
+++ b/src/server/events/Get.cpp
@@ -60,8 +60,10 @@ Get::Response::put_port(const PortImpl* port)
void
Get::Response::put_block(const BlockImpl* block)
{
- PluginImpl* const plugin = block->plugin_impl();
- if (plugin->type() == Plugin::Graph) {
+ const PluginImpl* const plugin = block->plugin_impl();
+ const URIs& uris = plugin->uris();
+
+ if (uris.ingen_Graph == plugin->type()) {
put_graph((const GraphImpl*)block);
} else {
put(block->uri(), block->properties());
@@ -82,7 +84,7 @@ Get::Response::put_graph(const GraphImpl* graph)
graph->properties(Resource::Graph::EXTERNAL),
Resource::Graph::EXTERNAL);
- // Enqueue locks
+ // Enqueue blocks
for (const auto& b : graph->blocks()) {
put_block(&b);
}
@@ -100,6 +102,29 @@ Get::Response::put_graph(const GraphImpl* graph)
}
}
+void
+Get::Response::put_plugin(PluginImpl* plugin)
+{
+ put(plugin->uri(), plugin->properties());
+
+ for (const auto& p : plugin->presets()) {
+ put_preset(plugin->uris(), plugin->uri(), p.first, p.second);
+ }
+}
+
+void
+Get::Response::put_preset(const URIs& uris,
+ const Raul::URI& plugin,
+ const Raul::URI& preset,
+ const std::string& label)
+{
+ Resource::Properties props;
+ props.emplace(uris.rdf_type, uris.pset_Preset.urid);
+ props.emplace(uris.rdfs_label, uris.forge.alloc(label));
+ props.emplace(uris.lv2_appliesTo, uris.forge.make_urid(plugin));
+ put(preset, props);
+}
+
/** Returns true if a is closer to the root than b. */
static inline bool
put_higher_than(const Get::Response::Put& a, const Get::Response::Put& b)
@@ -159,11 +184,10 @@ Get::pre_process()
return Event::pre_process_done(Status::SUCCESS);
}
return Event::pre_process_done(Status::NOT_FOUND, _uri);
+ } else if ((_plugin = _engine.block_factory()->plugin(_uri))) {
+ _response.put_plugin(_plugin);
+ return Event::pre_process_done(Status::SUCCESS);
} else {
- if ((_plugin = _engine.block_factory()->plugin(_uri))) {
- _response.put(_uri, _plugin->properties());
- return Event::pre_process_done(Status::SUCCESS);
- }
return Event::pre_process_done(Status::NOT_FOUND, _uri);
}
}