diff options
author | David Robillard <d@drobilla.net> | 2010-03-06 10:23:19 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2010-03-06 10:23:19 +0000 |
commit | 059f20c9666234f2be01498ee04f1e7ee795ba8f (patch) | |
tree | ef0d53073d53012aeaa7d084fccf477b166c0684 /src/engine/internals | |
parent | 085a451dfec54126be1b9346899c81d82e6eb58e (diff) | |
download | ingen-059f20c9666234f2be01498ee04f1e7ee795ba8f.tar.gz ingen-059f20c9666234f2be01498ee04f1e7ee795ba8f.tar.bz2 ingen-059f20c9666234f2be01498ee04f1e7ee795ba8f.zip |
Save Ingen patches as working standard LV2 plugin bundles.
This allows you to create an Ingen patch in Ingen running as a Jack client,
save it, then load that patch as an LV2 plugin in any LV2 compliant host.
Eliminate (hopefully) all static data in the engine (for multiple instantiations in a single process).
More API/ABI stable interface for Ingen::Shared::World.
git-svn-id: http://svn.drobilla.net/lad/trunk/ingen@2533 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src/engine/internals')
-rw-r--r-- | src/engine/internals/Controller.cpp | 21 | ||||
-rw-r--r-- | src/engine/internals/Controller.hpp | 10 | ||||
-rw-r--r-- | src/engine/internals/Delay.cpp | 18 | ||||
-rw-r--r-- | src/engine/internals/Delay.hpp | 11 | ||||
-rw-r--r-- | src/engine/internals/Note.cpp | 21 | ||||
-rw-r--r-- | src/engine/internals/Note.hpp | 11 | ||||
-rw-r--r-- | src/engine/internals/Trigger.cpp | 18 | ||||
-rw-r--r-- | src/engine/internals/Trigger.hpp | 10 |
8 files changed, 84 insertions, 36 deletions
diff --git a/src/engine/internals/Controller.cpp b/src/engine/internals/Controller.cpp index aeeb1cd1..b65b80d5 100644 --- a/src/engine/internals/Controller.cpp +++ b/src/engine/internals/Controller.cpp @@ -36,19 +36,20 @@ namespace Internals { using namespace Shared; -static InternalPlugin controller_plugin(NS_INTERNALS "Controller", "controller"); - -InternalPlugin& ControllerNode::internal_plugin() { return controller_plugin; } +InternalPlugin* ControllerNode::internal_plugin(Shared::LV2URIMap& uris) { + return new InternalPlugin(uris, NS_INTERNALS "Controller", "controller"); +} -ControllerNode::ControllerNode(BufferFactory& bufs, - const string& path, - bool polyphonic, - PatchImpl* parent, - SampleRate srate) - : NodeImpl(&controller_plugin, path, false, parent, srate) +ControllerNode::ControllerNode(InternalPlugin* plugin, + BufferFactory& bufs, + const string& path, + bool polyphonic, + PatchImpl* parent, + SampleRate srate) + : NodeImpl(plugin, path, false, parent, srate) , _learning(false) { - const LV2URIMap& uris = Shared::LV2URIMap::instance(); + const LV2URIMap& uris = bufs.uris(); _ports = new Raul::Array<PortImpl*>(6); _midi_in_port = new InputPort(bufs, this, "input", 0, 1, PortType::EVENTS, Raul::Atom()); diff --git a/src/engine/internals/Controller.hpp b/src/engine/internals/Controller.hpp index b3363665..a8c90a2a 100644 --- a/src/engine/internals/Controller.hpp +++ b/src/engine/internals/Controller.hpp @@ -40,7 +40,13 @@ namespace Internals { class ControllerNode : public NodeImpl { public: - ControllerNode(BufferFactory& bufs, const std::string& path, bool polyphonic, PatchImpl* parent, SampleRate srate); + ControllerNode( + InternalPlugin* plugin, + BufferFactory& bufs, + const std::string& path, + bool polyphonic, + PatchImpl* parent, + SampleRate srate); void process(ProcessContext& context); @@ -48,7 +54,7 @@ public: void learn() { _learning = true; } - static InternalPlugin& internal_plugin(); + static InternalPlugin* internal_plugin(Shared::LV2URIMap& uris); private: bool _learning; diff --git a/src/engine/internals/Delay.cpp b/src/engine/internals/Delay.cpp index 7910713f..1316c567 100644 --- a/src/engine/internals/Delay.cpp +++ b/src/engine/internals/Delay.cpp @@ -49,18 +49,24 @@ using namespace Shared; static const float MAX_DELAY_SECONDS = 8.0f; -static InternalPlugin note_plugin(NS_INTERNALS "Delay", "delay"); - -InternalPlugin& DelayNode::internal_plugin() { return note_plugin; } +InternalPlugin* DelayNode::internal_plugin(Shared::LV2URIMap& uris) { + return new InternalPlugin(uris, NS_INTERNALS "Delay", "delay"); +} -DelayNode::DelayNode(BufferFactory& bufs, const string& path, bool polyphonic, PatchImpl* parent, SampleRate srate) - : NodeImpl(¬e_plugin, path, polyphonic, parent, srate) +DelayNode::DelayNode( + InternalPlugin* plugin, + BufferFactory& bufs, + const std::string& path, + bool polyphonic, + PatchImpl* parent, + SampleRate srate) + : NodeImpl(plugin, path, polyphonic, parent, srate) , _buffer(0) , _buffer_length(0) , _buffer_mask(0) , _write_phase(0) { - const LV2URIMap& uris = Shared::LV2URIMap::instance(); + const LV2URIMap& uris = bufs.uris(); _ports = new Raul::Array<PortImpl*>(3); const float default_delay = 1.0f; diff --git a/src/engine/internals/Delay.hpp b/src/engine/internals/Delay.hpp index 758d32e7..f07a3f4c 100644 --- a/src/engine/internals/Delay.hpp +++ b/src/engine/internals/Delay.hpp @@ -44,14 +44,21 @@ namespace Internals { class DelayNode : public NodeImpl { public: - DelayNode(BufferFactory& bufs, const std::string& path, bool polyphonic, PatchImpl* parent, SampleRate srate); + DelayNode( + InternalPlugin* plugin, + BufferFactory& bufs, + const std::string& path, + bool polyphonic, + PatchImpl* parent, + SampleRate srate); + ~DelayNode(); void activate(BufferFactory& bufs); void process(ProcessContext& context); - static InternalPlugin& internal_plugin(); + static InternalPlugin* internal_plugin(Shared::LV2URIMap& uris); float delay_samples() const { return _delay_samples; } diff --git a/src/engine/internals/Note.cpp b/src/engine/internals/Note.cpp index 298af84a..7bdcd6ec 100644 --- a/src/engine/internals/Note.cpp +++ b/src/engine/internals/Note.cpp @@ -43,19 +43,28 @@ namespace Internals { using namespace Shared; -static InternalPlugin note_plugin(NS_INTERNALS "Note", "note"); - -InternalPlugin& NoteNode::internal_plugin() { return note_plugin; } +InternalPlugin* NoteNode::internal_plugin(Shared::LV2URIMap& uris) { + return new InternalPlugin(uris, NS_INTERNALS "Note", "note"); +} -NoteNode::NoteNode(BufferFactory& bufs, const string& path, bool polyphonic, PatchImpl* parent, SampleRate srate) - : NodeImpl(¬e_plugin, path, polyphonic, parent, srate) +NoteNode::NoteNode( + InternalPlugin* plugin, + BufferFactory& bufs, + const std::string& path, + bool polyphonic, + PatchImpl* parent, + SampleRate srate) + : NodeImpl(plugin, path, polyphonic, parent, srate) , _voices(new Raul::Array<Voice>(_polyphony)) , _prepared_voices(NULL) , _sustain(false) { - const LV2URIMap& uris = Shared::LV2URIMap::instance(); + const LV2URIMap& uris = bufs.uris(); _ports = new Raul::Array<PortImpl*>(5); + + std::cout << "NEW NOTE NODE" << std::endl; + _midi_in_port = new InputPort(bufs, this, "input", 0, 1, PortType::EVENTS, Raul::Atom()); _midi_in_port->set_property(uris.lv2_name, "Input"); _ports->at(0) = _midi_in_port; diff --git a/src/engine/internals/Note.hpp b/src/engine/internals/Note.hpp index 2866fb01..58b83782 100644 --- a/src/engine/internals/Note.hpp +++ b/src/engine/internals/Note.hpp @@ -40,7 +40,14 @@ namespace Internals { class NoteNode : public NodeImpl { public: - NoteNode(BufferFactory& bufs, const std::string& path, bool polyphonic, PatchImpl* parent, SampleRate srate); + NoteNode( + InternalPlugin* plugin, + BufferFactory& bufs, + const std::string& path, + bool polyphonic, + PatchImpl* parent, + SampleRate srate); + ~NoteNode(); bool prepare_poly(BufferFactory& bufs, uint32_t poly); @@ -55,7 +62,7 @@ public: void sustain_on(ProcessContext& context, FrameTime time); void sustain_off(ProcessContext& context, FrameTime time); - static InternalPlugin& internal_plugin(); + static InternalPlugin* internal_plugin(Shared::LV2URIMap& uris); private: /** Key, one for each key on the keyboard */ diff --git a/src/engine/internals/Trigger.cpp b/src/engine/internals/Trigger.cpp index ed3b2d90..5fa78774 100644 --- a/src/engine/internals/Trigger.cpp +++ b/src/engine/internals/Trigger.cpp @@ -39,15 +39,21 @@ namespace Internals { using namespace Shared; -static InternalPlugin trigger_plugin(NS_INTERNALS "Trigger", "trigger"); - -InternalPlugin& TriggerNode::internal_plugin() { return trigger_plugin; } +InternalPlugin* TriggerNode::internal_plugin(Shared::LV2URIMap& uris) { + return new InternalPlugin(uris, NS_INTERNALS "Trigger", "trigger"); +} -TriggerNode::TriggerNode(BufferFactory& bufs, const string& path, bool polyphonic, PatchImpl* parent, SampleRate srate) - : NodeImpl(&trigger_plugin, path, false, parent, srate) +TriggerNode::TriggerNode( + InternalPlugin* plugin, + BufferFactory& bufs, + const std::string& path, + bool polyphonic, + PatchImpl* parent, + SampleRate srate) + : NodeImpl(plugin, path, false, parent, srate) , _learning(false) { - const LV2URIMap& uris = LV2URIMap::instance(); + const LV2URIMap& uris = bufs.uris(); _ports = new Raul::Array<PortImpl*>(5); _midi_in_port = new InputPort(bufs, this, "input", 0, 1, PortType::EVENTS, Raul::Atom()); diff --git a/src/engine/internals/Trigger.hpp b/src/engine/internals/Trigger.hpp index 5513f6d8..a9c55deb 100644 --- a/src/engine/internals/Trigger.hpp +++ b/src/engine/internals/Trigger.hpp @@ -43,7 +43,13 @@ namespace Internals { class TriggerNode : public NodeImpl { public: - TriggerNode(BufferFactory& bufs, const std::string& path, bool polyphonic, PatchImpl* parent, SampleRate srate); + TriggerNode( + InternalPlugin* plugin, + BufferFactory& bufs, + const std::string& path, + bool polyphonic, + PatchImpl* parent, + SampleRate srate); void process(ProcessContext& context); @@ -52,7 +58,7 @@ public: void learn() { _learning = true; } - static InternalPlugin& internal_plugin(); + static InternalPlugin* internal_plugin(Shared::LV2URIMap& uris); private: bool _learning; |