diff options
Diffstat (limited to 'src/libs/engine/events')
-rw-r--r-- | src/libs/engine/events/AddNodeEvent.cpp | 25 | ||||
-rw-r--r-- | src/libs/engine/events/AddNodeEvent.h | 13 |
2 files changed, 29 insertions, 9 deletions
diff --git a/src/libs/engine/events/AddNodeEvent.cpp b/src/libs/engine/events/AddNodeEvent.cpp index 19ff6bf5..6e42ef82 100644 --- a/src/libs/engine/events/AddNodeEvent.cpp +++ b/src/libs/engine/events/AddNodeEvent.cpp @@ -33,7 +33,7 @@ namespace Ingen { -AddNodeEvent::AddNodeEvent(Engine& engine, CountedPtr<Responder> responder, SampleCount timestamp, const string& path, Plugin* plugin, bool poly) +/*AddNodeEvent::AddNodeEvent(Engine& engine, CountedPtr<Responder> responder, SampleCount timestamp, const string& path, Plugin* plugin, bool poly) : QueuedEvent(engine, responder, timestamp), m_path(path), m_plugin(plugin), @@ -43,12 +43,24 @@ AddNodeEvent::AddNodeEvent(Engine& engine, CountedPtr<Responder> responder, Samp m_process_order(NULL), m_node_already_exists(false) { +}*/ + +AddNodeEvent::AddNodeEvent(Engine& engine, CountedPtr<Responder> responder, SampleCount timestamp, const string& path, + const string& plugin_uri, bool poly) +: QueuedEvent(engine, responder, timestamp), + m_path(path), + m_plugin_uri(plugin_uri), + m_poly(poly), + m_patch(NULL), + m_node(NULL), + m_process_order(NULL), + m_node_already_exists(false) +{ } AddNodeEvent::~AddNodeEvent() { - delete m_plugin; } @@ -62,12 +74,13 @@ AddNodeEvent::pre_process() } m_patch = _engine.object_store()->find_patch(m_path.parent()); + const Plugin* plugin = _engine.node_factory()->plugin(m_plugin_uri); - if (m_patch != NULL) { + if (m_patch && plugin) { if (m_poly) - m_node = _engine.node_factory()->load_plugin(m_plugin, m_path.name(), m_patch->internal_poly(), m_patch); + m_node = _engine.node_factory()->load_plugin(plugin, m_path.name(), m_patch->internal_poly(), m_patch); else - m_node = _engine.node_factory()->load_plugin(m_plugin, m_path.name(), 1, m_patch); + m_node = _engine.node_factory()->load_plugin(plugin, m_path.name(), 1, m_patch); if (m_node != NULL) { m_node->activate(); @@ -113,7 +126,7 @@ AddNodeEvent::post_process() } else if (m_node == NULL) { msg = "Unable to load node "; msg.append(m_path).append(" (you're missing the plugin \"").append( - m_plugin->uri()); + m_plugin_uri); _responder->respond_error(msg); } else { _responder->respond_ok(); diff --git a/src/libs/engine/events/AddNodeEvent.h b/src/libs/engine/events/AddNodeEvent.h index c7616c2b..b4345f90 100644 --- a/src/libs/engine/events/AddNodeEvent.h +++ b/src/libs/engine/events/AddNodeEvent.h @@ -39,7 +39,14 @@ class Plugin; class AddNodeEvent : public QueuedEvent { public: - AddNodeEvent(Engine& engine, CountedPtr<Responder> responder, SampleCount timestamp, const string& path, Plugin* plugin, bool poly); + //AddNodeEvent(Engine& engine, CountedPtr<Responder> responder, SampleCount timestamp, const string& path, Plugin* plugin, bool poly); + AddNodeEvent(Engine& engine, + CountedPtr<Responder> responder, + SampleCount timestamp, + const string& node_path, + const string& plugin_uri, + bool poly); + ~AddNodeEvent(); void pre_process(); @@ -49,11 +56,11 @@ public: private: string m_patch_name; Path m_path; - Plugin* m_plugin; + string m_plugin_uri; bool m_poly; Patch* m_patch; Node* m_node; - Array<Node*>* m_process_order; // Patch's new process order + Array<Node*>* m_process_order; ///< Patch's new process order bool m_node_already_exists; }; |