diff options
Diffstat (limited to 'src/libs/engine')
-rw-r--r-- | src/libs/engine/InternalPlugin.cpp | 23 | ||||
-rw-r--r-- | src/libs/engine/InternalPlugin.hpp | 5 | ||||
-rw-r--r-- | src/libs/engine/LADSPAPlugin.cpp | 8 | ||||
-rw-r--r-- | src/libs/engine/LADSPAPlugin.hpp | 3 | ||||
-rw-r--r-- | src/libs/engine/LV2Node.cpp | 3 | ||||
-rw-r--r-- | src/libs/engine/LV2Plugin.cpp | 11 | ||||
-rw-r--r-- | src/libs/engine/LV2Plugin.hpp | 3 | ||||
-rw-r--r-- | src/libs/engine/PatchPlugin.hpp | 3 | ||||
-rw-r--r-- | src/libs/engine/PluginImpl.hpp | 4 | ||||
-rw-r--r-- | src/libs/engine/events/CreateNodeEvent.cpp | 3 |
10 files changed, 29 insertions, 37 deletions
diff --git a/src/libs/engine/InternalPlugin.cpp b/src/libs/engine/InternalPlugin.cpp index 9141b545..1c6a92a5 100644 --- a/src/libs/engine/InternalPlugin.cpp +++ b/src/libs/engine/InternalPlugin.cpp @@ -21,33 +21,22 @@ #include "MidiTriggerNode.hpp" #include "MidiControlNode.hpp" #include "TransportNode.hpp" +#include "Engine.hpp" +#include "AudioDriver.hpp" namespace Ingen { -#if 0 -InternalPlugin::InternalPlugin(const InternalPlugin* const copy) -{ - _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; -} -#endif - - NodeImpl* InternalPlugin::instantiate(const string& name, bool polyphonic, Ingen::PatchImpl* parent, - SampleRate srate, - size_t buffer_size) + Engine& engine) { assert(_type == Internal); + + SampleCount srate = engine.audio_driver()->sample_rate(); + SampleCount buffer_size = engine.audio_driver()->buffer_size(); if (_uri == NS_INGEN "note_node") { return new MidiNoteNode(name, polyphonic, parent, srate, buffer_size); diff --git a/src/libs/engine/InternalPlugin.hpp b/src/libs/engine/InternalPlugin.hpp index 02ca3e59..c04c9015 100644 --- a/src/libs/engine/InternalPlugin.hpp +++ b/src/libs/engine/InternalPlugin.hpp @@ -54,13 +54,10 @@ public: , _name(name) {} - //InternalPlugin(const InternalPlugin* const copy); - NodeImpl* instantiate(const std::string& name, bool polyphonic, Ingen::PatchImpl* parent, - SampleRate srate, - size_t buffer_size); + Engine& engine); const string symbol() const { return _symbol; } const string name() const { return _name; } diff --git a/src/libs/engine/LADSPAPlugin.cpp b/src/libs/engine/LADSPAPlugin.cpp index a43baa9a..4a0b5c14 100644 --- a/src/libs/engine/LADSPAPlugin.cpp +++ b/src/libs/engine/LADSPAPlugin.cpp @@ -21,6 +21,8 @@ #include "LADSPAPlugin.hpp" #include "LADSPANode.hpp" #include "NodeImpl.hpp" +#include "Engine.hpp" +#include "AudioDriver.hpp" using namespace std; @@ -31,11 +33,13 @@ NodeImpl* LADSPAPlugin::instantiate(const string& name, bool polyphonic, Ingen::PatchImpl* parent, - SampleRate srate, - size_t buffer_size) + Engine& engine) { assert(_id != 0); + SampleCount srate = engine.audio_driver()->sample_rate(); + SampleCount buffer_size = engine.audio_driver()->buffer_size(); + LADSPA_Descriptor_Function df = NULL; LADSPANode* n = NULL; diff --git a/src/libs/engine/LADSPAPlugin.hpp b/src/libs/engine/LADSPAPlugin.hpp index 59a6972b..2414be7c 100644 --- a/src/libs/engine/LADSPAPlugin.hpp +++ b/src/libs/engine/LADSPAPlugin.hpp @@ -54,8 +54,7 @@ public: NodeImpl* instantiate(const std::string& name, bool polyphonic, Ingen::PatchImpl* parent, - SampleRate srate, - size_t buffer_size); + Engine& engine); const std::string& label() const { return _label; } unsigned long id() const { return _id; } diff --git a/src/libs/engine/LV2Node.cpp b/src/libs/engine/LV2Node.cpp index 974c5858..cfc9be78 100644 --- a/src/libs/engine/LV2Node.cpp +++ b/src/libs/engine/LV2Node.cpp @@ -129,8 +129,7 @@ LV2Node::instantiate() uint32_t num_ports = slv2_plugin_get_num_ports(plug); assert(num_ports > 0); - _ports = new Raul::Array<PortImpl*>(num_ports, NULL); - + _ports = new Raul::Array<PortImpl*>(num_ports, NULL); _instances = new Raul::Array<SLV2Instance>(_polyphony, NULL); uint32_t port_buffer_size = 0; diff --git a/src/libs/engine/LV2Plugin.cpp b/src/libs/engine/LV2Plugin.cpp index 09d48a10..90a3a6b8 100644 --- a/src/libs/engine/LV2Plugin.cpp +++ b/src/libs/engine/LV2Plugin.cpp @@ -16,9 +16,13 @@ */ #include <cassert> +#include <glibmm.h> +#include <redlandmm/World.hpp> #include "LV2Plugin.hpp" #include "LV2Node.hpp" #include "NodeImpl.hpp" +#include "Engine.hpp" +#include "AudioDriver.hpp" namespace Ingen { @@ -58,11 +62,14 @@ NodeImpl* LV2Plugin::instantiate(const string& name, bool polyphonic, Ingen::PatchImpl* parent, - SampleRate srate, - size_t buffer_size) + Engine& engine) { + SampleCount srate = engine.audio_driver()->sample_rate(); + SampleCount buffer_size = engine.audio_driver()->buffer_size(); + load(); // FIXME: unload at some point + Glib::Mutex::Lock lock(engine.world()->rdf_world->mutex()); LV2Node* n = new LV2Node(this, name, polyphonic, parent, srate, buffer_size); if ( ! n->instantiate() ) { diff --git a/src/libs/engine/LV2Plugin.hpp b/src/libs/engine/LV2Plugin.hpp index 827e7e89..c1f8671d 100644 --- a/src/libs/engine/LV2Plugin.hpp +++ b/src/libs/engine/LV2Plugin.hpp @@ -61,8 +61,7 @@ public: NodeImpl* instantiate(const string& name, bool polyphonic, Ingen::PatchImpl* parent, - SampleRate srate, - size_t buffer_size); + Engine& engine); const string symbol() const; const string name() const; diff --git a/src/libs/engine/PatchPlugin.hpp b/src/libs/engine/PatchPlugin.hpp index 24a2679a..a7334392 100644 --- a/src/libs/engine/PatchPlugin.hpp +++ b/src/libs/engine/PatchPlugin.hpp @@ -44,8 +44,7 @@ public: NodeImpl* instantiate(const std::string& name, bool polyphonic, Ingen::PatchImpl* parent, - SampleRate srate, - size_t buffer_size) + Engine& engine) { return NULL; } diff --git a/src/libs/engine/PluginImpl.hpp b/src/libs/engine/PluginImpl.hpp index 9ad16ee3..0301d942 100644 --- a/src/libs/engine/PluginImpl.hpp +++ b/src/libs/engine/PluginImpl.hpp @@ -36,6 +36,7 @@ namespace Ingen { class PatchImpl; class NodeImpl; +class Engine; /** Implementation of a plugin (internal code, or a loaded shared library). @@ -55,8 +56,7 @@ public: virtual NodeImpl* instantiate(const std::string& name, bool polyphonic, Ingen::PatchImpl* parent, - SampleRate srate, - size_t buffer_size) = 0; + Engine& engine) = 0; virtual const string symbol() const = 0; virtual const string name() const = 0; diff --git a/src/libs/engine/events/CreateNodeEvent.cpp b/src/libs/engine/events/CreateNodeEvent.cpp index a3681597..b58bc2c3 100644 --- a/src/libs/engine/events/CreateNodeEvent.cpp +++ b/src/libs/engine/events/CreateNodeEvent.cpp @@ -87,8 +87,7 @@ CreateNodeEvent::pre_process() if (_patch && plugin) { - _node = plugin->instantiate(_path.name(), _polyphonic, _patch, - _engine.audio_driver()->sample_rate(), _engine.audio_driver()->buffer_size()); + _node = plugin->instantiate(_path.name(), _polyphonic, _patch, _engine); if (_node != NULL) { _node->activate(); |