diff options
author | David Robillard <d@drobilla.net> | 2016-01-16 13:09:02 -0500 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2016-01-16 13:09:02 -0500 |
commit | 8e33bca074954cf57883e51551b214e66829bed1 (patch) | |
tree | 4dc4d3674cff85e154eb6ebae612d73a0fe5e9e7 /src/server | |
parent | 83759d14c495a9c44c1777f9ccf1962293c1c03a (diff) | |
download | ingen-8e33bca074954cf57883e51551b214e66829bed1.tar.gz ingen-8e33bca074954cf57883e51551b214e66829bed1.tar.bz2 ingen-8e33bca074954cf57883e51551b214e66829bed1.zip |
Fix CV to control connections
This needs a more sophisticated fix, since splitting cycles on every
CV value change isn't feasible much/most of the timel
Diffstat (limited to 'src/server')
-rw-r--r-- | src/server/Buffer.cpp | 30 |
1 files changed, 21 insertions, 9 deletions
diff --git a/src/server/Buffer.cpp b/src/server/Buffer.cpp index d530731e..8a36039e 100644 --- a/src/server/Buffer.cpp +++ b/src/server/Buffer.cpp @@ -338,17 +338,29 @@ Buffer::append_event(int64_t frames, SampleCount Buffer::next_value_offset(SampleCount offset, SampleCount end) const { - SampleCount earliest = end; - const LV2_Atom_Sequence* seq = get<const LV2_Atom_Sequence>(); - LV2_ATOM_SEQUENCE_FOREACH(seq, ev) { - if (ev->time.frames > offset && - ev->time.frames < earliest && - ev->body.type == _value_type) { - earliest = ev->time.frames; - break; + if (_type == _factory.uris().atom_Sequence && _value_type) { + const LV2_Atom_Sequence* seq = get<const LV2_Atom_Sequence>(); + LV2_ATOM_SEQUENCE_FOREACH(seq, ev) { + if (ev->time.frames > offset && + ev->time.frames < end && + ev->body.type == _value_type) { + return ev->time.frames; + } + } + } else if (is_audio()) { + /* FIXME: This results in split cycles when a CV output port is + connected to a control input port. In the worst case, that could + run the receiving plugin every sample. Some way of controlling this + behaviour is needed. */ + float val = samples()[offset]; + for (SampleCount i = offset + 1; i < end; ++i) { + if (samples()[i] != val) { + return i; + } } } - return earliest; + + return end; } const LV2_Atom* |