From 52e49500bb78974d43bdfd30b2ec9b2a4522dd25 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Fri, 26 Feb 2010 01:39:16 +0000 Subject: Perform all mixing for an audio input in a single mix operation (instead of a two step polyphony mixdown (by connections) and connections mixdown (by ports)). Speed up and inline AudioBuffer::accumulate, to speed up mix(). Remove local buffer from Connection (always mix into destination InputPort's buffers). git-svn-id: http://svn.drobilla.net/lad/trunk/ingen@2494 a436a847-0d15-0410-975c-d299462d15a1 --- src/engine/ConnectionImpl.hpp | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) (limited to 'src/engine/ConnectionImpl.hpp') diff --git a/src/engine/ConnectionImpl.hpp b/src/engine/ConnectionImpl.hpp index 232d8033..2725dd83 100644 --- a/src/engine/ConnectionImpl.hpp +++ b/src/engine/ConnectionImpl.hpp @@ -20,6 +20,7 @@ #include #include +#include "raul/log.hpp" #include "raul/Deletable.hpp" #include "interface/PortType.hpp" #include "interface/Connection.hpp" @@ -63,11 +64,10 @@ public: bool pending_disconnection() { return _pending_disconnection; } void pending_disconnection(bool b) { _pending_disconnection = b; } - void process(Context& context); void queue(Context& context); - void allocate_buffer(BufferFactory& bufs); - void recycle_buffer() { _local_buffer = NULL; } + void get_sources(Context& context, uint32_t voice, + Buffer** srcs, uint32_t max_num_srcs, uint32_t& num_srcs); /** Get the buffer for a particular voice. * A Connection is smart - it knows the destination port requesting the @@ -75,19 +75,16 @@ public: * voice in a mono->poly connection). */ inline BufferFactory::Ref buffer(uint32_t voice) const { - if (must_mix() || must_queue()) { - return _local_buffer; - } else if (_src_port->poly() == 1) { + 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); } } - void update_buffer_size(Context& context, BufferFactory& bufs); - void prepare_poly(BufferFactory& bufs, uint32_t poly); - void apply_poly(Raul::Maid& maid, uint32_t poly); - /** Returns true if this connection must mix down voices into a local buffer */ inline bool must_mix() const { return _src_port->poly() > _dst_port->poly(); } @@ -104,7 +101,6 @@ protected: BufferFactory& _bufs; PortImpl* const _src_port; PortImpl* const _dst_port; - BufferFactory::Ref _local_buffer; bool _pending_disconnection; }; -- cgit v1.2.1