diff options
Diffstat (limited to 'src/libs/engine')
-rw-r--r-- | src/libs/engine/Makefile.am | 28 | ||||
-rw-r--r-- | src/libs/engine/events/ConnectionEvent.cpp | 16 | ||||
-rw-r--r-- | src/libs/engine/events/ConnectionEvent.h | 1 | ||||
-rw-r--r-- | src/libs/engine/events/DisconnectionEvent.cpp | 113 | ||||
-rw-r--r-- | src/libs/engine/events/DisconnectionEvent.h | 1 |
5 files changed, 74 insertions, 85 deletions
diff --git a/src/libs/engine/Makefile.am b/src/libs/engine/Makefile.am index 322b5933..889f98fd 100644 --- a/src/libs/engine/Makefile.am +++ b/src/libs/engine/Makefile.am @@ -5,9 +5,9 @@ AM_CXXFLAGS = @JACK_CFLAGS@ @LOSC_CFLAGS@ @ALSA_CFLAGS@ @LASH_CFLAGS@ @SLV2_CFLA MAINTAINERCLEANFILES = Makefile.in -noinst_LTLIBRARIES = libom.la +noinst_LTLIBRARIES = libingen.la -libom_la_SOURCES = \ +libingen_la_SOURCES = \ util.h \ tuning.h \ DataType.h \ @@ -88,12 +88,12 @@ libom_la_SOURCES = \ AudioDriver.h \ MidiDriver.h \ midi.h \ - ../libom_la/util/Semaphore.h \ - ../libom_la/util/types.h \ - ../libom_la/util/Path.h \ - ../libom_la/util/Queue.h \ - ../libom_la/interface/ClientInterface.h \ - ../libom_la/interface/EngineInterface.h \ + ../libingen_la/util/Semaphore.h \ + ../libingen_la/util/types.h \ + ../libingen_la/util/Path.h \ + ../libingen_la/util/Queue.h \ + ../libingen_la/interface/ClientInterface.h \ + ../libingen_la/interface/EngineInterface.h \ instantiations.cpp \ events/RegisterClientEvent.h \ events/RegisterClientEvent.cpp \ @@ -169,25 +169,25 @@ libom_la_SOURCES = \ # MidiOutputNode.cpp if WITH_JACK_MIDI -libom_la_SOURCES += \ +libingen_la_SOURCES += \ JackMidiDriver.h \ JackMidiDriver.cpp endif if WITH_ALSA_MIDI -libom_la_SOURCES += \ +libingen_la_SOURCES += \ AlsaMidiDriver.h \ AlsaMidiDriver.cpp endif if WITH_LADSPA -libom_la_SOURCES += \ +libingen_la_SOURCES += \ LADSPANode.h \ LADSPANode.cpp endif if WITH_DSSI -libom_la_SOURCES += \ +libingen_la_SOURCES += \ DSSINode.h \ DSSINode.cpp \ events/DSSIConfigureEvent.cpp \ @@ -201,13 +201,13 @@ libom_la_SOURCES += \ endif if WITH_LV2 -libom_la_SOURCES += \ +libingen_la_SOURCES += \ LV2Node.h \ LV2Node.cpp endif if WITH_LASH -libom_la_SOURCES += \ +libingen_la_SOURCES += \ LashDriver.h \ LashDriver.cpp \ LashRestoreDoneEvent.h diff --git a/src/libs/engine/events/ConnectionEvent.cpp b/src/libs/engine/events/ConnectionEvent.cpp index 1182c723..aedfd881 100644 --- a/src/libs/engine/events/ConnectionEvent.cpp +++ b/src/libs/engine/events/ConnectionEvent.cpp @@ -164,19 +164,17 @@ TypedConnectionEvent<T>::TypedConnectionEvent(CountedPtr<Responder> responder, O assert(dst_port != NULL); } -template <typename T> -TypedConnectionEvent<T>::~TypedConnectionEvent() -{ - // FIXME: haaaack, prevent a double delete - // this class is unusable by anything other than ConnectionEvent because of this - //m_responder = NULL; -} - template <typename T> void TypedConnectionEvent<T>::pre_process() -{ +{ + if (m_dst_port->is_connected_to(m_src_port)) { + m_succeeded = false; + QueuedEvent::pre_process(); + return; + } + Node* const src_node = m_src_port->parent_node(); Node* const dst_node = m_dst_port->parent_node(); diff --git a/src/libs/engine/events/ConnectionEvent.h b/src/libs/engine/events/ConnectionEvent.h index 2d2e0c92..23bedcef 100644 --- a/src/libs/engine/events/ConnectionEvent.h +++ b/src/libs/engine/events/ConnectionEvent.h @@ -81,7 +81,6 @@ class TypedConnectionEvent : public QueuedEvent { public: TypedConnectionEvent(CountedPtr<Responder> responder, OutputPort<T>* src_port, InputPort<T>* dst_port); - ~TypedConnectionEvent(); void pre_process(); void execute(samplecount offset); diff --git a/src/libs/engine/events/DisconnectionEvent.cpp b/src/libs/engine/events/DisconnectionEvent.cpp index 04193c6c..f3524500 100644 --- a/src/libs/engine/events/DisconnectionEvent.cpp +++ b/src/libs/engine/events/DisconnectionEvent.cpp @@ -78,61 +78,63 @@ void DisconnectionEvent::pre_process() { if (m_lookup) { - if (m_src_port_path.parent().parent() != m_dst_port_path.parent().parent()) { + if (m_src_port_path.parent().parent() != m_dst_port_path.parent().parent() + && m_src_port_path.parent() != m_dst_port_path.parent().parent() + && m_src_port_path.parent().parent() != m_dst_port_path.parent()) { m_error = PARENT_PATCH_DIFFERENT; QueuedEvent::pre_process(); return; } - + /*m_patch = om->object_store()->find_patch(m_src_port_path.parent().parent()); - - if (m_patch == NULL) { - m_error = PORT_NOT_FOUND; - QueuedEvent::pre_process(); - return; - }*/ - - Port* port1 = om->object_store()->find_port(m_src_port_path); - Port* port2 = om->object_store()->find_port(m_dst_port_path); - - if (port1 == NULL || port2 == NULL) { + + if (m_patch == NULL) { + m_error = PORT_NOT_FOUND; + QueuedEvent::pre_process(); + return; + }*/ + + 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 (port1->type() != port2->type()) { + + 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; + + /*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; } } - - // 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; - } m_typed_event->pre_process(); @@ -157,7 +159,7 @@ DisconnectionEvent::post_process() m_typed_event->post_process(); } else { // FIXME: better error messages - string msg = "Unable to make connection "; + string msg = "Unable to disconnect "; msg.append(m_src_port_path + " -> " + m_dst_port_path); m_responder->respond_error(msg); } @@ -181,14 +183,6 @@ TypedDisconnectionEvent<T>::TypedDisconnectionEvent(CountedPtr<Responder> respon assert(dst_port != NULL); } -template <typename T> -TypedDisconnectionEvent<T>::~TypedDisconnectionEvent() -{ - // FIXME: haaaack, prevent a double delete - // this class is unusable by anything other than DisconnectionEvent because of this - //m_responder = NULL; -} - template <typename T> void @@ -202,8 +196,20 @@ TypedDisconnectionEvent<T>::pre_process() Node* const src_node = m_src_port->parent_node(); Node* const dst_node = m_dst_port->parent_node(); - - m_patch = src_node->parent_patch(); + if (src_node->parent_patch() != dst_node->parent_patch()) { + // Connection to a patch port from inside the patch + assert(src_node->parent() == dst_node || dst_node->parent() == src_node); + if (src_node->parent() == dst_node) + m_patch = dynamic_cast<Patch*>(dst_node); + else + m_patch = dynamic_cast<Patch*>(src_node); + } else { + // Normal connection between nodes with the same parent + m_patch = src_node->parent_patch(); + } + + assert(m_patch); + assert(m_patch == src_node->parent() || m_patch == dst_node->parent()); if (src_node == NULL || dst_node == NULL) { m_succeeded = false; @@ -211,30 +217,17 @@ TypedDisconnectionEvent<T>::pre_process() return; } - if (src_node->parent() != m_patch || dst_node->parent() != m_patch) { - m_succeeded = false; - QueuedEvent::pre_process(); - return; - } - - bool removed = false; - for (List<Node*>::iterator i = dst_node->providers()->begin(); i != dst_node->providers()->end(); ++i) if ((*i) == src_node) { delete dst_node->providers()->remove(i); - removed = true; break; } - assert(removed); - removed = false; for (List<Node*>::iterator i = src_node->dependants()->begin(); i != src_node->dependants()->end(); ++i) if ((*i) == dst_node) { delete src_node->dependants()->remove(i); - removed = true; break; } - assert(removed); if (m_patch->process()) m_process_order = m_patch->build_process_order(); diff --git a/src/libs/engine/events/DisconnectionEvent.h b/src/libs/engine/events/DisconnectionEvent.h index 6edbc78a..43b2d841 100644 --- a/src/libs/engine/events/DisconnectionEvent.h +++ b/src/libs/engine/events/DisconnectionEvent.h @@ -83,7 +83,6 @@ class TypedDisconnectionEvent : public QueuedEvent { public: TypedDisconnectionEvent(CountedPtr<Responder> responder, OutputPort<T>* src_port, InputPort<T>* dst_port); - ~TypedDisconnectionEvent(); void pre_process(); void execute(samplecount offset); |