diff options
author | David Robillard <d@drobilla.net> | 2011-10-06 17:51:43 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2011-10-06 17:51:43 +0000 |
commit | bb12144cbfb8c06f502ce0f963edefbb6009aea9 (patch) | |
tree | 0fb098b714256e3f4fe8148d2893715de4f749bc /src/server/events | |
parent | 5994178571afa3483d2a52ce78646d4161153ea5 (diff) | |
download | ingen-bb12144cbfb8c06f502ce0f963edefbb6009aea9.tar.gz ingen-bb12144cbfb8c06f502ce0f963edefbb6009aea9.tar.bz2 ingen-bb12144cbfb8c06f502ce0f963edefbb6009aea9.zip |
Use an intrusive linked list for InputPort connections.
This simplifies the code and avoids the overhead of allocating list nodes.
git-svn-id: http://svn.drobilla.net/lad/trunk/ingen@3532 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src/server/events')
-rw-r--r-- | src/server/events/Connect.cpp | 20 | ||||
-rw-r--r-- | src/server/events/Connect.hpp | 3 | ||||
-rw-r--r-- | src/server/events/Disconnect.cpp | 7 |
3 files changed, 9 insertions, 21 deletions
diff --git a/src/server/events/Connect.cpp b/src/server/events/Connect.cpp index 39438d43..edd004c3 100644 --- a/src/server/events/Connect.cpp +++ b/src/server/events/Connect.cpp @@ -56,7 +56,6 @@ Connect::Connect(Engine& engine, , _src_output_port(NULL) , _dst_input_port(NULL) , _compiled_patch(NULL) - , _port_listnode(NULL) , _buffers(NULL) {} @@ -129,8 +128,6 @@ Connect::pre_process() _connection = SharedPtr<ConnectionImpl>( new ConnectionImpl(*_engine.buffer_factory(), _src_output_port, _dst_input_port)); - _port_listnode = new InputPort::Connections::Node(_connection); - rlock.release(); { @@ -149,13 +146,9 @@ Connect::pre_process() _dst_input_port->increment_num_connections(); } - /*if ((_dst_input_port->num_connections() == 1 - && (_connection->must_mix() || _connection->must_queue())) - || _dst_input_port->num_connections() == 2) {*/ - _buffers = new Raul::Array<BufferFactory::Ref>(_dst_input_port->poly()); - _dst_input_port->get_buffers(*_engine.buffer_factory(), - _buffers, _dst_input_port->poly()); - //} + _buffers = new Raul::Array<BufferFactory::Ref>(_dst_input_port->poly()); + _dst_input_port->get_buffers(*_engine.buffer_factory(), + _buffers, _dst_input_port->poly()); if (_patch->enabled()) _compiled_patch = _patch->compile(); @@ -170,12 +163,9 @@ Connect::execute(ProcessContext& context) if (_error == NO_ERROR) { // This must be inserted here, since they're actually used by the audio thread - _dst_input_port->add_connection(_port_listnode); + _dst_input_port->add_connection(_connection.get()); assert(_buffers); - //if (_buffers) - _engine.maid()->push(_dst_input_port->set_buffers(_buffers)); - //else - // _dst_input_port->setup_buffers(*_engine.buffer_factory(), _dst_input_port->poly()); + _engine.maid()->push(_dst_input_port->set_buffers(_buffers)); _dst_input_port->connect_buffers(); _engine.maid()->push(_patch->compiled_patch()); _patch->compiled_patch(_compiled_patch); diff --git a/src/server/events/Connect.hpp b/src/server/events/Connect.hpp index d250b791..edb1344c 100644 --- a/src/server/events/Connect.hpp +++ b/src/server/events/Connect.hpp @@ -79,8 +79,7 @@ private: CompiledPatch* _compiled_patch; ///< New process order for Patch - SharedPtr<ConnectionImpl> _connection; - InputPort::Connections::Node* _port_listnode; + SharedPtr<ConnectionImpl> _connection; Raul::Array<BufferFactory::Ref>* _buffers; }; diff --git a/src/server/events/Disconnect.cpp b/src/server/events/Disconnect.cpp index c55ae1ae..c089fb11 100644 --- a/src/server/events/Disconnect.cpp +++ b/src/server/events/Disconnect.cpp @@ -185,9 +185,9 @@ Disconnect::Impl::execute(ProcessContext& context, bool set_dst_buffers) { ThreadManager::assert_thread(THREAD_PROCESS); - InputPort::Connections::Node* const port_connections_node + ConnectionImpl* const port_connection = _dst_input_port->remove_connection(context, _src_output_port); - if (!port_connections_node) { + if (!port_connection) { return false; } @@ -204,9 +204,8 @@ Disconnect::Impl::execute(ProcessContext& context, bool set_dst_buffers) } assert(_connection); - assert(port_connections_node->elem() == _connection); + assert(port_connection == _connection.get()); - _engine.maid()->push(port_connections_node); return true; } |