Fix glitches in automation events due to the other glitch fix made a few weeks ago.

It would be more elegant to fix the other glitch so it aligns the buffers correctly (so they do not add the offset to the buffer pointers), but that might need design changes.


git-svn-id: svn://localhost/ardour2/branches/2.0-ongoing@3693 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
Sampo Savolainen 2008-08-14 20:20:09 +00:00
parent 5da039e5fd
commit 82aec01403

View file

@ -428,16 +428,25 @@ PluginInsert::automation_run (vector<Sample *>& bufs, uint32_t nbufs, nframes_t
connect_and_run (bufs, nbufs, nframes, offset, true, now);
return;
}
nframes_t buffer_correct = 0;
int i;
while (nframes) {
nframes_t cnt = min (((nframes_t) ceil (next_event.when) - now), nframes);
nframes_t cnt = min (((nframes_t) ceil (next_event.when) - now), nframes);
// This is called first, but nframes = 256
connect_and_run (bufs, nbufs, cnt, offset, true, now);
nframes -= cnt;
offset += cnt;
now += cnt;
buffer_correct += cnt;
for (i = 0; i < nbufs; i++) {
bufs[i] += cnt;
}
if (!find_next_event (now, end, next_event)) {
break;
@ -449,6 +458,10 @@ PluginInsert::automation_run (vector<Sample *>& bufs, uint32_t nbufs, nframes_t
if (nframes) {
connect_and_run (bufs, nbufs, nframes, offset, true, now);
}
for (i = 0; i < nbufs; i++) {
bufs[i] -= buffer_correct;
}
}
float