From cf63c971c2a8ee8cc2ddcddb52ce8135cd29619b Mon Sep 17 00:00:00 2001 From: David Robillard Date: Sat, 13 Oct 2007 20:35:29 +0000 Subject: Fix sub-patch MIDI I/O. Make buffer 'joining' (zero-copy connections) significantly less retarded. git-svn-id: http://svn.drobilla.net/lad/ingen@882 a436a847-0d15-0410-975c-d299462d15a1 --- src/libs/engine/DuplexPort.cpp | 31 ++++++++++++++++++++++++++++--- 1 file changed, 28 insertions(+), 3 deletions(-) (limited to 'src/libs/engine/DuplexPort.cpp') diff --git a/src/libs/engine/DuplexPort.cpp b/src/libs/engine/DuplexPort.cpp index 93b61b8c..0da8d9d4 100644 --- a/src/libs/engine/DuplexPort.cpp +++ b/src/libs/engine/DuplexPort.cpp @@ -23,6 +23,7 @@ #include "ConnectionImpl.hpp" #include "OutputPort.hpp" #include "NodeImpl.hpp" +#include "ProcessContext.hpp" using namespace std; @@ -43,10 +44,26 @@ void DuplexPort::pre_process(ProcessContext& context) { // - InputPort::pre_process(context); + + /*cerr << path() << " duplex pre: fixed buffers: " << fixed_buffers() << endl; + cerr << path() << " duplex pre: buffer: " << buffer(0) << endl; + cerr << path() << " duplex pre: is_output: " << _is_output << " { " << endl;*/ + + if (_is_output) { + + for (uint32_t i=0; i < _poly; ++i) + _buffers->at(i)->prepare_write(context.nframes()); + + } else { + + for (uint32_t i=0; i < _poly; ++i) + _buffers->at(i)->prepare_read(context.nframes()); - if ( ! _is_output) broadcast(context); + } + + //cerr << "} pre " << path() << endl; + // } @@ -54,12 +71,20 @@ DuplexPort::pre_process(ProcessContext& context) void DuplexPort::post_process(ProcessContext& context) { + /*cerr << path() << " duplex post: fixed buffers: " << fixed_buffers() << endl; + cerr << path() << " duplex post: buffer: " << buffer(0) << endl; + cerr << path() << " duplex post: is_output: " << _is_output << " { " << endl;*/ + // - if (_is_output) + if (_is_output) { + InputPort::pre_process(context); // Mix down inputs broadcast(context); + } OutputPort::pre_process(context); // + + //cerr << "} post " << path() << endl; } -- cgit v1.2.1