diff options
author | David Robillard <d@drobilla.net> | 2008-11-09 03:45:35 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2008-11-09 03:45:35 +0000 |
commit | 72ffe8b96f492805b16df8d2ffa452e67046b974 (patch) | |
tree | 4c3e565f34e334c8cc3a58ab052ea2156eb4cfdc /src/engine | |
parent | 5d1f579900182f283a1c21ad4e59daf7f035e219 (diff) | |
download | ingen-72ffe8b96f492805b16df8d2ffa452e67046b974.tar.gz ingen-72ffe8b96f492805b16df8d2ffa452e67046b974.tar.bz2 ingen-72ffe8b96f492805b16df8d2ffa452e67046b974.zip |
Add concept of 'Resource' and make plugins a resource (as well as graph objects).
Get rid of crufty imperative Plugin API.
Loading of plugin data from engine over HTTP.
git-svn-id: http://svn.drobilla.net/lad/trunk/ingen@1713 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src/engine')
-rw-r--r-- | src/engine/GraphObjectImpl.hpp | 23 | ||||
-rw-r--r-- | src/engine/InternalPlugin.cpp | 8 | ||||
-rw-r--r-- | src/engine/LV2Plugin.cpp | 2 | ||||
-rw-r--r-- | src/engine/PluginImpl.hpp | 11 |
4 files changed, 20 insertions, 24 deletions
diff --git a/src/engine/GraphObjectImpl.hpp b/src/engine/GraphObjectImpl.hpp index 88ed3617..ab5eb24b 100644 --- a/src/engine/GraphObjectImpl.hpp +++ b/src/engine/GraphObjectImpl.hpp @@ -26,6 +26,7 @@ #include "raul/Path.hpp" #include "raul/Atom.hpp" #include "interface/GraphObject.hpp" +#include "shared/ResourceImpl.hpp" #include "types.hpp" using Raul::Atom; @@ -49,6 +50,7 @@ class ProcessContext; * \ingroup engine */ class GraphObjectImpl : virtual public Ingen::Shared::GraphObject + , public Ingen::Shared::ResourceImpl { public: virtual ~GraphObjectImpl() {} @@ -58,6 +60,8 @@ public: GraphObject* graph_parent() const { return _parent; } + const std::string uri() const { return std::string("patch") + path(); } + inline GraphObjectImpl* parent() const { return _parent; } const Symbol symbol() const { return _name; } @@ -73,25 +77,14 @@ public: void set_variable(const std::string& key, const Atom& value) { _variables[key] = value; } - void set_property(const std::string& key, const Atom& value) - { _properties[key] = value; } - const Atom& get_variable(const std::string& key) { static Atom null_atom; Variables::iterator i = _variables.find(key); return (i != _variables.end()) ? (*i).second : null_atom; } - const Atom& get_property(const std::string& key) { - static Atom null_atom; - Properties::iterator i = _properties.find(key); - return (i != _properties.end()) ? (*i).second : null_atom; - } - const Variables& variables() const { return _variables; } - const Properties& properties() const { return _properties; } - Variables& variables() { return _variables; } - Properties& properties() { return _properties; } + Variables& variables() { return _variables; } /** The Patch this object is a child of. */ virtual PatchImpl* parent_patch() const; @@ -110,7 +103,10 @@ public: protected: GraphObjectImpl(GraphObjectImpl* parent, const std::string& name, bool polyphonic=false) - : _parent(parent), _name(name), _polyphonic(polyphonic) + : ResourceImpl(std::string("patch/") + (parent ? parent->path().base() : "/") + name) + , _parent(parent) + , _name(name) + , _polyphonic(polyphonic) { assert(parent == NULL || _name.length() > 0); assert(_name.find("/") == std::string::npos); @@ -123,7 +119,6 @@ protected: private: Variables _variables; - Properties _properties; }; diff --git a/src/engine/InternalPlugin.cpp b/src/engine/InternalPlugin.cpp index 1c6a92a5..2e869395 100644 --- a/src/engine/InternalPlugin.cpp +++ b/src/engine/InternalPlugin.cpp @@ -38,13 +38,13 @@ InternalPlugin::instantiate(const string& name, SampleCount srate = engine.audio_driver()->sample_rate(); SampleCount buffer_size = engine.audio_driver()->buffer_size(); - if (_uri == NS_INGEN "note_node") { + if (uri() == NS_INGEN "note_node") { return new MidiNoteNode(name, polyphonic, parent, srate, buffer_size); - } else if (_uri == NS_INGEN "trigger_node") { + } else if (uri() == NS_INGEN "trigger_node") { return new MidiTriggerNode(name, polyphonic, parent, srate, buffer_size); - } else if (_uri == NS_INGEN "control_node") { + } else if (uri() == NS_INGEN "control_node") { return new MidiControlNode(name, polyphonic, parent, srate, buffer_size); - } else if (_uri == NS_INGEN "transport_node") { + } else if (uri() == NS_INGEN "transport_node") { return new TransportNode(name, polyphonic, parent, srate, buffer_size); } else { return NULL; diff --git a/src/engine/LV2Plugin.cpp b/src/engine/LV2Plugin.cpp index e294b3b1..cb35e495 100644 --- a/src/engine/LV2Plugin.cpp +++ b/src/engine/LV2Plugin.cpp @@ -30,7 +30,7 @@ namespace Ingen { const string LV2Plugin::symbol() const { - string working = _uri; + string working = uri(); if (working[working.length()-1] == '/') working = working.substr(0, working.length()-1); diff --git a/src/engine/PluginImpl.hpp b/src/engine/PluginImpl.hpp index 53275313..2b78b29a 100644 --- a/src/engine/PluginImpl.hpp +++ b/src/engine/PluginImpl.hpp @@ -28,6 +28,7 @@ #include <iostream> #include "types.hpp" #include "interface/Plugin.hpp" +#include "shared/ResourceImpl.hpp" using std::string; using Ingen::Shared::Plugin; @@ -43,12 +44,14 @@ class Engine; * * Conceptually, a Node is an instance of this. */ -class PluginImpl : public Ingen::Shared::Plugin, public boost::noncopyable +class PluginImpl : public Ingen::Shared::Plugin + , public Ingen::Shared::ResourceImpl + , public boost::noncopyable { public: PluginImpl(Type type, const string& uri, const string library_path="") - : _type(type) - , _uri(uri) + : ResourceImpl(uri) + , _type(type) , _library_path(library_path) , _module(NULL) {} @@ -69,13 +72,11 @@ public: Plugin::Type type() const { return _type; } void type(Plugin::Type t) { _type = t; } - const string& uri() const { return _uri; } Glib::Module* module() const { return _module; } void module(Glib::Module* module) { _module = module; } protected: Plugin::Type _type; - const string _uri; string _library_path; Glib::Module* _module; }; |