Fix buffer-overflow when vari-speeding
Session::process() can call split-cycle which offset the buffer pointers. When vari-speeding at speed > 1.0, the engine also splits the cycle every n_samples, to not exceed the configured buffersize. This needs to take prior buffer offsets into account.
This commit is contained in:
parent
6ee21fb77e
commit
512c27d277
@ -447,11 +447,18 @@ AudioEngine::process_callback (pframes_t nframes)
|
|||||||
} else {
|
} else {
|
||||||
pframes_t remain = Port::cycle_nframes ();
|
pframes_t remain = Port::cycle_nframes ();
|
||||||
while (remain > 0) {
|
while (remain > 0) {
|
||||||
|
/* keep track of split_cycle() calls by Session::process */
|
||||||
|
samplecnt_t poff = Port::port_offset ();
|
||||||
pframes_t nf = std::min (remain, nframes);
|
pframes_t nf = std::min (remain, nframes);
|
||||||
_session->process (nf);
|
_session->process (nf);
|
||||||
remain -= nf;
|
remain -= nf;
|
||||||
if (remain > 0) {
|
if (remain > 0) {
|
||||||
split_cycle (nf);
|
/* calculate split-cycle offset */
|
||||||
|
samplecnt_t delta = Port::port_offset () - poff;
|
||||||
|
assert (delta >= 0 && delta <= nf);
|
||||||
|
if (nf > delta) {
|
||||||
|
split_cycle (nf - delta);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user