From bb12144cbfb8c06f502ce0f963edefbb6009aea9 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Thu, 6 Oct 2011 17:51:43 +0000 Subject: 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 --- src/server/ConnectionImpl.cpp | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) (limited to 'src/server/ConnectionImpl.cpp') diff --git a/src/server/ConnectionImpl.cpp b/src/server/ConnectionImpl.cpp index 49c45f43..9bb0d4f5 100644 --- a/src/server/ConnectionImpl.cpp +++ b/src/server/ConnectionImpl.cpp @@ -66,6 +66,18 @@ ConnectionImpl::dump() const << "POLY: " << _src_port->poly() << " => " << _dst_port->poly() << endl; } +const Raul::Path& +ConnectionImpl::src_port_path() const +{ + return _src_port->path(); +} + +const Raul::Path& +ConnectionImpl::dst_port_path() const +{ + return _dst_port->path(); +} + void ConnectionImpl::get_sources(Context& context, uint32_t voice, boost::intrusive_ptr* srcs, uint32_t max_num_srcs, uint32_t& num_srcs) @@ -119,6 +131,31 @@ ConnectionImpl::queue(Context& context) } } +BufferFactory::Ref +ConnectionImpl::buffer(uint32_t voice) const +{ + assert(!must_mix()); + assert(!must_queue()); + assert(_src_port->poly() == 1 || _src_port->poly() > voice); + if (_src_port->poly() == 1) { + return _src_port->buffer(0); + } else { + return _src_port->buffer(voice); + } +} + +bool +ConnectionImpl::must_mix() const +{ + return _src_port->poly() > _dst_port->poly(); +} + +bool +ConnectionImpl::must_queue() const +{ + return _src_port->context() != _dst_port->context(); +} + bool ConnectionImpl::can_connect(const OutputPort* src, const InputPort* dst) { -- cgit v1.2.1