summaryrefslogtreecommitdiffstats
path: root/src/server/events
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2016-10-06 15:51:11 -0400
committerDavid Robillard <d@drobilla.net>2016-10-06 15:51:11 -0400
commit77f6e9e63ce9ad329b43c92e8a9556aff8e78f2f (patch)
tree50dca5900274ca2f95c3d06069b7fe0bd285e46b /src/server/events
parenta513af4218d0a62a45960d04ff6ddeecb8d3d4f5 (diff)
downloadingen-77f6e9e63ce9ad329b43c92e8a9556aff8e78f2f.tar.gz
ingen-77f6e9e63ce9ad329b43c92e8a9556aff8e78f2f.tar.bz2
ingen-77f6e9e63ce9ad329b43c92e8a9556aff8e78f2f.zip
Add plugin state saving
This only works with a server-side save, so the GUI now uses that if the server is not running remotely, where "remotely" is defined as "via TCP". This isn't perfect, since running ingen via TCP locally is a perfectly valid thing to do, but it will do for now.
Diffstat (limited to 'src/server/events')
-rw-r--r--src/server/events/CreateBlock.cpp22
1 files changed, 17 insertions, 5 deletions
diff --git a/src/server/events/CreateBlock.cpp b/src/server/events/CreateBlock.cpp
index 231df4e2..a43a8bf0 100644
--- a/src/server/events/CreateBlock.cpp
+++ b/src/server/events/CreateBlock.cpp
@@ -29,6 +29,7 @@
#include "PluginImpl.hpp"
#include "PortImpl.hpp"
#include "PreProcessContext.hpp"
+#include "LV2Block.hpp"
namespace Ingen {
namespace Server {
@@ -118,11 +119,22 @@ CreateBlock::pre_process(PreProcessContext& ctx)
PluginImpl* const plugin = _engine.block_factory()->plugin(prototype);
if (!plugin) {
return Event::pre_process_done(Status::PROTOTYPE_NOT_FOUND, prototype);
- } else if (!(_block = plugin->instantiate(*_engine.buffer_factory(),
- Raul::Symbol(_path.symbol()),
- polyphonic,
- _graph,
- _engine))) {
+ }
+
+ // Load state from directory if given in properties
+ LilvState* state = NULL;
+ Resource::Properties::iterator s = _properties.find(uris.state_state);
+ if (s != _properties.end() && s->second.type() == uris.forge.Path) {
+ state = LV2Block::load_state(_engine.world(), s->second.ptr<char>());
+ }
+
+ // Instantiate plugin
+ if (!(_block = plugin->instantiate(*_engine.buffer_factory(),
+ Raul::Symbol(_path.symbol()),
+ polyphonic,
+ _graph,
+ _engine,
+ state))) {
return Event::pre_process_done(Status::CREATION_FAILED, _path);
}
}