From 46e5de590817756b21a7a5d99bd4963df343f455 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Sat, 20 Feb 2010 21:52:36 +0000 Subject: Heavy overhaul of buffer management and polyphony. * Working polyphony when nodes are instantiated at desired polyphony level (dynamic still doesn't work) * Use shared silent buffer for disconnected audio inputs (save memory) * Eliminate redundant patch compiling on delete and disconnect-all events that have child events * Fix a ton of crash bugs and other issues I've since forgotten git-svn-id: http://svn.drobilla.net/lad/trunk/ingen@2468 a436a847-0d15-0410-975c-d299462d15a1 --- src/engine/events/DisconnectAll.cpp | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) (limited to 'src/engine/events/DisconnectAll.cpp') diff --git a/src/engine/events/DisconnectAll.cpp b/src/engine/events/DisconnectAll.cpp index af577199..56bef36a 100644 --- a/src/engine/events/DisconnectAll.cpp +++ b/src/engine/events/DisconnectAll.cpp @@ -48,8 +48,9 @@ DisconnectAll::DisconnectAll(Engine& engine, SharedPtr request, SampleC , _parent(NULL) , _node(NULL) , _port(NULL) - , _lookup(true) + , _compiled_patch(NULL) , _error(NO_ERROR) + , _deleting(false) { } @@ -63,8 +64,9 @@ DisconnectAll::DisconnectAll(Engine& engine, PatchImpl* parent, GraphObjectImpl* , _parent(parent) , _node(dynamic_cast(object)) , _port(dynamic_cast(object)) - , _lookup(false) + , _compiled_patch(NULL) , _error(NO_ERROR) + , _deleting(true) { } @@ -79,7 +81,7 @@ DisconnectAll::~DisconnectAll() void DisconnectAll::pre_process() { - if (_lookup) { + if (!_deleting) { _parent = _engine.engine_store()->find_patch(_parent_path); if (_parent == NULL) { @@ -113,10 +115,11 @@ DisconnectAll::pre_process() for (PatchImpl::Connections::const_iterator i = _parent->connections().begin(); i != _parent->connections().end(); ++i) { ConnectionImpl* c = (ConnectionImpl*)i->get(); + const bool reconnect_input = !_deleting || (c->dst_port()->parent_node() != _node); if ((c->src_port()->parent_node() == _node || c->dst_port()->parent_node() == _node) && !c->pending_disconnection()) { Disconnect* ev = new Disconnect(_engine, - SharedPtr(), _time, c->src_port(), c->dst_port()); + SharedPtr(), _time, c->src_port(), c->dst_port(), reconnect_input); ev->pre_process(); _disconnect_events.push_back(new Raul::List::Node(ev)); c->pending_disconnection(true); @@ -126,9 +129,10 @@ DisconnectAll::pre_process() for (PatchImpl::Connections::const_iterator i = _parent->connections().begin(); i != _parent->connections().end(); ++i) { ConnectionImpl* c = (ConnectionImpl*)i->get(); + const bool reconnect_input = !_deleting || (c->dst_port()->parent_node() != _node); if ((c->src_port() == _port || c->dst_port() == _port) && !c->pending_disconnection()) { Disconnect* ev = new Disconnect(_engine, - SharedPtr(), _time, c->src_port(), c->dst_port()); + SharedPtr(), _time, c->src_port(), c->dst_port(), reconnect_input); ev->pre_process(); _disconnect_events.push_back(new Raul::List::Node(ev)); c->pending_disconnection(true); @@ -136,6 +140,9 @@ DisconnectAll::pre_process() } } + if (!_deleting && _parent->enabled()) + _compiled_patch = _parent->compile(); + QueuedEvent::pre_process(); } @@ -146,9 +153,13 @@ DisconnectAll::execute(ProcessContext& context) QueuedEvent::execute(context); if (_error == NO_ERROR) { - for (Raul::List::iterator i = _disconnect_events.begin(); i != _disconnect_events.end(); ++i) + for (Raul::List::iterator i = _disconnect_events.begin(); + i != _disconnect_events.end(); ++i) (*i)->execute(context); } + + _engine.maid()->push(_parent->compiled_patch()); + _parent->compiled_patch(_compiled_patch); } -- cgit v1.2.1