From 8bf529bb24c03ebdce884cf9a4288812bb9b2cd5 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Mon, 20 Mar 2017 02:50:00 +0100 Subject: Fix value buffer update --- src/server/Buffer.cpp | 16 +++++++++++----- src/server/InputPort.cpp | 13 ++++++++----- src/server/PortImpl.cpp | 1 - 3 files changed, 19 insertions(+), 11 deletions(-) (limited to 'src') diff --git a/src/server/Buffer.cpp b/src/server/Buffer.cpp index 7af3d47e..fb7efa85 100644 --- a/src/server/Buffer.cpp +++ b/src/server/Buffer.cpp @@ -421,15 +421,21 @@ Buffer::update_value_buffer(SampleCount offset) return; } - LV2_Atom_Sequence* seq = get(); + LV2_Atom_Sequence* seq = get(); + LV2_Atom_Event* latest = NULL; LV2_ATOM_SEQUENCE_FOREACH(seq, ev) { - if (ev->time.frames <= offset && ev->body.type == _value_type) { - memcpy(_value_buffer->get(), - &ev->body, - lv2_atom_total_size(&ev->body)); + if (ev->time.frames > offset) { break; + } else if (ev->body.type == _value_type) { + latest = ev; } } + + if (latest) { + memcpy(_value_buffer->get(), + &latest->body, + lv2_atom_total_size(&latest->body)); + } } #ifndef NDEBUG diff --git a/src/server/InputPort.cpp b/src/server/InputPort.cpp index 6e72f6f6..fe613f31 100644 --- a/src/server/InputPort.cpp +++ b/src/server/InputPort.cpp @@ -217,12 +217,15 @@ SampleCount InputPort::next_value_offset(SampleCount offset, SampleCount end) const { SampleCount earliest = end; + + if (_user_buffer) { + earliest = _user_buffer->next_value_offset(offset, end); + } + for (const auto& arc : _arcs) { - if (arc.tail()->type() != this->type()) { - const SampleCount o = arc.tail()->next_value_offset(offset, end); - if (o < earliest) { - earliest = o; - } + const SampleCount o = arc.tail()->next_value_offset(offset, end); + if (o < earliest) { + earliest = o; } } diff --git a/src/server/PortImpl.cpp b/src/server/PortImpl.cpp index ec54e9bd..066ac005 100644 --- a/src/server/PortImpl.cpp +++ b/src/server/PortImpl.cpp @@ -555,7 +555,6 @@ PortImpl::post_process(RunContext& context) { for (uint32_t v = 0; v < _poly; ++v) { update_set_state(context, v); - update_values(0, v); } monitor(context); -- cgit v1.2.1