summaryrefslogtreecommitdiffstats
path: root/src/libs/engine/events/DisconnectionEvent.cpp
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2006-06-22 06:15:18 +0000
committerDavid Robillard <d@drobilla.net>2006-06-22 06:15:18 +0000
commit9cde7e0c1097cf0aa52113a942a3b88d930568b6 (patch)
treea31aaf4ae7df0e93aaf507b9d5abb16dac55caa7 /src/libs/engine/events/DisconnectionEvent.cpp
parent90013966c14d18c7c55a906c319704bc1ffc4ae9 (diff)
downloadingen-9cde7e0c1097cf0aa52113a942a3b88d930568b6.tar.gz
ingen-9cde7e0c1097cf0aa52113a942a3b88d930568b6.tar.bz2
ingen-9cde7e0c1097cf0aa52113a942a3b88d930568b6.zip
Fix destroying connected nodes;
Partial fix for port default values. git-svn-id: http://svn.drobilla.net/lad/ingen@76 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src/libs/engine/events/DisconnectionEvent.cpp')
-rw-r--r--src/libs/engine/events/DisconnectionEvent.cpp75
1 files changed, 38 insertions, 37 deletions
diff --git a/src/libs/engine/events/DisconnectionEvent.cpp b/src/libs/engine/events/DisconnectionEvent.cpp
index f3524500..f2f54387 100644
--- a/src/libs/engine/events/DisconnectionEvent.cpp
+++ b/src/libs/engine/events/DisconnectionEvent.cpp
@@ -96,48 +96,49 @@ DisconnectionEvent::pre_process()
m_src_port = om->object_store()->find_port(m_src_port_path);
m_dst_port = om->object_store()->find_port(m_dst_port_path);
+ }
+
+ if (m_src_port == NULL || m_dst_port == NULL) {
+ m_error = PORT_NOT_FOUND;
+ QueuedEvent::pre_process();
+ return;
+ }
- if (m_src_port == NULL || m_dst_port == NULL) {
- m_error = PORT_NOT_FOUND;
- QueuedEvent::pre_process();
- return;
- }
-
- if (m_src_port->type() != m_dst_port->type() || m_src_port->buffer_size() != m_dst_port->buffer_size()) {
- m_error = TYPE_MISMATCH;
- QueuedEvent::pre_process();
- return;
- }
-
- /*if (port1->is_output() && port2->is_input()) {
- m_src_port = port1;
- m_dst_port = port2;
- } else if (port2->is_output() && port1->is_input()) {
- m_src_port = port2;
- m_dst_port = port1;
- } else {
- m_error = TYPE_MISMATCH;
- QueuedEvent::pre_process();
- return;
- }*/
+ if (m_src_port->type() != m_dst_port->type() || m_src_port->buffer_size() != m_dst_port->buffer_size()) {
+ m_error = TYPE_MISMATCH;
+ QueuedEvent::pre_process();
+ return;
+ }
- // Create the typed event to actually do the work
- const DataType type = m_src_port->type();
- if (type == DataType::FLOAT) {
- m_typed_event = new TypedDisconnectionEvent<sample>(m_responder,
- dynamic_cast<OutputPort<sample>*>(m_src_port), dynamic_cast<InputPort<sample>*>(m_dst_port));
- } else if (type == DataType::MIDI) {
- m_typed_event = new TypedDisconnectionEvent<MidiMessage>(m_responder,
- dynamic_cast<OutputPort<MidiMessage>*>(m_src_port), dynamic_cast<InputPort<MidiMessage>*>(m_dst_port));
- } else {
- m_error = TYPE_MISMATCH;
- QueuedEvent::pre_process();
- return;
- }
+ /*if (port1->is_output() && port2->is_input()) {
+ m_src_port = port1;
+ m_dst_port = port2;
+ } else if (port2->is_output() && port1->is_input()) {
+ m_src_port = port2;
+ m_dst_port = port1;
+ } else {
+ m_error = TYPE_MISMATCH;
+ QueuedEvent::pre_process();
+ return;
+ }*/
+
+ // Create the typed event to actually do the work
+ const DataType type = m_src_port->type();
+ if (type == DataType::FLOAT) {
+ m_typed_event = new TypedDisconnectionEvent<sample>(m_responder,
+ dynamic_cast<OutputPort<sample>*>(m_src_port), dynamic_cast<InputPort<sample>*>(m_dst_port));
+ } else if (type == DataType::MIDI) {
+ m_typed_event = new TypedDisconnectionEvent<MidiMessage>(m_responder,
+ dynamic_cast<OutputPort<MidiMessage>*>(m_src_port), dynamic_cast<InputPort<MidiMessage>*>(m_dst_port));
+ } else {
+ m_error = TYPE_MISMATCH;
+ QueuedEvent::pre_process();
+ return;
}
+ assert(m_typed_event);
m_typed_event->pre_process();
-
+
QueuedEvent::pre_process();
}