From 23683a3e4f03dd8f7cdb1dc1a1592fdaa9d18b23 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Sun, 7 Oct 2007 19:41:15 +0000 Subject: Added common abstract interface for Plugins. git-svn-id: http://svn.drobilla.net/lad/ingen@837 a436a847-0d15-0410-975c-d299462d15a1 --- src/libs/client/PluginModel.hpp | 5 +- src/libs/engine/ClientBroadcaster.cpp | 10 +- src/libs/engine/ClientBroadcaster.hpp | 6 +- src/libs/engine/DSSINode.cpp | 2 +- src/libs/engine/DSSINode.hpp | 5 +- src/libs/engine/LADSPANode.cpp | 6 +- src/libs/engine/LADSPANode.hpp | 14 +- src/libs/engine/LV2Node.cpp | 16 ++- src/libs/engine/LV2Node.hpp | 14 +- src/libs/engine/Makefile.am | 4 +- src/libs/engine/MidiControlNode.cpp | 6 +- src/libs/engine/MidiNoteNode.cpp | 6 +- src/libs/engine/MidiTriggerNode.cpp | 6 +- src/libs/engine/NodeBase.cpp | 4 +- src/libs/engine/NodeBase.hpp | 19 +-- src/libs/engine/NodeFactory.cpp | 62 ++++----- src/libs/engine/NodeFactory.hpp | 16 +-- src/libs/engine/NodeImpl.hpp | 4 +- src/libs/engine/OSCClientSender.cpp | 2 +- src/libs/engine/ObjectSender.cpp | 50 +------ src/libs/engine/ObjectSender.hpp | 3 +- src/libs/engine/Patch.cpp | 4 +- src/libs/engine/Patch.hpp | 2 +- src/libs/engine/Plugin.cpp | 45 ------- src/libs/engine/Plugin.hpp | 145 --------------------- src/libs/engine/PluginImpl.cpp | 45 +++++++ src/libs/engine/PluginImpl.hpp | 144 ++++++++++++++++++++ src/libs/engine/TransportNode.cpp | 6 +- src/libs/engine/events/CreateNodeEvent.cpp | 4 +- src/libs/engine/events/CreatePatchEvent.cpp | 2 +- src/libs/engine/events/CreatePortEvent.cpp | 2 +- src/libs/engine/events/DSSIConfigureEvent.cpp | 4 +- src/libs/engine/events/DSSIControlEvent.cpp | 2 +- src/libs/engine/events/DSSIProgramEvent.cpp | 2 +- src/libs/engine/events/DSSIUpdateEvent.cpp | 2 +- src/libs/engine/events/DestroyEvent.cpp | 2 +- src/libs/engine/events/MidiLearnEvent.cpp | 2 +- src/libs/engine/events/NoteEvent.cpp | 2 +- src/libs/engine/events/RequestPluginEvent.cpp | 4 +- src/libs/engine/events/RequestPluginEvent.hpp | 8 +- src/libs/engine/events/RequestPluginsEvent.hpp | 4 +- src/libs/engine/events/SetPortValueQueuedEvent.cpp | 4 +- 42 files changed, 325 insertions(+), 370 deletions(-) delete mode 100644 src/libs/engine/Plugin.cpp delete mode 100644 src/libs/engine/Plugin.hpp create mode 100644 src/libs/engine/PluginImpl.cpp create mode 100644 src/libs/engine/PluginImpl.hpp (limited to 'src/libs') diff --git a/src/libs/client/PluginModel.hpp b/src/libs/client/PluginModel.hpp index 444ed666..f3d0a329 100644 --- a/src/libs/client/PluginModel.hpp +++ b/src/libs/client/PluginModel.hpp @@ -28,6 +28,7 @@ #include #endif #include "interface/EngineInterface.hpp" +#include "interface/Plugin.hpp" using std::string; using std::cerr; using std::endl; namespace Ingen { @@ -41,11 +42,9 @@ class NodeModel; * * \ingroup IngenClient */ -class PluginModel +class PluginModel : public Ingen::Shared::Plugin { public: - enum Type { Internal=0, LV2, DSSI, LADSPA, Patch }; - PluginModel(const string& uri, const string& type_uri, const string& name) : _uri(uri) , _name(name) diff --git a/src/libs/engine/ClientBroadcaster.cpp b/src/libs/engine/ClientBroadcaster.cpp index ce916ca9..363b9f09 100644 --- a/src/libs/engine/ClientBroadcaster.cpp +++ b/src/libs/engine/ClientBroadcaster.cpp @@ -25,7 +25,7 @@ #include "util.hpp" #include "Patch.hpp" #include "NodeImpl.hpp" -#include "Plugin.hpp" +#include "PluginImpl.hpp" #include "Port.hpp" #include "Connection.hpp" #include "AudioDriver.hpp" @@ -100,12 +100,12 @@ ClientBroadcaster::send_error(const string& msg) } void -ClientBroadcaster::send_plugins_to(ClientInterface* client, const list& plugin_list) +ClientBroadcaster::send_plugins_to(ClientInterface* client, const list& plugin_list) { client->transfer_begin(); - for (list::const_iterator i = plugin_list.begin(); i != plugin_list.end(); ++i) { - const Plugin* const plugin = *i; + for (list::const_iterator i = plugin_list.begin(); i != plugin_list.end(); ++i) { + const PluginImpl* const plugin = *i; client->new_plugin(plugin->uri(), plugin->type_uri(), plugin->name()); } @@ -114,7 +114,7 @@ ClientBroadcaster::send_plugins_to(ClientInterface* client, const list& void -ClientBroadcaster::send_plugins(const list& plugin_list) +ClientBroadcaster::send_plugins(const list& plugin_list) { for (Clients::const_iterator c = _clients.begin(); c != _clients.end(); ++c) send_plugins_to((*c).second, plugin_list); diff --git a/src/libs/engine/ClientBroadcaster.hpp b/src/libs/engine/ClientBroadcaster.hpp index a40b2579..50589005 100644 --- a/src/libs/engine/ClientBroadcaster.hpp +++ b/src/libs/engine/ClientBroadcaster.hpp @@ -32,7 +32,7 @@ namespace Ingen { class NodeImpl; class Port; -class Plugin; +class PluginImpl; class Patch; class Connection; using Shared::ClientInterface; @@ -61,7 +61,7 @@ public: // Error that isn't the direct result of a request void send_error(const string& msg); - void send_plugins(const std::list& plugin_list); + void send_plugins(const std::list& plugin_list); void send_patch(const Patch* const p, bool recursive); void send_node(const NodeImpl* const node, bool recursive); void send_port(const Port* port); @@ -80,7 +80,7 @@ public: void send_program_add(const string& node_path, int bank, int program, const string& name); void send_program_remove(const string& node_path, int bank, int program); - void send_plugins_to(ClientInterface*, const std::list& plugin_list); + void send_plugins_to(ClientInterface*, const std::list& plugin_list); private: typedef std::map Clients; diff --git a/src/libs/engine/DSSINode.cpp b/src/libs/engine/DSSINode.cpp index 1140d9bb..33f8b86c 100644 --- a/src/libs/engine/DSSINode.cpp +++ b/src/libs/engine/DSSINode.cpp @@ -30,7 +30,7 @@ using namespace std; namespace Ingen { -DSSINode::DSSINode(const Plugin* plugin, const string& name, bool polyphonic, Patch* parent, DSSI_Descriptor* descriptor, SampleRate srate, size_t buffer_size) +DSSINode::DSSINode(const PluginImpl* plugin, const string& name, bool polyphonic, Patch* parent, DSSI_Descriptor* descriptor, SampleRate srate, size_t buffer_size) : LADSPANode(plugin, name, 1, parent, descriptor->LADSPA_Plugin, srate, buffer_size), _dssi_descriptor(descriptor), _ui_addr(NULL), diff --git a/src/libs/engine/DSSINode.hpp b/src/libs/engine/DSSINode.hpp index 4cf034b5..38d7ea3d 100644 --- a/src/libs/engine/DSSINode.hpp +++ b/src/libs/engine/DSSINode.hpp @@ -40,7 +40,7 @@ public: typedef std::map Bank; - DSSINode(const Plugin* plugin, const string& name, bool polyphonic, Patch* parent, DSSI_Descriptor* descriptor, SampleRate srate, size_t buffer_size); + DSSINode(const PluginImpl* plugin, const string& name, bool polyphonic, Patch* parent, DSSI_Descriptor* descriptor, SampleRate srate, size_t buffer_size); ~DSSINode(); bool instantiate(); @@ -62,9 +62,6 @@ public: void set_default_program(); const std::map& get_programs() const; - const Plugin* plugin() const { return _plugin; } - void plugin(const Plugin* const pi) { _plugin = pi; } - private: bool has_midi_input() const; diff --git a/src/libs/engine/LADSPANode.cpp b/src/libs/engine/LADSPANode.cpp index 88ad5738..6ddead2b 100644 --- a/src/libs/engine/LADSPANode.cpp +++ b/src/libs/engine/LADSPANode.cpp @@ -23,9 +23,11 @@ #include "AudioBuffer.hpp" #include "InputPort.hpp" #include "OutputPort.hpp" -#include "Plugin.hpp" +#include "PluginImpl.hpp" #include "ProcessContext.hpp" +using namespace std; + namespace Ingen { @@ -34,7 +36,7 @@ namespace Ingen { * Object is not usable until instantiate() is called with success. * (It _will_ crash!) */ -LADSPANode::LADSPANode(const Plugin* plugin, const string& path, bool polyphonic, Patch* parent, const LADSPA_Descriptor* descriptor, SampleRate srate, size_t buffer_size) +LADSPANode::LADSPANode(const PluginImpl* plugin, const string& path, bool polyphonic, Patch* parent, const LADSPA_Descriptor* descriptor, SampleRate srate, size_t buffer_size) : NodeBase(plugin, path, polyphonic, parent, srate, buffer_size), _descriptor(descriptor), _instances(NULL) diff --git a/src/libs/engine/LADSPANode.hpp b/src/libs/engine/LADSPANode.hpp index 46b03792..493645a5 100644 --- a/src/libs/engine/LADSPANode.hpp +++ b/src/libs/engine/LADSPANode.hpp @@ -22,7 +22,7 @@ #include #include "types.hpp" #include "NodeBase.hpp" -#include "Plugin.hpp" +#include "PluginImpl.hpp" namespace Ingen { @@ -34,7 +34,14 @@ namespace Ingen { class LADSPANode : public NodeBase { public: - LADSPANode(const Plugin* plugin, const string& name, bool polyphonic, Patch* parent, const LADSPA_Descriptor* descriptor, SampleRate srate, size_t buffer_size); + LADSPANode(const PluginImpl* plugin, + const string& name, + bool polyphonic, + Patch* parent, + const LADSPA_Descriptor* descriptor, + SampleRate srate, + size_t buffer_size); + virtual ~LADSPANode(); virtual bool instantiate(); @@ -46,9 +53,6 @@ public: void set_port_buffer(uint32_t voice, uint32_t port_num, Buffer* buf); - const Plugin* plugin() const { return _plugin; } - void plugin(const Plugin* const pi) { _plugin = pi; } - protected: //void get_port_vals(ulong port_index, PortInfo* info); void get_port_limits(unsigned long port_index, Sample& default_value, Sample& lower_bound, Sample& upper_bound); diff --git a/src/libs/engine/LV2Node.cpp b/src/libs/engine/LV2Node.cpp index 99d074e1..c37a2665 100644 --- a/src/libs/engine/LV2Node.cpp +++ b/src/libs/engine/LV2Node.cpp @@ -24,12 +24,14 @@ #include "LV2Node.hpp" #include "InputPort.hpp" #include "OutputPort.hpp" -#include "Plugin.hpp" +#include "PluginImpl.hpp" #include "AudioBuffer.hpp" #include "MidiBuffer.hpp" #include "OSCBuffer.hpp" #include "ProcessContext.hpp" +using namespace std; + namespace Ingen { @@ -38,12 +40,12 @@ namespace Ingen { * Object is not usable until instantiate() is called with success. * (It _will_ crash!) */ -LV2Node::LV2Node(const Plugin* plugin, - const string& name, - bool polyphonic, - Patch* parent, - SampleRate srate, - size_t buffer_size) +LV2Node::LV2Node(const PluginImpl* plugin, + const string& name, + bool polyphonic, + Patch* parent, + SampleRate srate, + size_t buffer_size) : NodeBase(plugin, name, polyphonic, parent, srate, buffer_size) , _lv2_plugin(plugin->slv2_plugin()) , _instances(NULL) diff --git a/src/libs/engine/LV2Node.hpp b/src/libs/engine/LV2Node.hpp index db72ffda..9e303be9 100644 --- a/src/libs/engine/LV2Node.hpp +++ b/src/libs/engine/LV2Node.hpp @@ -22,7 +22,7 @@ #include #include "types.hpp" #include "NodeBase.hpp" -#include "Plugin.hpp" +#include "PluginImpl.hpp" namespace Ingen { @@ -34,12 +34,12 @@ namespace Ingen { class LV2Node : public NodeBase { public: - LV2Node(const Plugin* plugin, - const string& name, - bool polyphonic, - Patch* parent, - SampleRate srate, - size_t buffer_size); + LV2Node(const PluginImpl* plugin, + const string& name, + bool polyphonic, + Patch* parent, + SampleRate srate, + size_t buffer_size); virtual ~LV2Node(); diff --git a/src/libs/engine/Makefile.am b/src/libs/engine/Makefile.am index 224bba24..5952a288 100644 --- a/src/libs/engine/Makefile.am +++ b/src/libs/engine/Makefile.am @@ -80,8 +80,8 @@ libingen_engine_la_SOURCES = \ OutputPort.hpp \ Patch.cpp \ Patch.hpp \ - Plugin.cpp \ - Plugin.hpp \ + PluginImpl.cpp \ + PluginImpl.hpp \ Port.cpp \ Port.hpp \ PostProcessor.cpp \ diff --git a/src/libs/engine/MidiControlNode.cpp b/src/libs/engine/MidiControlNode.cpp index 2e4fca1a..bf2564d0 100644 --- a/src/libs/engine/MidiControlNode.cpp +++ b/src/libs/engine/MidiControlNode.cpp @@ -22,7 +22,7 @@ #include "MidiLearnEvent.hpp" #include "InputPort.hpp" #include "OutputPort.hpp" -#include "Plugin.hpp" +#include "PluginImpl.hpp" #include "AudioBuffer.hpp" #include "ProcessContext.hpp" #include "util.hpp" @@ -31,7 +31,7 @@ namespace Ingen { MidiControlNode::MidiControlNode(const string& path, bool polyphonic, Patch* parent, SampleRate srate, size_t buffer_size) -: NodeBase(new Plugin(Plugin::Internal, "ingen:control_node"), path, false, parent, srate, buffer_size), +: NodeBase(new PluginImpl(Plugin::Internal, "ingen:control_node"), path, false, parent, srate, buffer_size), _learning(false) { _ports = new Raul::Array(7); @@ -64,7 +64,7 @@ MidiControlNode::MidiControlNode(const string& path, bool polyphonic, Patch* par _control_port = new OutputPort(this, "Out(CR)", 6, 1, DataType::FLOAT, 1); _ports->at(6) = _control_port; - Plugin* p = const_cast(_plugin); + PluginImpl* p = const_cast(_plugin); p->plug_label("midi_control_in"); assert(p->uri() == "ingen:control_node"); p->name("Ingen Control Node (MIDI)"); diff --git a/src/libs/engine/MidiNoteNode.cpp b/src/libs/engine/MidiNoteNode.cpp index c4f53e58..b3d69ac2 100644 --- a/src/libs/engine/MidiNoteNode.cpp +++ b/src/libs/engine/MidiNoteNode.cpp @@ -25,7 +25,7 @@ #include "AudioBuffer.hpp" #include "InputPort.hpp" #include "OutputPort.hpp" -#include "Plugin.hpp" +#include "PluginImpl.hpp" #include "AudioDriver.hpp" #include "Patch.hpp" #include "ProcessContext.hpp" @@ -38,7 +38,7 @@ namespace Ingen { MidiNoteNode::MidiNoteNode(const string& path, bool polyphonic, Patch* parent, SampleRate srate, size_t buffer_size) -: NodeBase(new Plugin(Plugin::Internal, "ingen:note_node"), path, polyphonic, parent, srate, buffer_size), +: NodeBase(new PluginImpl(Plugin::Internal, "ingen:note_node"), path, polyphonic, parent, srate, buffer_size), _voices(new Raul::Array(_polyphony)), _prepared_voices(NULL), @@ -67,7 +67,7 @@ MidiNoteNode::MidiNoteNode(const string& path, bool polyphonic, Patch* parent, S _trig_port->set_metadata("ingen:default", 0.0f); _ports->at(4) = _trig_port; - Plugin* p = const_cast(_plugin); + PluginImpl* p = const_cast(_plugin); p->plug_label("note_in"); assert(p->uri() == "ingen:note_node"); p->name("Ingen Note Node (MIDI, OSC)"); diff --git a/src/libs/engine/MidiTriggerNode.cpp b/src/libs/engine/MidiTriggerNode.cpp index 04363b3d..7490fcc0 100644 --- a/src/libs/engine/MidiTriggerNode.cpp +++ b/src/libs/engine/MidiTriggerNode.cpp @@ -21,7 +21,7 @@ #include "AudioBuffer.hpp" #include "InputPort.hpp" #include "OutputPort.hpp" -#include "Plugin.hpp" +#include "PluginImpl.hpp" #include "ProcessContext.hpp" #include "util.hpp" @@ -29,7 +29,7 @@ namespace Ingen { MidiTriggerNode::MidiTriggerNode(const string& path, bool polyphonic, Patch* parent, SampleRate srate, size_t buffer_size) -: NodeBase(new Plugin(Plugin::Internal, "ingen:trigger_node"), path, false, parent, srate, buffer_size) +: NodeBase(new PluginImpl(Plugin::Internal, "ingen:trigger_node"), path, false, parent, srate, buffer_size) { _ports = new Raul::Array(5); @@ -52,7 +52,7 @@ MidiTriggerNode::MidiTriggerNode(const string& path, bool polyphonic, Patch* par _vel_port = new OutputPort(this, "Velocity", 4, 1, DataType::FLOAT, _buffer_size); _ports->at(4) = _vel_port; - Plugin* p = const_cast(_plugin); + PluginImpl* p = const_cast(_plugin); p->plug_label("trigger_in"); assert(p->uri() == "ingen:trigger_node"); p->name("Ingen Trigger Node (MIDI, OSC)"); diff --git a/src/libs/engine/NodeBase.cpp b/src/libs/engine/NodeBase.cpp index 3d30d604..d5400cdf 100644 --- a/src/libs/engine/NodeBase.cpp +++ b/src/libs/engine/NodeBase.cpp @@ -22,7 +22,7 @@ #include #include #include "util.hpp" -#include "Plugin.hpp" +#include "PluginImpl.hpp" #include "ClientBroadcaster.hpp" #include "Port.hpp" #include "Patch.hpp" @@ -33,7 +33,7 @@ using namespace std; namespace Ingen { -NodeBase::NodeBase(const Plugin* plugin, const string& name, bool polyphonic, Patch* parent, SampleRate srate, size_t buffer_size) +NodeBase::NodeBase(const PluginImpl* plugin, const string& name, bool polyphonic, Patch* parent, SampleRate srate, size_t buffer_size) : NodeImpl(parent, name, polyphonic), _plugin(plugin), _polyphony((polyphonic && parent) ? parent->internal_poly() : 1), diff --git a/src/libs/engine/NodeBase.hpp b/src/libs/engine/NodeBase.hpp index 833e4edd..2e4480b8 100644 --- a/src/libs/engine/NodeBase.hpp +++ b/src/libs/engine/NodeBase.hpp @@ -29,7 +29,7 @@ using std::string; namespace Ingen { -class Plugin; +class PluginImpl; class Patch; class ObjectStore; @@ -47,12 +47,12 @@ namespace Shared { class NodeBase : public NodeImpl { public: - NodeBase(const Plugin* plugin, - const string& name, - bool poly, - Patch* parent, - SampleRate rate, - size_t buffer_size); + NodeBase(const PluginImpl* plugin, + const string& name, + bool poly, + Patch* parent, + SampleRate rate, + size_t buffer_size); virtual ~NodeBase(); @@ -96,7 +96,8 @@ public: Raul::List* dependants() { return _dependants; } void dependants(Raul::List* l) { _dependants = l; } - virtual const Plugin* plugin() const { return _plugin; } + virtual const PluginImpl* plugin() const { return _plugin; } + virtual void plugin(const PluginImpl* const pi) { _plugin = pi; } /** A node's parent is always a patch, so static cast should be safe */ inline Patch* parent_patch() const { return (Patch*)_parent; } @@ -104,7 +105,7 @@ public: protected: virtual void signal_input_ready(); - const Plugin* _plugin; + const PluginImpl* _plugin; uint32_t _polyphony; SampleRate _srate; diff --git a/src/libs/engine/NodeFactory.cpp b/src/libs/engine/NodeFactory.cpp index 8be55161..3bbe87ff 100644 --- a/src/libs/engine/NodeFactory.cpp +++ b/src/libs/engine/NodeFactory.cpp @@ -27,7 +27,7 @@ #include "MidiTriggerNode.hpp" #include "MidiControlNode.hpp" #include "TransportNode.hpp" -#include "Plugin.hpp" +#include "PluginImpl.hpp" #include "Patch.hpp" #ifdef HAVE_SLV2 #include "LV2Node.hpp" @@ -62,16 +62,16 @@ NodeFactory::NodeFactory(Ingen::Shared::World* world) NodeImpl* n = NULL; n = new MidiNoteNode("foo", 1, parent, 1, 1); - _internal_plugins.push_back(new Plugin(n->plugin())); + _internal_plugins.push_back(new PluginImpl(n->plugin())); delete n; n = new MidiTriggerNode("foo", 1, parent, 1, 1); - _internal_plugins.push_back(new Plugin(n->plugin())); + _internal_plugins.push_back(new PluginImpl(n->plugin())); delete n; n = new MidiControlNode("foo", 1, parent, 1, 1); - _internal_plugins.push_back(new Plugin(n->plugin())); + _internal_plugins.push_back(new PluginImpl(n->plugin())); delete n; n = new TransportNode("foo", 1, parent, 1, 1); - _internal_plugins.push_back(new Plugin(n->plugin())); + _internal_plugins.push_back(new PluginImpl(n->plugin())); delete n; delete parent; @@ -80,7 +80,7 @@ NodeFactory::NodeFactory(Ingen::Shared::World* world) NodeFactory::~NodeFactory() { - for (list::iterator i = _plugins.begin(); i != _plugins.end(); ++i) + for (list::iterator i = _plugins.begin(); i != _plugins.end(); ++i) delete (*i); _plugins.clear(); @@ -111,10 +111,10 @@ NodeFactory::library(const string& path) } -const Plugin* +const PluginImpl* NodeFactory::plugin(const string& uri) { - for (list::iterator i = _plugins.begin(); i != _plugins.end(); ++i) + for (list::iterator i = _plugins.begin(); i != _plugins.end(); ++i) if ((*i)->uri() == uri) return (*i); @@ -126,13 +126,13 @@ NodeFactory::plugin(const string& uri) * * Do not use. */ -const Plugin* +const PluginImpl* NodeFactory::plugin(const string& type, const string& lib, const string& label) { if (type == "" || lib == "" || label == "") return NULL; - for (list::iterator i = _plugins.begin(); i != _plugins.end(); ++i) + for (list::iterator i = _plugins.begin(); i != _plugins.end(); ++i) if ((*i)->type_string() == type && (*i)->lib_name() == lib && (*i)->plug_label() == label) return (*i); @@ -176,16 +176,16 @@ NodeFactory::load_plugins() * Calls the load_*_plugin functions to actually do things, just a wrapper. */ NodeImpl* -NodeFactory::load_plugin(const Plugin* a_plugin, - const string& name, - bool polyphonic, - Patch* parent) +NodeFactory::load_plugin(const PluginImpl* a_plugin, + const string& name, + bool polyphonic, + Patch* parent) { assert(parent != NULL); assert(a_plugin); NodeImpl* r = NULL; - Plugin* plugin = NULL; + PluginImpl* plugin = NULL; const SampleRate srate = parent->sample_rate(); const size_t buffer_size = parent->buffer_size(); @@ -199,7 +199,7 @@ NodeFactory::load_plugin(const Plugin* a_plugin, if (a_plugin->uri().length() == 0) { assert(a_plugin->lib_name().length() > 0 && a_plugin->plug_label().length() > 0); //cerr << "Searching for: " << a_plugin->lib_name() << " : " << a_plugin->plug_label() << endl; - for (list::iterator i = _plugins.begin(); i != _plugins.end(); ++i) { + for (list::iterator i = _plugins.begin(); i != _plugins.end(); ++i) { //cerr << (*i)->lib_name() << " : " << (*i)->plug_label() << endl; if (a_plugin->lib_name() == (*i)->lib_name() && a_plugin->plug_label() == (*i)->plug_label()) { plugin = *i; @@ -208,7 +208,7 @@ NodeFactory::load_plugin(const Plugin* a_plugin, } } else { // Search by URI - for (list::iterator i = _plugins.begin(); i != _plugins.end(); ++i) { + for (list::iterator i = _plugins.begin(); i != _plugins.end(); ++i) { if (a_plugin->uri() == (*i)->uri()) { plugin = *i; break; @@ -263,7 +263,7 @@ NodeFactory::load_internal_plugin(const string& uri, assert(uri.length() > 6); assert(uri.substr(0, 6) == "ingen:"); - for (list::iterator i = _internal_plugins.begin(); i != _internal_plugins.end(); ++i) + for (list::iterator i = _internal_plugins.begin(); i != _internal_plugins.end(); ++i) if ((*i)->uri() == uri) return (*i)->instantiate(name, polyphonic, parent, srate, buffer_size); @@ -290,10 +290,10 @@ NodeFactory::load_lv2_plugins() assert(uri); //cerr << "\t" << uri << endl; - Plugin* plug = NULL; + PluginImpl* plug = NULL; bool found = false; - for (list::const_iterator i = _plugins.begin(); i != _plugins.end(); ++i) { + for (list::const_iterator i = _plugins.begin(); i != _plugins.end(); ++i) { if (!strcmp((*i)->uri().c_str(), uri)) { plug = (*i); found = true; @@ -302,7 +302,7 @@ NodeFactory::load_lv2_plugins() } if (!found) - plug = new Plugin(Plugin::LV2, uri); + plug = new PluginImpl(Plugin::LV2, uri); plug->slv2_plugin(lv2_plug); plug->module(NULL); // FIXME? @@ -335,8 +335,8 @@ NodeFactory::load_lv2_plugin(const string& plug_uri, size_t buffer_size) { // Find (internal) Plugin - Plugin* plugin = NULL; - list::iterator i; + PluginImpl* plugin = NULL; + list::iterator i; for (i = _plugins.begin(); i != _plugins.end(); ++i) { plugin = (*i); if ((*i)->uri() == plug_uri) break; @@ -428,7 +428,7 @@ NodeFactory::load_dssi_plugins() ld = descriptor->LADSPA_Plugin; assert(ld != NULL); string uri = string("dssi:") + pfile->d_name +":"+ ld->Label; - Plugin* plugin = new Plugin(Plugin::DSSI, uri); + PluginImpl* plugin = new PluginImpl(Plugin::DSSI, uri); assert(plugin_library != NULL); plugin->module(plugin_library); plugin->lib_path(dir + "/" + pfile->d_name); @@ -438,7 +438,7 @@ NodeFactory::load_dssi_plugins() plugin->id(ld->UniqueID); bool found = false; - for (list::const_iterator i = _plugins.begin(); i != _plugins.end(); ++i) { + for (list::const_iterator i = _plugins.begin(); i != _plugins.end(); ++i) { if ((*i)->uri() == plugin->uri()) { cerr << "Warning: Duplicate DSSI plugin (" << plugin->lib_name() << ":" << plugin->plug_label() << ")" << " found.\nUsing " << (*i)->lib_path() @@ -474,11 +474,11 @@ NodeFactory::load_dssi_plugin(const string& uri, assert(name != ""); DSSI_Descriptor_Function df = NULL; - const Plugin* plugin = NULL; + const PluginImpl* plugin = NULL; NodeImpl* n = NULL; // Attempt to find the lib - list::iterator i; + list::iterator i; for (i = _plugins.begin(); i != _plugins.end(); ++i) { plugin = (*i); if (plugin->uri() == uri) break; @@ -594,7 +594,7 @@ NodeFactory::load_ladspa_plugins() char id_str[11]; snprintf(id_str, 11, "%lu", descriptor->UniqueID); string uri = string("ladspa:").append(id_str); - Plugin* plugin = new Plugin(Plugin::LADSPA, uri); + PluginImpl* plugin = new PluginImpl(Plugin::LADSPA, uri); assert(plugin_library != NULL); plugin->module(plugin_library); @@ -605,7 +605,7 @@ NodeFactory::load_ladspa_plugins() plugin->id(descriptor->UniqueID); bool found = false; - for (list::const_iterator i = _plugins.begin(); i != _plugins.end(); ++i) { + for (list::const_iterator i = _plugins.begin(); i != _plugins.end(); ++i) { if ((*i)->uri() == plugin->uri()) { cerr << "Warning: Duplicate LADSPA plugin " << plugin->uri() << " found.\n Choosing " << (*i)->lib_path() @@ -640,11 +640,11 @@ NodeFactory::load_ladspa_plugin(const string& uri, assert(name != ""); LADSPA_Descriptor_Function df = NULL; - Plugin* plugin = NULL; + PluginImpl* plugin = NULL; NodeImpl* n = NULL; // Attempt to find the lib - list::iterator i; + list::iterator i; for (i = _plugins.begin(); i != _plugins.end(); ++i) { plugin = (*i); if (plugin->uri() == uri) break; diff --git a/src/libs/engine/NodeFactory.hpp b/src/libs/engine/NodeFactory.hpp index 8538d33d..decf59c0 100644 --- a/src/libs/engine/NodeFactory.hpp +++ b/src/libs/engine/NodeFactory.hpp @@ -38,7 +38,7 @@ namespace Ingen { class NodeImpl; class Patch; -class Plugin; +class PluginImpl; /** Loads plugins and creates Nodes from them. @@ -58,12 +58,12 @@ public: ~NodeFactory(); void load_plugins(); - NodeImpl* load_plugin(const Plugin* info, const string& name, bool polyphonic, Patch* parent); + NodeImpl* load_plugin(const PluginImpl* info, const string& name, bool polyphonic, Patch* parent); - const list& plugins() { return _plugins; } + const list& plugins() { return _plugins; } - const Plugin* plugin(const string& uri); - const Plugin* plugin(const string& type, const string& lib, const string& label); // DEPRECATED + const PluginImpl* plugin(const string& uri); + const PluginImpl* plugin(const string& type, const string& lib, const string& label); // DEPRECATED private: #ifdef HAVE_LADSPA @@ -87,9 +87,9 @@ private: typedef std::map Libraries; - Libraries _libraries; - list _internal_plugins; - list _plugins; // FIXME: make a map + Libraries _libraries; + list _internal_plugins; + list _plugins; // FIXME: make a map Ingen::Shared::World* _world; bool _has_loaded; diff --git a/src/libs/engine/NodeImpl.hpp b/src/libs/engine/NodeImpl.hpp index 97c9e8d4..70a09c33 100644 --- a/src/libs/engine/NodeImpl.hpp +++ b/src/libs/engine/NodeImpl.hpp @@ -29,7 +29,7 @@ namespace Raul { template class List; class Maid; } namespace Ingen { class Buffer; -class Plugin; +class PluginImpl; class Patch; class Port; @@ -145,7 +145,7 @@ public: /** Information about the Plugin this Node is an instance of. * Not the best name - not all nodes come from plugins (ie Patch) */ - virtual const Plugin* plugin() const = 0; + virtual const PluginImpl* plugin() const = 0; virtual void set_buffer_size(size_t size) = 0; }; diff --git a/src/libs/engine/OSCClientSender.cpp b/src/libs/engine/OSCClientSender.cpp index 8ea06fa6..56971d70 100644 --- a/src/libs/engine/OSCClientSender.cpp +++ b/src/libs/engine/OSCClientSender.cpp @@ -25,7 +25,7 @@ #include "util.hpp" #include "Patch.hpp" #include "NodeImpl.hpp" -#include "Plugin.hpp" +#include "PluginImpl.hpp" #include "Port.hpp" #include "Connection.hpp" #include "AudioDriver.hpp" diff --git a/src/libs/engine/ObjectSender.cpp b/src/libs/engine/ObjectSender.cpp index f0919257..7cbf028a 100644 --- a/src/libs/engine/ObjectSender.cpp +++ b/src/libs/engine/ObjectSender.cpp @@ -77,7 +77,7 @@ ObjectSender::send_patch(ClientInterface* client, const Patch* patch, bool recur void ObjectSender::send_node(ClientInterface* client, const NodeImpl* node, bool recursive) { - const Plugin* const plugin = node->plugin(); + const PluginImpl* const plugin = node->plugin(); assert(node->path().length() > 0); @@ -152,53 +152,5 @@ ObjectSender::send_port(ClientInterface* client, const Port* port) } -void -ObjectSender::send_plugins(ClientInterface* client, const list& plugs) -{ -/* - lo_timetag tt; - lo_timetag_now(&tt); - lo_bundle b = lo_bundle_new(tt); - lo_message m = lo_message_new(); - list msgs; - - lo_message_add_int32(m, plugs.size()); - lo_bundle_add_message(b, "/om/num_plugins", m); - msgs.push_back(m); -*/ - for (list::const_iterator j = plugs.begin(); j != plugs.end(); ++j) { - const Plugin* const p = *j; - client->new_plugin(p->uri(), p->type_uri(), p->name()); - } -/* - plugin = (*j); - m = lo_message_new(); - - lo_message_add_string(m, plugin->type_string()); - lo_message_add_string(m, plugin->uri().c_str()); - lo_message_add_string(m, plugin->name().c_str()); - lo_bundle_add_message(b, "/om/plugin", m); - msgs.push_back(m); - if (lo_bundle_length(b) > 1024) { - // FIXME FIXME FIXME dirty, dirty cast - lo_send_bundle(((OSCClient*)client)->address(), b); - lo_bundle_free(b); - b = lo_bundle_new(tt); - } - }*/ -/* - if (lo_bundle_length(b) > 0) { - // FIXME FIXME FIXME dirty, dirty cast - lo_send_bundle(((OSCClient*)client)->address(), b); - lo_bundle_free(b); - } else { - lo_bundle_free(b); - } - for (list::const_iterator i = msgs.begin(); i != msgs.end(); ++i) - lo_message_free(*i); -*/ -} - - } // namespace Ingen diff --git a/src/libs/engine/ObjectSender.hpp b/src/libs/engine/ObjectSender.hpp index fdd39101..c93804ba 100644 --- a/src/libs/engine/ObjectSender.hpp +++ b/src/libs/engine/ObjectSender.hpp @@ -29,7 +29,7 @@ namespace Shared { class Patch; class NodeImpl; class Port; -class Plugin; +class PluginImpl; /** Utility class for sending GraphObjects to clients through ClientInterface. @@ -49,7 +49,6 @@ public: static void send_patch(ClientInterface* client, const Patch* patch, bool recursive); static void send_node(ClientInterface* client, const NodeImpl* node, bool recursive); static void send_port(ClientInterface* client, const Port* port); - static void send_plugins(ClientInterface* client, const std::list& plugs); }; } // namespace Ingen diff --git a/src/libs/engine/Patch.cpp b/src/libs/engine/Patch.cpp index 70f3b535..0619c743 100644 --- a/src/libs/engine/Patch.cpp +++ b/src/libs/engine/Patch.cpp @@ -21,7 +21,7 @@ #include "ThreadManager.hpp" #include "NodeImpl.hpp" #include "Patch.hpp" -#include "Plugin.hpp" +#include "PluginImpl.hpp" #include "Port.hpp" #include "Connection.hpp" #include "DuplexPort.hpp" @@ -34,7 +34,7 @@ namespace Ingen { Patch::Patch(Engine& engine, const string& path, uint32_t poly, Patch* parent, SampleRate srate, size_t buffer_size, uint32_t internal_poly) -: NodeBase(new Plugin(Plugin::Patch, "ingen:patch"), path, poly, parent, srate, buffer_size), +: NodeBase(new PluginImpl(Plugin::Patch, "ingen:patch"), path, poly, parent, srate, buffer_size), _engine(engine), _internal_poly(internal_poly), _compiled_patch(NULL), diff --git a/src/libs/engine/Patch.hpp b/src/libs/engine/Patch.hpp index bd1723a5..ddcc1c93 100644 --- a/src/libs/engine/Patch.hpp +++ b/src/libs/engine/Patch.hpp @@ -22,7 +22,7 @@ #include #include #include "NodeBase.hpp" -#include "Plugin.hpp" +#include "PluginImpl.hpp" #include "DataType.hpp" #include "CompiledPatch.hpp" diff --git a/src/libs/engine/Plugin.cpp b/src/libs/engine/Plugin.cpp deleted file mode 100644 index 3e0a30fc..00000000 --- a/src/libs/engine/Plugin.cpp +++ /dev/null @@ -1,45 +0,0 @@ -/* This file is part of Ingen. - * Copyright (C) 2007 Dave Robillard - * - * Ingen is free software; you can redistribute it and/or modify it under the - * terms of the GNU General Public License as published by the Free Software - * Foundation; either version 2 of the License, or (at your option) any later - * version. - * - * Ingen is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#include "Plugin.hpp" -#include "MidiNoteNode.hpp" -#include "MidiTriggerNode.hpp" -#include "MidiControlNode.hpp" -#include "TransportNode.hpp" - -namespace Ingen { - -NodeImpl* -Plugin::instantiate(const string& name, bool polyphonic, Ingen::Patch* parent, SampleRate srate, size_t buffer_size) -{ - assert(_type == Internal); - - if (_uri == "ingen:note_node") { - return new MidiNoteNode(name, polyphonic, parent, srate, buffer_size); - } else if (_uri == "ingen:trigger_node") { - return new MidiTriggerNode(name, polyphonic, parent, srate, buffer_size); - } else if (_uri == "ingen:control_node") { - return new MidiControlNode(name, polyphonic, parent, srate, buffer_size); - } else if (_uri == "ingen:transport_node") { - return new TransportNode(name, polyphonic, parent, srate, buffer_size); - } else { - return NULL; - } -} - - -} // namespace Ingen diff --git a/src/libs/engine/Plugin.hpp b/src/libs/engine/Plugin.hpp deleted file mode 100644 index dd14e815..00000000 --- a/src/libs/engine/Plugin.hpp +++ /dev/null @@ -1,145 +0,0 @@ -/* This file is part of Ingen. - * Copyright (C) 2007 Dave Robillard - * - * Ingen is free software; you can redistribute it and/or modify it under the - * terms of the GNU General Public License as published by the Free Software - * Foundation; either version 2 of the License, or (at your option) any later - * version. - * - * Ingen is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef PLUGIN_H -#define PLUGIN_H - -#include CONFIG_H_PATH - -#include -#include -#include -#include -#include -#include -#ifdef HAVE_SLV2 -#include -#endif -#include "types.hpp" -using std::string; -using std::cerr; using std::endl; - -namespace Ingen { - -class Patch; -class NodeImpl; - - -/** Representation of a plugin (of various types). - * - * 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. - */ -class Plugin : boost::noncopyable -{ -public: - enum Type { LV2, LADSPA, DSSI, Internal, Patch }; - - Plugin(Type type, const string& uri) - : _type(type) - , _uri(uri) - , _id(0) - , _module(NULL) -#ifdef HAVE_SLV2 - , _slv2_plugin(NULL) -#endif - {} - - Plugin(const Plugin* 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; - } - - Type type() const { return _type; } - void type(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; } - - const char* type_string() const { - if (_type == LADSPA) return "LADSPA"; - else if (_type == LV2) return "LV2"; - else if (_type == DSSI) return "DSSI"; - else if (_type == Internal) return "Internal"; - else if (_type == Patch) return "Patch"; - else return ""; - } - - string type_uri() const { - return string("ingen:") + type_string(); - } - - void set_type(const string& type_string) { - if (type_string == "LADSPA") _type = LADSPA; - else if (type_string == "LV2") _type = LV2; - else if (type_string == "DSSI") _type = DSSI; - else if (type_string == "Internal") _type = Internal; - 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 - - NodeImpl* instantiate(const string& name, bool polyphonic, Ingen::Patch* parent, SampleRate srate, size_t buffer_size); - -private: - Type _type; - string _uri; ///< LV2 only - string _lib_path; ///< LADSPA/DSSI only - string _lib_name; ///< LADSPA/DSSI only - string _plug_label; ///< LADSPA/DSSI only - string _name; ///< LADSPA/DSSI only - unsigned long _id; ///< LADSPA/DSSI only - - Glib::Module* _module; - -#ifdef HAVE_SLV2 - SLV2Plugin _slv2_plugin; -#endif -}; - - -} // namespace Ingen - -#endif // PLUGIN_H - diff --git a/src/libs/engine/PluginImpl.cpp b/src/libs/engine/PluginImpl.cpp new file mode 100644 index 00000000..710c6385 --- /dev/null +++ b/src/libs/engine/PluginImpl.cpp @@ -0,0 +1,45 @@ +/* This file is part of Ingen. + * Copyright (C) 2007 Dave Robillard + * + * Ingen is free software; you can redistribute it and/or modify it under the + * terms of the GNU General Public License as published by the Free Software + * Foundation; either version 2 of the License, or (at your option) any later + * version. + * + * Ingen is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#include "PluginImpl.hpp" +#include "MidiNoteNode.hpp" +#include "MidiTriggerNode.hpp" +#include "MidiControlNode.hpp" +#include "TransportNode.hpp" + +namespace Ingen { + +NodeImpl* +PluginImpl::instantiate(const string& name, bool polyphonic, Ingen::Patch* parent, SampleRate srate, size_t buffer_size) +{ + assert(_type == Internal); + + if (_uri == "ingen:note_node") { + return new MidiNoteNode(name, polyphonic, parent, srate, buffer_size); + } else if (_uri == "ingen:trigger_node") { + return new MidiTriggerNode(name, polyphonic, parent, srate, buffer_size); + } else if (_uri == "ingen:control_node") { + return new MidiControlNode(name, polyphonic, parent, srate, buffer_size); + } else if (_uri == "ingen:transport_node") { + return new TransportNode(name, polyphonic, parent, srate, buffer_size); + } else { + return NULL; + } +} + + +} // namespace Ingen diff --git a/src/libs/engine/PluginImpl.hpp b/src/libs/engine/PluginImpl.hpp new file mode 100644 index 00000000..e2aa4374 --- /dev/null +++ b/src/libs/engine/PluginImpl.hpp @@ -0,0 +1,144 @@ +/* This file is part of Ingen. + * Copyright (C) 2007 Dave Robillard + * + * Ingen is free software; you can redistribute it and/or modify it under the + * terms of the GNU General Public License as published by the Free Software + * Foundation; either version 2 of the License, or (at your option) any later + * version. + * + * Ingen is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef PLUGINIMPL_H +#define PLUGINIMPL_H + +#include CONFIG_H_PATH + +#include +#include +#include +#include +#include +#include +#ifdef HAVE_SLV2 +#include +#endif +#include "types.hpp" +#include "interface/Plugin.hpp" +using std::string; +using Ingen::Shared::Plugin; + +namespace Ingen { + +class Patch; +class NodeImpl; + + +/** Representation of a plugin (of various types). + * + * 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. + */ +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(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; } + + const char* type_string() const { + if (_type == LADSPA) return "LADSPA"; + else if (_type == LV2) return "LV2"; + else if (_type == DSSI) return "DSSI"; + else if (_type == Internal) return "Internal"; + else if (_type == Patch) return "Patch"; + else return ""; + } + + string type_uri() const { + return string("ingen:") + type_string(); + } + + void set_type(const string& type_string) { + if (type_string == "LADSPA") _type = LADSPA; + else if (type_string == "LV2") _type = LV2; + else if (type_string == "DSSI") _type = DSSI; + else if (type_string == "Internal") _type = Internal; + 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 + + NodeImpl* instantiate(const string& name, bool polyphonic, Ingen::Patch* parent, SampleRate srate, size_t buffer_size); + +private: + Plugin::Type _type; + string _uri; ///< LV2 only + string _lib_path; ///< LADSPA/DSSI only + string _lib_name; ///< LADSPA/DSSI only + string _plug_label; ///< LADSPA/DSSI only + string _name; ///< LADSPA/DSSI only + unsigned long _id; ///< LADSPA/DSSI only + + Glib::Module* _module; + +#ifdef HAVE_SLV2 + SLV2Plugin _slv2_plugin; +#endif +}; + + +} // namespace Ingen + +#endif // PLUGINIMPL_H + diff --git a/src/libs/engine/TransportNode.cpp b/src/libs/engine/TransportNode.cpp index eddbc70d..4322f371 100644 --- a/src/libs/engine/TransportNode.cpp +++ b/src/libs/engine/TransportNode.cpp @@ -18,7 +18,7 @@ #include "TransportNode.hpp" #include #include "OutputPort.hpp" -#include "Plugin.hpp" +#include "PluginImpl.hpp" #include "JackAudioDriver.hpp" #include "Port.hpp" #include "util.hpp" @@ -28,7 +28,7 @@ namespace Ingen { TransportNode::TransportNode(const string& path, bool polyphonic, Patch* parent, SampleRate srate, size_t buffer_size) -: NodeBase(new Plugin(Plugin::Internal, "ingen:transport_node"), path, false, parent, srate, buffer_size) +: NodeBase(new PluginImpl(Plugin::Internal, "ingen:transport_node"), path, false, parent, srate, buffer_size) { #if 0 _num_ports = 10; @@ -74,7 +74,7 @@ TransportNode::TransportNode(const string& path, bool polyphonic, Patch* parent, // new PortInfo("Bar Tick", AUDIO, OUTPUT, 0, 0, 1), buffer_size); _ports.at(9) = bar_trig_port; #endif - Plugin* p = const_cast(_plugin); + PluginImpl* p = const_cast(_plugin); p->plug_label("transport"); assert(p->uri() == "ingen:transport_node"); p->name("Ingen Transport Node (BROKEN)"); diff --git a/src/libs/engine/events/CreateNodeEvent.cpp b/src/libs/engine/events/CreateNodeEvent.cpp index 991ee0a8..df891cd3 100644 --- a/src/libs/engine/events/CreateNodeEvent.cpp +++ b/src/libs/engine/events/CreateNodeEvent.cpp @@ -22,7 +22,7 @@ #include "Responder.hpp" #include "Patch.hpp" #include "NodeImpl.hpp" -#include "Plugin.hpp" +#include "PluginImpl.hpp" #include "Engine.hpp" #include "Patch.hpp" #include "NodeFactory.hpp" @@ -78,7 +78,7 @@ CreateNodeEvent::pre_process() _patch = _engine.object_store()->find_patch(_path.parent()); - const Plugin* plugin = (_plugin_uri != "") + const PluginImpl* plugin = (_plugin_uri != "") ? _engine.node_factory()->plugin(_plugin_uri) : _engine.node_factory()->plugin(_plugin_type, _plugin_lib, _plugin_label); diff --git a/src/libs/engine/events/CreatePatchEvent.cpp b/src/libs/engine/events/CreatePatchEvent.cpp index a7cc7f8c..a5b907ab 100644 --- a/src/libs/engine/events/CreatePatchEvent.cpp +++ b/src/libs/engine/events/CreatePatchEvent.cpp @@ -21,7 +21,7 @@ #include "Responder.hpp" #include "Patch.hpp" #include "NodeImpl.hpp" -#include "Plugin.hpp" +#include "PluginImpl.hpp" #include "Engine.hpp" #include "ClientBroadcaster.hpp" #include "AudioDriver.hpp" diff --git a/src/libs/engine/events/CreatePortEvent.cpp b/src/libs/engine/events/CreatePortEvent.cpp index 6163d4ab..065ca4a3 100644 --- a/src/libs/engine/events/CreatePortEvent.cpp +++ b/src/libs/engine/events/CreatePortEvent.cpp @@ -22,7 +22,7 @@ #include "Responder.hpp" #include "CreatePortEvent.hpp" #include "Patch.hpp" -#include "Plugin.hpp" +#include "PluginImpl.hpp" #include "Engine.hpp" #include "Patch.hpp" #include "QueuedEventSource.hpp" diff --git a/src/libs/engine/events/DSSIConfigureEvent.cpp b/src/libs/engine/events/DSSIConfigureEvent.cpp index 631ee608..25c9ab31 100644 --- a/src/libs/engine/events/DSSIConfigureEvent.cpp +++ b/src/libs/engine/events/DSSIConfigureEvent.cpp @@ -19,9 +19,11 @@ #include "Engine.hpp" #include "NodeImpl.hpp" #include "ClientBroadcaster.hpp" -#include "Plugin.hpp" +#include "PluginImpl.hpp" #include "ObjectStore.hpp" +using namespace std; + namespace Ingen { diff --git a/src/libs/engine/events/DSSIControlEvent.cpp b/src/libs/engine/events/DSSIControlEvent.cpp index 25bcaaf4..70c7dc99 100644 --- a/src/libs/engine/events/DSSIControlEvent.cpp +++ b/src/libs/engine/events/DSSIControlEvent.cpp @@ -18,7 +18,7 @@ #include "DSSIControlEvent.hpp" #include "Engine.hpp" #include "NodeImpl.hpp" -#include "Plugin.hpp" +#include "PluginImpl.hpp" #include "ObjectStore.hpp" namespace Ingen { diff --git a/src/libs/engine/events/DSSIProgramEvent.cpp b/src/libs/engine/events/DSSIProgramEvent.cpp index d47e3294..94cd20dc 100644 --- a/src/libs/engine/events/DSSIProgramEvent.cpp +++ b/src/libs/engine/events/DSSIProgramEvent.cpp @@ -21,7 +21,7 @@ #include "Engine.hpp" #include "NodeImpl.hpp" #include "ClientBroadcaster.hpp" -#include "Plugin.hpp" +#include "PluginImpl.hpp" #include "ObjectStore.hpp" using std::cout; using std::cerr; using std::endl; diff --git a/src/libs/engine/events/DSSIUpdateEvent.cpp b/src/libs/engine/events/DSSIUpdateEvent.cpp index 61d2ab97..8f2eea6a 100644 --- a/src/libs/engine/events/DSSIUpdateEvent.cpp +++ b/src/libs/engine/events/DSSIUpdateEvent.cpp @@ -21,7 +21,7 @@ #include "ObjectStore.hpp" #include "Engine.hpp" #include "DSSINode.hpp" -#include "Plugin.hpp" +#include "PluginImpl.hpp" using std::cerr; using std::endl; diff --git a/src/libs/engine/events/DestroyEvent.cpp b/src/libs/engine/events/DestroyEvent.cpp index 96d8874a..575b1973 100644 --- a/src/libs/engine/events/DestroyEvent.cpp +++ b/src/libs/engine/events/DestroyEvent.cpp @@ -22,7 +22,7 @@ #include "Engine.hpp" #include "Patch.hpp" #include "NodeBase.hpp" -#include "Plugin.hpp" +#include "PluginImpl.hpp" #include "AudioDriver.hpp" #include "MidiDriver.hpp" #include "DisconnectNodeEvent.hpp" diff --git a/src/libs/engine/events/MidiLearnEvent.cpp b/src/libs/engine/events/MidiLearnEvent.cpp index 683c879a..2cb39c0e 100644 --- a/src/libs/engine/events/MidiLearnEvent.cpp +++ b/src/libs/engine/events/MidiLearnEvent.cpp @@ -22,7 +22,7 @@ #include "NodeImpl.hpp" #include "MidiControlNode.hpp" #include "ClientBroadcaster.hpp" -#include "Plugin.hpp" +#include "PluginImpl.hpp" namespace Ingen { diff --git a/src/libs/engine/events/NoteEvent.cpp b/src/libs/engine/events/NoteEvent.cpp index 72191d84..9c69b9df 100644 --- a/src/libs/engine/events/NoteEvent.cpp +++ b/src/libs/engine/events/NoteEvent.cpp @@ -22,7 +22,7 @@ #include "NodeImpl.hpp" #include "MidiNoteNode.hpp" #include "MidiTriggerNode.hpp" -#include "Plugin.hpp" +#include "PluginImpl.hpp" #include "ProcessContext.hpp" namespace Ingen { diff --git a/src/libs/engine/events/RequestPluginEvent.cpp b/src/libs/engine/events/RequestPluginEvent.cpp index af7a4754..f2886902 100644 --- a/src/libs/engine/events/RequestPluginEvent.cpp +++ b/src/libs/engine/events/RequestPluginEvent.cpp @@ -15,16 +15,16 @@ * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -#include "RequestPluginEvent.hpp" #include #include "interface/ClientInterface.hpp" +#include "RequestPluginEvent.hpp" #include "Responder.hpp" #include "Engine.hpp" #include "Port.hpp" #include "ObjectStore.hpp" #include "ClientBroadcaster.hpp" #include "NodeFactory.hpp" -#include "Plugin.hpp" +#include "PluginImpl.hpp" #include "ProcessContext.hpp" using std::string; diff --git a/src/libs/engine/events/RequestPluginEvent.hpp b/src/libs/engine/events/RequestPluginEvent.hpp index a4c6cd09..cca43627 100644 --- a/src/libs/engine/events/RequestPluginEvent.hpp +++ b/src/libs/engine/events/RequestPluginEvent.hpp @@ -26,9 +26,7 @@ using std::string; namespace Ingen { -class Plugin; -namespace Shared { class ClientInterface; } -using Shared::ClientInterface; +class PluginImpl; /** A request from a client to send the value of a port. @@ -45,8 +43,8 @@ public: void post_process(); private: - string _uri; - const Plugin* _plugin; + const string _uri; + const PluginImpl* _plugin; }; diff --git a/src/libs/engine/events/RequestPluginsEvent.hpp b/src/libs/engine/events/RequestPluginsEvent.hpp index 92a042f9..ae6a77a9 100644 --- a/src/libs/engine/events/RequestPluginsEvent.hpp +++ b/src/libs/engine/events/RequestPluginsEvent.hpp @@ -25,7 +25,7 @@ using std::string; namespace Ingen { -class Plugin; +class PluginImpl; class Responder; namespace Shared { class ClientInterface; @@ -45,7 +45,7 @@ public: void post_process(); private: - std::list _plugins; + std::list _plugins; }; diff --git a/src/libs/engine/events/SetPortValueQueuedEvent.cpp b/src/libs/engine/events/SetPortValueQueuedEvent.cpp index 941905fc..026f22b6 100644 --- a/src/libs/engine/events/SetPortValueQueuedEvent.cpp +++ b/src/libs/engine/events/SetPortValueQueuedEvent.cpp @@ -21,7 +21,7 @@ #include "Engine.hpp" #include "Port.hpp" #include "ClientBroadcaster.hpp" -#include "Plugin.hpp" +#include "PluginImpl.hpp" #include "NodeImpl.hpp" #include "ObjectStore.hpp" #include "AudioBuffer.hpp" @@ -144,7 +144,7 @@ SetPortValueQueuedEvent::post_process() } else if (_error == NO_SPACE) { std::ostringstream msg("Attempt to write "); msg << _data_size << " bytes to " << _port_path << ", with capacity " - << _port->buffer_size() << endl; + << _port->buffer_size() << std::endl; _responder->respond_error(msg.str()); } } -- cgit v1.2.1