summaryrefslogtreecommitdiffstats
path: root/src/libs
diff options
context:
space:
mode:
Diffstat (limited to 'src/libs')
-rw-r--r--src/libs/client/Store.cpp14
-rw-r--r--src/libs/engine/Patch.cpp22
-rw-r--r--src/libs/engine/events/DestroyEvent.cpp9
-rw-r--r--src/libs/engine/events/DisconnectPortEvent.cpp7
-rw-r--r--src/libs/engine/events/DisconnectPortEvent.hpp2
5 files changed, 28 insertions, 26 deletions
diff --git a/src/libs/client/Store.cpp b/src/libs/client/Store.cpp
index f5cead13..75eb943b 100644
--- a/src/libs/client/Store.cpp
+++ b/src/libs/client/Store.cpp
@@ -555,13 +555,15 @@ Store::disconnection_event(const Path& src_port_path, const Path& dst_port_path)
SharedPtr<PortModel> src_port = PtrCast<PortModel>(object(src_port_path));
SharedPtr<PortModel> dst_port = PtrCast<PortModel>(object(dst_port_path));
- assert(src_port);
- assert(dst_port);
+ if (src_port)
+ src_port->disconnected_from(dst_port);
+ else
+ cerr << "WARNING: Disconnection from nonexistant src port " << src_port_path << endl;
- src_port->disconnected_from(dst_port);
- dst_port->disconnected_from(src_port);
-
- SharedPtr<ConnectionModel> cm(new ConnectionModel(src_port, dst_port));
+ if (dst_port)
+ dst_port->disconnected_from(dst_port);
+ else
+ cerr << "WARNING: Disconnection from nonexistant dst port " << dst_port_path << endl;
SharedPtr<PatchModel> patch = connection_patch(src_port_path, dst_port_path);
diff --git a/src/libs/engine/Patch.cpp b/src/libs/engine/Patch.cpp
index 78184a82..09c638e9 100644
--- a/src/libs/engine/Patch.cpp
+++ b/src/libs/engine/Patch.cpp
@@ -119,26 +119,22 @@ Patch::process(SampleCount nframes, FrameTime start, FrameTime end)
return;
/* Prepare input ports */
+ /* FIXME: Pre-processing input ports breaks MIDI somehow? */
+ if (_ports)
+ for (size_t i=0; i < _ports->size(); ++i)
+ if (_ports->at(i)->is_output())
+ _ports->at(i)->pre_process(nframes, start, end);
- // FIXME: This breaks MIDI input, somehow? OK disabled?
- //for (Raul::List<Port*>::iterator i = _input_ports.begin(); i != _input_ports.end(); ++i)
- // (*i)->pre_process(nframes, start, end);
- for (Raul::List<Port*>::iterator i = _output_ports.begin(); i != _output_ports.end(); ++i)
- (*i)->pre_process(nframes, start, end);
-
-
+ /* Run */
if (_engine.process_slaves().size() > 0)
process_parallel(nframes, start, end);
else
process_single(nframes, start, end);
-
/* Write output ports */
-
- for (Raul::List<Port*>::iterator i = _input_ports.begin(); i != _input_ports.end(); ++i)
- (*i)->post_process(nframes, start, end);
- for (Raul::List<Port*>::iterator i = _output_ports.begin(); i != _output_ports.end(); ++i)
- (*i)->post_process(nframes, start, end);
+ if (_ports)
+ for (size_t i=0; i < _ports->size(); ++i)
+ _ports->at(i)->post_process(nframes, start, end);
}
diff --git a/src/libs/engine/events/DestroyEvent.cpp b/src/libs/engine/events/DestroyEvent.cpp
index 91823a79..ba4da6ec 100644
--- a/src/libs/engine/events/DestroyEvent.cpp
+++ b/src/libs/engine/events/DestroyEvent.cpp
@@ -137,7 +137,7 @@ DestroyEvent::pre_process()
//_port->remove_from_store();
- _disconnect_port_event = new DisconnectPortEvent(_engine, _port);
+ _disconnect_port_event = new DisconnectPortEvent(_engine, _port->parent_patch(), _port);
_disconnect_port_event->pre_process();
if (_port->parent_patch()->enabled()) {
@@ -185,9 +185,10 @@ DestroyEvent::execute(SampleCount nframes, FrameTime start, FrameTime end)
_port->parent_patch()->external_ports(_ports_array);
- if (!_port->parent_patch()->parent()) {
- _driver_port = _engine.audio_driver()->remove_port(_port->path());
- if (!_driver_port)
+ if ( ! _port->parent_patch()->parent()) {
+ if (_port->type() == DataType::FLOAT)
+ _driver_port = _engine.audio_driver()->remove_port(_port->path());
+ else if (_port->type() == DataType::MIDI)
_driver_port = _engine.midi_driver()->remove_port(_port->path());
}
}
diff --git a/src/libs/engine/events/DisconnectPortEvent.cpp b/src/libs/engine/events/DisconnectPortEvent.cpp
index 75f44e9f..6aa5a265 100644
--- a/src/libs/engine/events/DisconnectPortEvent.cpp
+++ b/src/libs/engine/events/DisconnectPortEvent.cpp
@@ -51,10 +51,10 @@ DisconnectPortEvent::DisconnectPortEvent(Engine& engine, SharedPtr<Responder> re
}
-DisconnectPortEvent::DisconnectPortEvent(Engine& engine, Port* port)
+DisconnectPortEvent::DisconnectPortEvent(Engine& engine, Patch* patch, Port* port)
: QueuedEvent(engine),
_port_path(port->path()),
- _patch((port->parent_node() == NULL) ? NULL : port->parent_node()->parent_patch()),
+ _patch(patch),
_port(port),
_process_order(NULL),
_succeeded(true),
@@ -77,6 +77,9 @@ DisconnectPortEvent::pre_process()
// cerr << "Preparing disconnection event...\n";
if (_lookup) {
+
+ /* FIXME: Double lookup */
+
_patch = _engine.object_store()->find_patch(_port_path.parent().parent());
if (_patch == NULL) {
diff --git a/src/libs/engine/events/DisconnectPortEvent.hpp b/src/libs/engine/events/DisconnectPortEvent.hpp
index 2ce91b85..8fa9e25b 100644
--- a/src/libs/engine/events/DisconnectPortEvent.hpp
+++ b/src/libs/engine/events/DisconnectPortEvent.hpp
@@ -45,7 +45,7 @@ class DisconnectPortEvent : public QueuedEvent
{
public:
DisconnectPortEvent(Engine& engine, SharedPtr<Responder> responder, SampleCount timestamp, const string& port_path);
- DisconnectPortEvent(Engine& engine, Port* port);
+ DisconnectPortEvent(Engine& engine, Patch* patch, Port* port);
~DisconnectPortEvent();
void pre_process();