summaryrefslogtreecommitdiffstats
path: root/src/libs/engine/PluginImpl.hpp
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2007-10-22 03:48:28 +0000
committerDavid Robillard <d@drobilla.net>2007-10-22 03:48:28 +0000
commite9d99340c9ac29aaa7912db0554a88820c4a776a (patch)
tree2bb49de8b90d861330e8db50919a8137b10cc913 /src/libs/engine/PluginImpl.hpp
parent5ae4d4d5e805e828b51b98767ac51da24c3b21f1 (diff)
downloadingen-e9d99340c9ac29aaa7912db0554a88820c4a776a.tar.gz
ingen-e9d99340c9ac29aaa7912db0554a88820c4a776a.tar.bz2
ingen-e9d99340c9ac29aaa7912db0554a88820c4a776a.zip
Rework plugin design (engine side) to be less crap.
Use LADSPA labels instead of munged friendly names to generate OSC paths. Separate OSC paths/names from human friendly names (conceptually, still needs UI exposing). git-svn-id: http://svn.drobilla.net/lad/ingen@898 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src/libs/engine/PluginImpl.hpp')
-rw-r--r--src/libs/engine/PluginImpl.hpp109
1 files changed, 35 insertions, 74 deletions
diff --git a/src/libs/engine/PluginImpl.hpp b/src/libs/engine/PluginImpl.hpp
index 83814dc8..9ad16ee3 100644
--- a/src/libs/engine/PluginImpl.hpp
+++ b/src/libs/engine/PluginImpl.hpp
@@ -26,11 +26,9 @@
#include <dlfcn.h>
#include <string>
#include <iostream>
-#ifdef HAVE_SLV2
-#include <slv2/slv2.h>
-#endif
#include "types.hpp"
#include "interface/Plugin.hpp"
+
using std::string;
using Ingen::Shared::Plugin;
@@ -40,57 +38,34 @@ class PatchImpl;
class NodeImpl;
-/** Representation of a plugin (of various types).
+/** Implementation of a plugin (internal code, or a loaded shared library).
*
- * A Node is an instance of this, conceptually.
- * FIXME: This whole thing is a filthy mess and needs a rewrite. Probably
- * with derived classes for each plugin type.
+ * Conceptually, a Node is an instance of this.
*/
class PluginImpl : public Ingen::Shared::Plugin, public boost::noncopyable
{
public:
- PluginImpl(Type type, const string& uri)
- : _type(type)
- , _uri(uri)
- , _id(0)
- , _module(NULL)
-#ifdef HAVE_SLV2
- , _slv2_plugin(NULL)
-#endif
+ PluginImpl(Type type, const string& uri, const string library_path="")
+ : _type(type)
+ , _uri(uri)
+ , _library_path(library_path)
+ , _module(NULL)
{}
-
- PluginImpl(const PluginImpl* const copy) {
- // Copying only allowed for Internal plugins. Bit of a hack, but
- // allows the PluginInfo to be defined in the Node class which keeps
- // things localized and convenient (FIXME?)
- if (copy->_type != Internal)
- exit(EXIT_FAILURE);
- _type = copy->_type;
- _uri = copy->_uri;
- _lib_path = copy->_lib_path;
- _lib_name = copy->_lib_name;
- _plug_label = copy->_plug_label;
- _name = copy->_name;
- _id = _id;
- _module = copy->_module;
- }
- Plugin::Type type() const { return _type; }
- void type(Plugin::Type t) { _type = t; }
- const string& lib_path() const { return _lib_path; }
- void lib_path(const string& s) { _lib_path = s; _lib_name = _lib_path.substr(_lib_path.find_last_of("/")+1); }
- string lib_name() const { return _lib_name; }
- void lib_name(const string& s) { _lib_name = s; }
- const string& plug_label() const { return _plug_label; }
- void plug_label(const string& s) { _plug_label = s; }
- const string& name() const { return _name; }
- void name(const string& s) { _name = s; }
- unsigned long id() const { return _id; }
- void id(unsigned long i) { _id = i; }
- const string& uri() const { return _uri; }
- void uri(const string& s) { _uri = s; }
- Glib::Module* module() const { return _module; }
- void module(Glib::Module* module) { _module = module; }
+ virtual NodeImpl* instantiate(const std::string& name,
+ bool polyphonic,
+ Ingen::PatchImpl* parent,
+ SampleRate srate,
+ size_t buffer_size) = 0;
+
+ virtual const string symbol() const = 0;
+ virtual const string name() const = 0;
+
+ const std::string& library_path() const { return _library_path; }
+ void library_path(const std::string& s) { _library_path = s;}
+
+ void load();
+ void unload();
const char* type_string() const {
if (_type == LADSPA) return "LADSPA";
@@ -100,42 +75,28 @@ public:
else return "";
}
- string type_uri() const {
- return string("ingen:") + type_string();
+ const string type_uri() const {
+ return string("ingen:").append(type_string());
}
void set_type(const string& type_string) {
- if (type_string == "LADSPA") _type = LADSPA;
- else if (type_string == "LV2") _type = LV2;
+ if (type_string == "LADSPA") _type = LADSPA;
+ else if (type_string == "LV2") _type = LV2;
else if (type_string == "Internal") _type = Internal;
- else if (type_string == "Patch") _type = Patch;
+ else if (type_string == "Patch") _type = Patch;
}
- // FIXME: ew
-#ifdef HAVE_SLV2
- SLV2Plugin slv2_plugin() const { return _slv2_plugin; }
- void slv2_plugin(SLV2Plugin p) { _slv2_plugin = p; }
-#endif
-
- void load();
- void unload();
-
- NodeImpl* instantiate(const string& name, bool polyphonic, Ingen::PatchImpl* parent, SampleRate srate, size_t buffer_size);
+ 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; }
-private:
+protected:
Plugin::Type _type;
- string _uri; ///< LV2 only
- string _lib_path; ///< LADSPA only
- string _lib_name; ///< LADSPA only
- string _plug_label; ///< LADSPA only
- string _name; ///< LADSPA only
- unsigned long _id; ///< LADSPA only
-
+ const string _uri;
+ string _library_path;
Glib::Module* _module;
-
-#ifdef HAVE_SLV2
- SLV2Plugin _slv2_plugin;
-#endif
};