diff options
author | David Robillard <d@drobilla.net> | 2017-03-20 02:50:00 +0100 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2017-03-20 03:19:33 +0100 |
commit | 8bf529bb24c03ebdce884cf9a4288812bb9b2cd5 (patch) | |
tree | 13f22cae9425a7b11d1c6c081b34e61e9cde964a /src | |
parent | 2a8f4846d02de4256a0c624ff8a29867bb7da86b (diff) | |
download | ingen-8bf529bb24c03ebdce884cf9a4288812bb9b2cd5.tar.gz ingen-8bf529bb24c03ebdce884cf9a4288812bb9b2cd5.tar.bz2 ingen-8bf529bb24c03ebdce884cf9a4288812bb9b2cd5.zip |
Fix value buffer update
Diffstat (limited to 'src')
-rw-r--r-- | src/server/Buffer.cpp | 16 | ||||
-rw-r--r-- | src/server/InputPort.cpp | 13 | ||||
-rw-r--r-- | src/server/PortImpl.cpp | 1 |
3 files changed, 19 insertions, 11 deletions
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>(); + LV2_Atom_Sequence* seq = get<LV2_Atom_Sequence>(); + 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<LV2_Atom>(), - &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<LV2_Atom>(), + &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); |