summaryrefslogtreecommitdiffstats
path: root/src/libs/engine/events
diff options
context:
space:
mode:
Diffstat (limited to 'src/libs/engine/events')
-rw-r--r--src/libs/engine/events/AddPortEvent.cpp9
-rw-r--r--src/libs/engine/events/CreatePatchEvent.cpp14
-rw-r--r--src/libs/engine/events/DestroyEvent.cpp15
-rw-r--r--src/libs/engine/events/DestroyEvent.h1
4 files changed, 22 insertions, 17 deletions
diff --git a/src/libs/engine/events/AddPortEvent.cpp b/src/libs/engine/events/AddPortEvent.cpp
index aa7c3ca5..bdce9267 100644
--- a/src/libs/engine/events/AddPortEvent.cpp
+++ b/src/libs/engine/events/AddPortEvent.cpp
@@ -106,8 +106,8 @@ AddPortEvent::pre_process()
_ports_array = new Array<Port*>(old_num_ports + 1, NULL);
- _ports_array->at(_patch->num_ports()) = _patch_port;
- _engine.object_store()->add(_patch_port);
+ _ports_array->at(_patch->num_ports()-1) = _patch_port;
+ _patch_port->add_to_store(_engine.object_store());
if (!_patch->parent()) {
if (_type == "ingen:audio")
@@ -118,8 +118,9 @@ AddPortEvent::pre_process()
dynamic_cast<DuplexPort<MidiMessage>*>(_patch_port));
}
- assert(_patch->num_ports() == old_num_ports);
- assert(_ports_array->size() == _patch->num_ports() + 1);
+ assert(_ports_array->size() == _patch->num_ports());
+
+
}
}
QueuedEvent::pre_process();
diff --git a/src/libs/engine/events/CreatePatchEvent.cpp b/src/libs/engine/events/CreatePatchEvent.cpp
index 9124f280..73813dbb 100644
--- a/src/libs/engine/events/CreatePatchEvent.cpp
+++ b/src/libs/engine/events/CreatePatchEvent.cpp
@@ -45,7 +45,7 @@ CreatePatchEvent::CreatePatchEvent(Engine& engine, SharedPtr<Responder> responde
void
CreatePatchEvent::pre_process()
{
- if (_engine.object_store()->find(m_path) != NULL) {
+ if (m_path == "/" || _engine.object_store()->find(m_path) != NULL) {
m_error = OBJECT_EXISTS;
QueuedEvent::pre_process();
return;
@@ -57,13 +57,11 @@ CreatePatchEvent::pre_process()
return;
}
- if (m_path != "/") {
- m_parent = _engine.object_store()->find_patch(m_path.parent());
- if (m_parent == NULL) {
- m_error = PARENT_NOT_FOUND;
- QueuedEvent::pre_process();
- return;
- }
+ m_parent = _engine.object_store()->find_patch(m_path.parent());
+ if (m_parent == NULL) {
+ m_error = PARENT_NOT_FOUND;
+ QueuedEvent::pre_process();
+ return;
}
size_t poly = 1;
diff --git a/src/libs/engine/events/DestroyEvent.cpp b/src/libs/engine/events/DestroyEvent.cpp
index 9801f0fe..26902697 100644
--- a/src/libs/engine/events/DestroyEvent.cpp
+++ b/src/libs/engine/events/DestroyEvent.cpp
@@ -43,6 +43,7 @@ DestroyEvent::DestroyEvent(Engine& engine, SharedPtr<Responder> responder, Frame
_patch_node_listnode(NULL),
_patch_port_listnode(NULL),
_store_treenode(NULL),
+ _ports_array(NULL),
_process_order(NULL),
_disconnect_node_event(NULL),
_disconnect_port_event(NULL)
@@ -60,6 +61,7 @@ DestroyEvent::DestroyEvent(Engine& engine, SharedPtr<Responder> responder, Frame
_patch_node_listnode(NULL),
_patch_port_listnode(NULL),
_store_treenode(NULL),
+ _ports_array(NULL),
_process_order(NULL),
_disconnect_node_event(NULL),
_disconnect_port_event(NULL)
@@ -131,11 +133,8 @@ DestroyEvent::pre_process()
if (_port->parent_patch()->enabled()) {
// FIXME: is this called multiple times?
_process_order = _port->parent_patch()->build_process_order();
- // Remove port to be removed from the process order so it isn't executed by
- // Patch::run and can safely be destroyed
- //for (size_t i=0; i < _process_order->size(); ++i)
- // if (_process_order->at(i) == _port)
- // _process_order->at(i) = NULL; // ew, gap
+ _ports_array = _port->parent_patch()->build_ports_array();
+ assert(_ports_array->size() == _port->parent_patch()->num_ports());
}
}
@@ -168,7 +167,13 @@ DestroyEvent::execute(SampleCount nframes, FrameTime start, FrameTime end)
if (_port->parent_patch()->process_order() != NULL)
_engine.maid()->push(_port->parent_patch()->process_order());
+
_port->parent_patch()->process_order(_process_order);
+
+ if (_port->parent_patch()->external_ports() != NULL)
+ _engine.maid()->push(_port->parent_patch()->external_ports());
+
+ _port->parent_patch()->external_ports(_ports_array);
}
}
diff --git a/src/libs/engine/events/DestroyEvent.h b/src/libs/engine/events/DestroyEvent.h
index ad67bbca..6dfebbf7 100644
--- a/src/libs/engine/events/DestroyEvent.h
+++ b/src/libs/engine/events/DestroyEvent.h
@@ -61,6 +61,7 @@ private:
ListNode<Node*>* _patch_node_listnode;
ListNode<Port*>* _patch_port_listnode;
TreeNode<GraphObject*>* _store_treenode;
+ Array<Port*>* _ports_array; ///< New (external) ports array for Patch
Array<Node*>* _process_order; ///< Patch's new process order
DisconnectNodeEvent* _disconnect_node_event;
DisconnectPortEvent* _disconnect_port_event;