summaryrefslogtreecommitdiffstats
path: root/src/engine
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2008-11-22 06:54:01 +0000
committerDavid Robillard <d@drobilla.net>2008-11-22 06:54:01 +0000
commitfc397802d408441ce354c5b0328adc93f617aca5 (patch)
tree20c5e837ce7153d4989e4a290527d131353b727a /src/engine
parent91575b926a29fab3d8cfab439b99198be032a45f (diff)
downloadingen-fc397802d408441ce354c5b0328adc93f617aca5.tar.gz
ingen-fc397802d408441ce354c5b0328adc93f617aca5.tar.bz2
ingen-fc397802d408441ce354c5b0328adc93f617aca5.zip
Fix event loss for outputs connected directly to several inputs (fix ticket #231).
git-svn-id: http://svn.drobilla.net/lad/trunk/ingen@1763 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src/engine')
-rw-r--r--src/engine/ConnectionImpl.cpp4
-rw-r--r--src/engine/EventBuffer.cpp3
-rw-r--r--src/engine/EventBuffer.hpp2
-rw-r--r--src/engine/InputPort.cpp16
4 files changed, 15 insertions, 10 deletions
diff --git a/src/engine/ConnectionImpl.cpp b/src/engine/ConnectionImpl.cpp
index 79fb59e1..46e7fcc6 100644
--- a/src/engine/ConnectionImpl.cpp
+++ b/src/engine/ConnectionImpl.cpp
@@ -233,8 +233,10 @@ ConnectionImpl::process(ProcessContext& context)
if (copy_size < dst_buf->size())
dst_buf->set_block(src_buf->value_at(copy_size - 1), copy_size, dst_buf->size() - 1);
}
+ } else if (_mode == DIRECT) {
+ for (uint32_t j=0; j < src_port()->poly(); ++j)
+ src_port()->buffer(j)->prepare_read(context.start(), context.nframes());
}
-
}
diff --git a/src/engine/EventBuffer.cpp b/src/engine/EventBuffer.cpp
index 4d499496..98a98a20 100644
--- a/src/engine/EventBuffer.cpp
+++ b/src/engine/EventBuffer.cpp
@@ -100,6 +100,7 @@ EventBuffer::join(Buffer* buf)
void
EventBuffer::unjoin()
{
+ //cout << this << " unjoin" << endl;
_joined_buf = NULL;
_buf = _local_buf;
reset(_this_nframes);
@@ -109,7 +110,6 @@ EventBuffer::unjoin()
void
EventBuffer::prepare_read(FrameTime start, SampleCount nframes)
{
- //cerr << "\t" << this << " prepare_read: " << event_count() << endl;
rewind();
_this_nframes = nframes;
}
@@ -134,6 +134,7 @@ EventBuffer::copy(const Buffer* src_buf, size_t start_sample, size_t end_sample)
src->rewind();
memcpy(_buf, src->_buf, src->_buf->size);
+ _this_nframes = end_sample - start_sample;
}
diff --git a/src/engine/EventBuffer.hpp b/src/engine/EventBuffer.hpp
index 0c80d452..654e229b 100644
--- a/src/engine/EventBuffer.hpp
+++ b/src/engine/EventBuffer.hpp
@@ -18,7 +18,6 @@
#ifndef EVENTBUFFER_H
#define EVENTBUFFER_H
-#include <iostream>
#include <lv2ext/lv2_event.h>
#include <lv2ext/lv2_event_helpers.h>
#include "Buffer.hpp"
@@ -56,7 +55,6 @@ public:
inline void rewind() const { lv2_event_begin(&_iter, _buf); }
inline void clear() { reset(_this_nframes); }
inline void reset(SampleCount nframes) {
- //std::cerr << this << " reset" << std::endl;
_this_nframes = nframes;
_latest_frames = 0;
_latest_subframes = 0;
diff --git a/src/engine/InputPort.cpp b/src/engine/InputPort.cpp
index 3257144c..531ca468 100644
--- a/src/engine/InputPort.cpp
+++ b/src/engine/InputPort.cpp
@@ -207,6 +207,8 @@ InputPort::pre_process(ProcessContext& context)
if (can_direct()) {
for (uint32_t i=0; i < _poly; ++i) {
_buffers->at(i)->join(_connections.front()->buffer(i));
+ _connections.front()->buffer(i)->prepare_read(context.start(), context.nframes());
+ _buffers->at(i)->prepare_read(context.start(), context.nframes());
}
do_mixdown = false;
}
@@ -224,9 +226,10 @@ InputPort::pre_process(ProcessContext& context)
/*if (type() == DataType::EVENT)
for (uint32_t i=0; i < _poly; ++i)
- cerr << path() << " (" << buffer(i) << ") # events: "
- << ((EventBuffer*)buffer(i))->event_count()
- << ", joined: " << _buffers->at(i)->is_joined() << endl;*/
+ if (((EventBuffer*)buffer(i))->event_count() > 0)
+ cerr << path() << " (" << buffer(i) << ") # events: "
+ << ((EventBuffer*)buffer(i))->event_count()
+ << ", joined: " << _buffers->at(i)->is_joined() << endl;*/
if (!do_mixdown) {
/*#ifndef NDEBUG
@@ -270,9 +273,10 @@ InputPort::post_process(ProcessContext& context)
{
broadcast(context);
- // Prepare for next cycle
- for (uint32_t i=0; i < _poly; ++i)
- buffer(i)->prepare_write(context.start(), context.nframes());
+ // Prepare buffers for next cycle
+ if (!can_direct())
+ for (uint32_t i=0; i < _poly; ++i)
+ buffer(i)->prepare_write(context.start(), context.nframes());
_set_by_user = false;