summaryrefslogtreecommitdiffstats
path: root/ingen
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2017-03-26 12:25:48 +0200
committerDavid Robillard <d@drobilla.net>2017-03-26 17:02:09 +0200
commitcfb016163227560932044b73407ae9dafa54b4ba (patch)
treec510f0535616bfe776b80021478c5c0be607cec9 /ingen
parentd70ddd35cc03b35d3b765079d6039fef7a2a19fa (diff)
downloadingen-cfb016163227560932044b73407ae9dafa54b4ba.tar.gz
ingen-cfb016163227560932044b73407ae9dafa54b4ba.tar.bz2
ingen-cfb016163227560932044b73407ae9dafa54b4ba.zip
Remove Node::instance() method
Diffstat (limited to 'ingen')
-rw-r--r--ingen/DataAccess.hpp7
-rw-r--r--ingen/EngineBase.hpp7
-rw-r--r--ingen/InstanceAccess.hpp6
-rw-r--r--ingen/Node.hpp4
4 files changed, 19 insertions, 5 deletions
diff --git a/ingen/DataAccess.hpp b/ingen/DataAccess.hpp
index 149daec9..730cf921 100644
--- a/ingen/DataAccess.hpp
+++ b/ingen/DataAccess.hpp
@@ -17,6 +17,7 @@
#ifndef INGEN_ENGINE_DATAACCESS_HPP
#define INGEN_ENGINE_DATAACCESS_HPP
+#include "ingen/EngineBase.hpp"
#include "ingen/LV2Features.hpp"
#include "ingen/Store.hpp"
#include "ingen/World.hpp"
@@ -35,12 +36,16 @@ struct DataAccess : public Ingen::LV2Features::Feature
const char* uri() const { return "http://lv2plug.in/ns/ext/data-access"; }
SPtr<LV2_Feature> feature(World* world, Node* node) {
+ if (!world->engine()) {
+ return SPtr<LV2_Feature>();
+ }
+
Node* store_node = world->store()->get(node->path());
if (!store_node) {
return SPtr<LV2_Feature>();
}
- LilvInstance* inst = store_node->instance();
+ LilvInstance* inst = world->engine()->block_instance(store_node);
if (!inst) {
return SPtr<LV2_Feature>();
}
diff --git a/ingen/EngineBase.hpp b/ingen/EngineBase.hpp
index a57743fe..19f66cb7 100644
--- a/ingen/EngineBase.hpp
+++ b/ingen/EngineBase.hpp
@@ -23,10 +23,12 @@
#include "ingen/ingen.h"
#include "ingen/types.hpp"
+#include "lilv/lilv.h"
namespace Ingen {
class Interface;
+class Node;
/**
The audio engine which executes the graph.
@@ -49,6 +51,11 @@ public:
size_t seq_size) = 0;
/**
+ Return the LV2 instance of a block if possible, or NULL.
+ */
+ virtual LilvInstance* block_instance(Node* node) = 0;
+
+ /**
Activate the engine.
*/
virtual bool activate() = 0;
diff --git a/ingen/InstanceAccess.hpp b/ingen/InstanceAccess.hpp
index 443f5f55..d30ebf1d 100644
--- a/ingen/InstanceAccess.hpp
+++ b/ingen/InstanceAccess.hpp
@@ -28,12 +28,16 @@ struct InstanceAccess : public Ingen::LV2Features::Feature
const char* uri() const { return "http://lv2plug.in/ns/ext/instance-access"; }
SPtr<LV2_Feature> feature(World* world, Node* node) {
+ if (!world->engine()) {
+ return SPtr<LV2_Feature>();
+ }
+
Node* store_node = world->store()->get(node->path());
if (!store_node) {
return SPtr<LV2_Feature>();
}
- LilvInstance* instance = store_node->instance();
+ LilvInstance* instance = world->engine()->block_instance(store_node);
if (!instance) {
return SPtr<LV2_Feature>();
}
diff --git a/ingen/Node.hpp b/ingen/Node.hpp
index 51b000bf..18987749 100644
--- a/ingen/Node.hpp
+++ b/ingen/Node.hpp
@@ -21,7 +21,6 @@
#include "ingen/ingen.h"
#include "ingen/paths.hpp"
#include "ingen/types.hpp"
-#include "lilv/lilv.h"
#include "raul/Path.hpp"
namespace Raul {
@@ -69,8 +68,7 @@ public:
virtual const Resource* plugin() const { return NULL; }
// Plugin blocks only
- virtual LilvInstance* instance() { return NULL; }
- virtual bool save_state(const std::string& dir) const { return false; }
+ virtual bool save_state(const std::string& dir) const { return false; }
// All objects
virtual GraphType graph_type() const = 0;